@semiont/graph 0.5.8 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/{chunk-X2EYPGAZ.js → chunk-5I735PFE.js} +3 -3
  2. package/dist/{chunk-UIWU7C63.js → chunk-6TGQEJA4.js} +10 -9
  3. package/dist/chunk-6TGQEJA4.js.map +1 -0
  4. package/dist/{chunk-4UP2SG3N.js → chunk-7UEKNJE3.js} +11 -3
  5. package/dist/chunk-7UEKNJE3.js.map +1 -0
  6. package/dist/{chunk-OZ32AVV5.js → chunk-CRYMBICT.js} +401 -12
  7. package/dist/chunk-CRYMBICT.js.map +1 -0
  8. package/dist/{chunk-7MBS5BCU.js → chunk-GT55OYHJ.js} +278 -3
  9. package/dist/chunk-GT55OYHJ.js.map +1 -0
  10. package/dist/{chunk-V4VXQDJC.js → chunk-RUQUFRTB.js} +2 -2
  11. package/dist/{chunk-6LK37BZL.js → chunk-VAQKCHGM.js} +3 -3
  12. package/dist/{chunk-S4CREE4D.js → chunk-XVAXFDCH.js} +3 -3
  13. package/dist/{dist-es-QVOVCRNO.js → dist-es-BICV5PRG.js} +66 -40
  14. package/dist/dist-es-BICV5PRG.js.map +1 -0
  15. package/dist/{dist-es-5LDKLONQ.js → dist-es-IYLVRDN3.js} +6 -6
  16. package/dist/{dist-es-R57DPHWD.js → dist-es-LTFG4B4M.js} +4 -4
  17. package/dist/{dist-es-DP2DJETP.js → dist-es-O4WJLVW6.js} +4 -4
  18. package/dist/{dist-es-BVTAQOW4.js → dist-es-RW76EFCY.js} +32 -24
  19. package/dist/{dist-es-BVTAQOW4.js.map → dist-es-RW76EFCY.js.map} +1 -1
  20. package/dist/{dist-es-ZYIOCGDF.js → dist-es-SEF7BNPV.js} +2 -2
  21. package/dist/{dist-es-2BYZJAYP.js → dist-es-UN7O5Q4Y.js} +4 -4
  22. package/dist/{dist-es-XYRRUVYH.js → dist-es-VCGRE52I.js} +3 -3
  23. package/dist/index.js +1 -1
  24. package/dist/{loadSso-A2IPWKXP.js → loadSso-GUTPMZHZ.js} +7 -7
  25. package/dist/{signin-RCXP5J3U.js → signin-HRP5GJ43.js} +141 -63
  26. package/dist/signin-HRP5GJ43.js.map +1 -0
  27. package/dist/{sso-oidc-4CC2UEU6.js → sso-oidc-HISAR7RH.js} +7 -7
  28. package/dist/{sts-3SNKVYZX.js → sts-IK55KWBZ.js} +7 -7
  29. package/package.json +4 -4
  30. package/dist/chunk-4UP2SG3N.js.map +0 -1
  31. package/dist/chunk-7MBS5BCU.js.map +0 -1
  32. package/dist/chunk-OZ32AVV5.js.map +0 -1
  33. package/dist/chunk-UIWU7C63.js.map +0 -1
  34. package/dist/dist-es-QVOVCRNO.js.map +0 -1
  35. package/dist/signin-RCXP5J3U.js.map +0 -1
  36. /package/dist/{chunk-X2EYPGAZ.js.map → chunk-5I735PFE.js.map} +0 -0
  37. /package/dist/{chunk-V4VXQDJC.js.map → chunk-RUQUFRTB.js.map} +0 -0
  38. /package/dist/{chunk-6LK37BZL.js.map → chunk-VAQKCHGM.js.map} +0 -0
  39. /package/dist/{chunk-S4CREE4D.js.map → chunk-XVAXFDCH.js.map} +0 -0
  40. /package/dist/{dist-es-5LDKLONQ.js.map → dist-es-IYLVRDN3.js.map} +0 -0
  41. /package/dist/{dist-es-R57DPHWD.js.map → dist-es-LTFG4B4M.js.map} +0 -0
  42. /package/dist/{dist-es-DP2DJETP.js.map → dist-es-O4WJLVW6.js.map} +0 -0
  43. /package/dist/{dist-es-ZYIOCGDF.js.map → dist-es-SEF7BNPV.js.map} +0 -0
  44. /package/dist/{dist-es-2BYZJAYP.js.map → dist-es-UN7O5Q4Y.js.map} +0 -0
  45. /package/dist/{dist-es-XYRRUVYH.js.map → dist-es-VCGRE52I.js.map} +0 -0
  46. /package/dist/{loadSso-A2IPWKXP.js.map → loadSso-GUTPMZHZ.js.map} +0 -0
  47. /package/dist/{sso-oidc-4CC2UEU6.js.map → sso-oidc-HISAR7RH.js.map} +0 -0
  48. /package/dist/{sts-3SNKVYZX.js.map → sts-IK55KWBZ.js.map} +0 -0
@@ -2,10 +2,10 @@ import {
2
2
  ProtocolLib,
3
3
  SerdeContextConfig,
4
4
  UnionSerde
5
- } from "./chunk-X2EYPGAZ.js";
5
+ } from "./chunk-5I735PFE.js";
6
6
  import {
7
7
  getValueFromTextNode
8
- } from "./chunk-7MBS5BCU.js";
8
+ } from "./chunk-GT55OYHJ.js";
9
9
  import {
10
10
  FromStringShapeDeserializer,
11
11
  NormalizedSchema,
@@ -14,7 +14,7 @@ import {
14
14
  deref,
15
15
  determineTimestampFormat,
16
16
  extendedEncodeURIComponent
17
- } from "./chunk-4UP2SG3N.js";
17
+ } from "./chunk-7UEKNJE3.js";
18
18
  import {
19
19
  NumericValue,
20
20
  dateToUtcString,
@@ -1453,6 +1453,14 @@ var COMMON_HTML = {
1453
1453
  };
1454
1454
 
1455
1455
  // ../../node_modules/@nodable/entities/src/EntityDecoder.js
1456
+ var ENTITY_ACTION = Object.freeze({
1457
+ /** Resolve and expand the entity normally. */
1458
+ ALLOW: "allow",
1459
+ /** Silently skip this entity — it will not be registered. */
1460
+ BLOCK: "block",
1461
+ /** Throw an error, aborting entity registration entirely. */
1462
+ THROW: "throw"
1463
+ });
1456
1464
  var SPECIAL_CHARS = new Set("!?\\\\/[]$%{}^&*()<>|+");
1457
1465
  function validateEntityName(name) {
1458
1466
  if (name[0] === "#") {
@@ -1532,6 +1540,14 @@ var EntityDecoder = class {
1532
1540
  * the effective action is max(onNCR, rangeMinimum).
1533
1541
  * @param {'remove'|'throw'} [options.ncr.nullNCR='remove']
1534
1542
  * Action for U+0000 (null). 'allow' and 'leave' are clamped to 'remove' since null is never safe.
1543
+ * @param {((name: string, value: string) => 'allow'|'block'|'throw')|null} [options.onExternalEntity=null]
1544
+ * Hook called when an external entity is registered via `setExternalEntities()` or
1545
+ * `addExternalEntity()`. Return `ENTITY_ACTION.ALLOW` to accept the entity,
1546
+ * `ENTITY_ACTION.BLOCK` to silently skip it, or `ENTITY_ACTION.THROW` to abort with an error.
1547
+ * @param {((name: string, value: string) => 'allow'|'block'|'throw')|null} [options.onInputEntity=null]
1548
+ * Hook called when an input entity is registered via `addInputEntities()`. Return
1549
+ * `ENTITY_ACTION.ALLOW` to accept, `ENTITY_ACTION.BLOCK` to silently skip, or
1550
+ * `ENTITY_ACTION.THROW` to abort with an error.
1535
1551
  */
1536
1552
  constructor(options = {}) {
1537
1553
  this._limit = options.limit || {};
@@ -1551,6 +1567,33 @@ var EntityDecoder = class {
1551
1567
  this._ncrXmlVersion = ncrCfg.xmlVersion;
1552
1568
  this._ncrOnLevel = ncrCfg.onLevel;
1553
1569
  this._ncrNullLevel = ncrCfg.nullLevel;
1570
+ this._onExternalEntity = typeof options.onExternalEntity === "function" ? options.onExternalEntity : null;
1571
+ this._onInputEntity = typeof options.onInputEntity === "function" ? options.onInputEntity : null;
1572
+ }
1573
+ // -------------------------------------------------------------------------
1574
+ // Private: registration hook dispatch
1575
+ // -------------------------------------------------------------------------
1576
+ /**
1577
+ * Invoke a registration hook for a single entity name/value pair.
1578
+ * Returns true when the entity should be accepted, false when it should be
1579
+ * silently skipped (BLOCK), and throws when the hook returns THROW.
1580
+ *
1581
+ * @param {((name: string, value: string) => 'allow'|'block'|'throw')|null} hook
1582
+ * @param {string} name
1583
+ * @param {string} value
1584
+ * @param {string} context — used in error messages ('external' | 'input')
1585
+ * @returns {boolean} true = accept, false = skip
1586
+ */
1587
+ _applyRegistrationHook(hook, name, value, context) {
1588
+ if (!hook) return true;
1589
+ const action = hook(name, value);
1590
+ if (action === ENTITY_ACTION.BLOCK) return false;
1591
+ if (action === ENTITY_ACTION.THROW) {
1592
+ throw new Error(
1593
+ `[EntityDecoder] Registration of ${context} entity "&${name};" was rejected by hook`
1594
+ );
1595
+ }
1596
+ return true;
1554
1597
  }
1555
1598
  // -------------------------------------------------------------------------
1556
1599
  // Persistent external entity registration
@@ -1558,6 +1601,9 @@ var EntityDecoder = class {
1558
1601
  /**
1559
1602
  * Replace the full set of persistent external entities.
1560
1603
  * All keys are validated — throws on invalid characters.
1604
+ * If `onExternalEntity` is set, it is called once per entry; entries that
1605
+ * return `ENTITY_ACTION.BLOCK` are silently omitted, `ENTITY_ACTION.THROW`
1606
+ * aborts the whole call.
1561
1607
  * @param {Record<string, string | { regex?: RegExp, val: string }>} map
1562
1608
  */
1563
1609
  setExternalEntities(map) {
@@ -1566,17 +1612,32 @@ var EntityDecoder = class {
1566
1612
  validateEntityName(key);
1567
1613
  }
1568
1614
  }
1569
- this._externalMap = mergeEntityMaps(map);
1615
+ if (!this._onExternalEntity) {
1616
+ this._externalMap = mergeEntityMaps(map);
1617
+ return;
1618
+ }
1619
+ const flat = mergeEntityMaps(map);
1620
+ const filtered = /* @__PURE__ */ Object.create(null);
1621
+ for (const [name, value] of Object.entries(flat)) {
1622
+ if (this._applyRegistrationHook(this._onExternalEntity, name, value, "external")) {
1623
+ filtered[name] = value;
1624
+ }
1625
+ }
1626
+ this._externalMap = filtered;
1570
1627
  }
1571
1628
  /**
1572
1629
  * Add a single persistent external entity.
1630
+ * If `onExternalEntity` is set it is called before the entity is stored;
1631
+ * `ENTITY_ACTION.BLOCK` silently skips storage, `ENTITY_ACTION.THROW` raises.
1573
1632
  * @param {string} key
1574
1633
  * @param {string} value
1575
1634
  */
1576
1635
  addExternalEntity(key, value) {
1577
1636
  validateEntityName(key);
1578
1637
  if (typeof value === "string" && value.indexOf("&") === -1) {
1579
- this._externalMap[key] = value;
1638
+ if (this._applyRegistrationHook(this._onExternalEntity, key, value, "external")) {
1639
+ this._externalMap[key] = value;
1640
+ }
1580
1641
  }
1581
1642
  }
1582
1643
  // -------------------------------------------------------------------------
@@ -1585,12 +1646,25 @@ var EntityDecoder = class {
1585
1646
  /**
1586
1647
  * Inject DOCTYPE entities for the current document.
1587
1648
  * Also resets per-document expansion counters.
1649
+ * If `onInputEntity` is set it is called once per entry; entries returning
1650
+ * `ENTITY_ACTION.BLOCK` are silently omitted, `ENTITY_ACTION.THROW` aborts.
1588
1651
  * @param {Record<string, string | { regx?: RegExp, regex?: RegExp, val: string }>} map
1589
1652
  */
1590
1653
  addInputEntities(map) {
1591
1654
  this._totalExpansions = 0;
1592
1655
  this._expandedLength = 0;
1593
- this._inputMap = mergeEntityMaps(map);
1656
+ if (!this._onInputEntity) {
1657
+ this._inputMap = mergeEntityMaps(map);
1658
+ return;
1659
+ }
1660
+ const flat = mergeEntityMaps(map);
1661
+ const filtered = /* @__PURE__ */ Object.create(null);
1662
+ for (const [name, value] of Object.entries(flat)) {
1663
+ if (this._applyRegistrationHook(this._onInputEntity, name, value, "input")) {
1664
+ filtered[name] = value;
1665
+ }
1666
+ }
1667
+ this._inputMap = filtered;
1594
1668
  }
1595
1669
  // -------------------------------------------------------------------------
1596
1670
  // Per-document reset
@@ -2266,6 +2340,234 @@ function validateEntityName2(name) {
2266
2340
  throw new Error(`Invalid entity name ${name}`);
2267
2341
  }
2268
2342
 
2343
+ // ../../node_modules/anynum/digitTable.js
2344
+ var SCRIPT_ZEROS = [
2345
+ // Basic Latin (ASCII) — included for completeness / pass-through
2346
+ 48,
2347
+ // 0-9
2348
+ // Arabic scripts
2349
+ 1632,
2350
+ // Arabic-Indic ٠١٢٣٤٥٦٧٨٩
2351
+ 1776,
2352
+ // Extended Arabic-Indic (Urdu/Persian/Sindhi) ۰۱۲۳
2353
+ // Indic scripts
2354
+ 2406,
2355
+ // Devanagari ०१२३४५६७८९
2356
+ 2534,
2357
+ // Bengali ০১২৩৪৫৬৭৮৯
2358
+ 2662,
2359
+ // Gurmukhi ੦੧੨੩੪੫੬੭੮੯
2360
+ 2790,
2361
+ // Gujarati ૦૧૨૩૪૫૬૭૮૯
2362
+ 2918,
2363
+ // Odia ୦୧୨୩୪୫୬୭୮୯
2364
+ 3046,
2365
+ // Tamil ௦௧௨௩௪௫௬௭௮௯
2366
+ 3174,
2367
+ // Telugu ౦౧౨౩౪౫౬౭౮౯
2368
+ 3302,
2369
+ // Kannada ೦೧೨೩೪೫೬೭೮೯
2370
+ 3430,
2371
+ // Malayalam ൦൧൨൩൪൫൬൭൮൯
2372
+ 3558,
2373
+ // Sinhala Archaic ෦෧෨෩෪෫෬෭෮෯
2374
+ // Southeast Asian scripts
2375
+ 3664,
2376
+ // Thai ๐๑๒๓๔๕๖๗๘๙
2377
+ 3792,
2378
+ // Lao ໐໑໒໓໔໕໖໗໘໙
2379
+ 3872,
2380
+ // Tibetan ༠༡༢༣༤༥༦༧༨༩
2381
+ 4160,
2382
+ // Myanmar ၀၁၂၃၄၅၆၇၈၉
2383
+ 4240,
2384
+ // Myanmar Shan ႐႑႒႓႔႕႖႗႘႙
2385
+ 6112,
2386
+ // Khmer ០១២៣៤៥៦៧៨៩
2387
+ 6160,
2388
+ // Mongolian ᠐᠑᠒᠓᠔᠕᠖᠗᠘᠙
2389
+ 6470,
2390
+ // Limbu ᥆᥇᥈᥉᥊᥋᥌᥍᥎᥏
2391
+ 6608,
2392
+ // New Tai Lue ᧐᧑᧒᧓᧔᧕᧖᧗᧘᧙
2393
+ 6784,
2394
+ // Tai Tham Hora ᪀᪁᪂᪃᪄᪅᪆᪇᪈᪉
2395
+ 6800,
2396
+ // Tai Tham Tham ᪐᪑᪒᪓᪔᪕᪖᪗᪘᪙
2397
+ 6992,
2398
+ // Balinese ᭐᭑᭒᭓᭔᭕᭖᭗᭘᭙
2399
+ 7088,
2400
+ // Sundanese ᮰᮱᮲᮳᮴᮵᮶᮷᮸᮹
2401
+ 7232,
2402
+ // Lepcha ᱀᱁᱂᱃᱄᱅᱆᱇᱈᱉
2403
+ 7248,
2404
+ // Ol Chiki ᱐᱑᱒᱓᱔᱕᱖᱗᱘᱙
2405
+ // Fullwidth (CJK context)
2406
+ 65296,
2407
+ // Fullwidth 0123456789
2408
+ // Mathematical digit variants (Unicode math block)
2409
+ 120782,
2410
+ // Mathematical Bold
2411
+ 120792,
2412
+ // Mathematical Double-Struck
2413
+ 120802,
2414
+ // Mathematical Sans-Serif
2415
+ 120812,
2416
+ // Mathematical Sans-Serif Bold
2417
+ 120822,
2418
+ // Mathematical Monospace
2419
+ // Other scripts
2420
+ 66720,
2421
+ // Osmanya 𐒠𐒡𐒢𐒣𐒤𐒥𐒦𐒧𐒨𐒩
2422
+ 68912,
2423
+ // Hanifi Rohingya 𐴰𐴱𐴲𐴳𐴴𐴵𐴶𐴷𐴸𐴹
2424
+ 69734,
2425
+ // Brahmi 𑁦𑁧𑁨𑁩𑁪𑁫𑁬𑁭𑁮𑁯
2426
+ 69872,
2427
+ // Sora Sompeng 𑃰𑃱𑃲𑃳𑃴𑃵𑃶𑃷𑃸𑃹
2428
+ 69942,
2429
+ // Chakma 𑄶𑄷𑄸𑄹𑄺𑄻𑄼𑄽𑄾𑄿
2430
+ 70096,
2431
+ // Sharada 𑇐𑇑𑇒𑇓𑇔𑇕𑇖𑇗𑇘𑇙
2432
+ 70384,
2433
+ // Khudawadi 𑋰𑋱𑋲𑋳𑋴𑋵𑋶𑋷𑋸𑋹
2434
+ 70736,
2435
+ // Newa 𑑐𑑑𑑒𑑓𑑔𑑕𑑖𑑗𑑘𑑙
2436
+ 70864,
2437
+ // Tirhuta 𑓐𑓑𑓒𑓓𑓔𑓕𑓖𑓗𑓘𑓙
2438
+ 71248,
2439
+ // Modi 𑙐𑙑𑙒𑙓𑙔𑙕𑙖𑙗𑙘𑙙
2440
+ 71360,
2441
+ // Takri 𑛀𑛁𑛂𑛃𑛄𑛅𑛆𑛇𑛈𑛉
2442
+ 71472,
2443
+ // Ahom 𑜰𑜱𑜲𑜳𑜴𑜵𑜶𑜷𑜸𑜹
2444
+ 71904,
2445
+ // Warang Citi 𑣠𑣡𑣢𑣣𑣤𑣥𑣦𑣧𑣨𑣩
2446
+ 72016,
2447
+ // Dives Akuru 𑥐𑥑𑥒𑥓𑥔𑥕𑥖𑥗𑥘𑥙
2448
+ 72688,
2449
+ // Khitan Small Script 𑯰𑯱𑯲𑯳𑯴𑯵𑯶𑯷𑯸𑯹
2450
+ 72784,
2451
+ // Bhaiksuki 𑱐𑱑𑱒𑱓𑱔𑱕𑱖𑱗𑱘𑱙
2452
+ 73040,
2453
+ // Masaram Gondi 𑵐𑵑𑵒𑵓𑵔𑵕𑵖𑵗𑵘𑵙
2454
+ 73120,
2455
+ // Gunjala Gondi 𑶠𑶡𑶢𑶣𑶤𑶥𑶦𑶧𑶨𑶩
2456
+ 73552,
2457
+ // Kawi 𑽐𑽑𑽒𑽓𑽔𑽕𑽖𑽗𑽘𑽙
2458
+ 92768,
2459
+ // Mro 𖩠𖩡𖩢𖩣𖩤𖩥𖩦𖩧𖩨𖩩
2460
+ 92864,
2461
+ // Tangsa 𖫀𖫁𖫂𖫃𖫄𖫅𖫆𖫇𖫈𖫉
2462
+ 93008,
2463
+ // Pahawh Hmong 𖭐𖭑𖭒𖭓𖭔𖭕𖭖𖭗𖭘𖭙
2464
+ 123200,
2465
+ // Nyiakeng Puachue Hmong 𞅀𞅁𞅂𞅃𞅄𞅅𞅆𞅇𞅈𞅉
2466
+ 123632,
2467
+ // Wancho 𞋰𞋱𞋲𞋳𞋴𞋵𞋶𞋷𞋸𞋹
2468
+ 124144,
2469
+ // Nag Mundari 𞓰𞓱𞓲𞓳𞓴𞓵𞓶𞓷𞓸𞓹
2470
+ 125264,
2471
+ // Adlam 𞥐𞥑𞥒𞥓𞥔𞥕𞥖𞥗𞥘𞥙
2472
+ 130032
2473
+ // Segmented digit symbols 🯰🯱🯲🯳🯴🯵🯶🯷🯸🯹
2474
+ ];
2475
+ var NOT_DIGIT = 255;
2476
+ var HIGH_MAP = /* @__PURE__ */ new Map();
2477
+ var LOW_MAX = 65535;
2478
+ var LOW_MIN = 1632;
2479
+ var TABLE_OFFSET = LOW_MIN;
2480
+ var TABLE_SIZE = LOW_MAX - LOW_MIN + 1;
2481
+ var TABLE = new Uint8Array(TABLE_SIZE).fill(NOT_DIGIT);
2482
+ for (const zero of SCRIPT_ZEROS) {
2483
+ for (let d = 0; d < 10; d++) {
2484
+ const cp = zero + d;
2485
+ if (cp <= LOW_MAX) {
2486
+ TABLE[cp - TABLE_OFFSET] = d;
2487
+ } else {
2488
+ HIGH_MAP.set(cp, d);
2489
+ }
2490
+ }
2491
+ }
2492
+
2493
+ // ../../node_modules/anynum/anynum.js
2494
+ var CHAR_0 = 48;
2495
+ var CHAR_9 = 57;
2496
+ var CHAR_MINUS = 45;
2497
+ var MINUS_SET = /* @__PURE__ */ new Set([8722, 65293, 65123]);
2498
+ function anynum(str) {
2499
+ if (typeof str !== "string") return str;
2500
+ const len = str.length;
2501
+ if (len === 0) return str;
2502
+ let firstHit = -1;
2503
+ for (let i = 0; i < len; i++) {
2504
+ const cc = str.charCodeAt(i);
2505
+ if (cc >= CHAR_0 && cc <= CHAR_9 || cc === CHAR_MINUS) continue;
2506
+ if (cc < TABLE_OFFSET) {
2507
+ if (MINUS_SET.has(cc)) {
2508
+ firstHit = i;
2509
+ break;
2510
+ }
2511
+ continue;
2512
+ }
2513
+ if (cc >= 55296 && cc <= 56319) {
2514
+ if (i + 1 < len) {
2515
+ const low = str.charCodeAt(i + 1);
2516
+ if (low >= 56320 && low <= 57343) {
2517
+ const cp = 65536 + (cc - 55296 << 10) + (low - 56320);
2518
+ if (HIGH_MAP.has(cp)) {
2519
+ firstHit = i;
2520
+ break;
2521
+ }
2522
+ }
2523
+ }
2524
+ continue;
2525
+ }
2526
+ if (TABLE[cc - TABLE_OFFSET] !== NOT_DIGIT || MINUS_SET.has(cc)) {
2527
+ firstHit = i;
2528
+ break;
2529
+ }
2530
+ }
2531
+ if (firstHit === -1) return str;
2532
+ const chars = [];
2533
+ if (firstHit > 0) chars.push(str.slice(0, firstHit));
2534
+ for (let i = firstHit; i < len; i++) {
2535
+ const cc = str.charCodeAt(i);
2536
+ if (cc >= CHAR_0 && cc <= CHAR_9 || cc === CHAR_MINUS) {
2537
+ chars.push(str[i]);
2538
+ continue;
2539
+ }
2540
+ if (cc < TABLE_OFFSET) {
2541
+ chars.push(MINUS_SET.has(cc) ? "-" : str[i]);
2542
+ continue;
2543
+ }
2544
+ if (cc >= 55296 && cc <= 56319) {
2545
+ if (i + 1 < len) {
2546
+ const low = str.charCodeAt(i + 1);
2547
+ if (low >= 56320 && low <= 57343) {
2548
+ const cp = 65536 + (cc - 55296 << 10) + (low - 56320);
2549
+ const d2 = HIGH_MAP.get(cp);
2550
+ if (d2 !== void 0) {
2551
+ chars.push(String.fromCharCode(d2 + 48));
2552
+ i++;
2553
+ continue;
2554
+ }
2555
+ }
2556
+ }
2557
+ chars.push(str[i]);
2558
+ continue;
2559
+ }
2560
+ if (MINUS_SET.has(cc)) {
2561
+ chars.push("-");
2562
+ continue;
2563
+ }
2564
+ const d = TABLE[cc - TABLE_OFFSET];
2565
+ chars.push(d !== NOT_DIGIT ? String.fromCharCode(d + 48) : str[i]);
2566
+ }
2567
+ return chars.join("");
2568
+ }
2569
+ var anynum_default = anynum;
2570
+
2269
2571
  // ../../node_modules/strnum/strnum.js
2270
2572
  var hexRegex = /^[-+]?0x[a-fA-F0-9]+$/;
2271
2573
  var binRegex = /^0b[01]+$/;
@@ -2279,8 +2581,9 @@ var consider = {
2279
2581
  decimalPoint: ".",
2280
2582
  eNotation: true,
2281
2583
  //skipLike: /regex/,
2282
- infinity: "original"
2584
+ infinity: "original",
2283
2585
  // "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
2586
+ unicode: false
2284
2587
  };
2285
2588
  function toNumber(str, options = {}) {
2286
2589
  options = Object.assign({}, consider, options);
@@ -2289,7 +2592,11 @@ function toNumber(str, options = {}) {
2289
2592
  if (trimmedStr.length === 0) return str;
2290
2593
  else if (options.skipLike !== void 0 && options.skipLike.test(trimmedStr)) return str;
2291
2594
  else if (trimmedStr === "0") return 0;
2292
- else if (options.hex && hexRegex.test(trimmedStr)) {
2595
+ if (options.unicode) {
2596
+ trimmedStr = anynum_default(trimmedStr);
2597
+ if (trimmedStr === "0") return 0;
2598
+ }
2599
+ if (options.hex && hexRegex.test(trimmedStr)) {
2293
2600
  return parse_int(trimmedStr, 16);
2294
2601
  } else if (options.binary && binRegex.test(trimmedStr)) {
2295
2602
  return parse_int(trimmedStr, 2);
@@ -2586,6 +2893,7 @@ var ExpressionSet = class {
2586
2893
  this._byDepthAndTag = /* @__PURE__ */ new Map();
2587
2894
  this._wildcardByDepth = /* @__PURE__ */ new Map();
2588
2895
  this._deepWildcards = [];
2896
+ this._deepByTerminalTag = /* @__PURE__ */ new Map();
2589
2897
  this._patterns = /* @__PURE__ */ new Set();
2590
2898
  this._sealed = false;
2591
2899
  }
@@ -2610,7 +2918,14 @@ var ExpressionSet = class {
2610
2918
  if (this._patterns.has(expression.pattern)) return this;
2611
2919
  this._patterns.add(expression.pattern);
2612
2920
  if (expression.hasDeepWildcard()) {
2613
- this._deepWildcards.push(expression);
2921
+ const lastSeg2 = expression.segments[expression.segments.length - 1];
2922
+ if (lastSeg2 && lastSeg2.type !== "deep-wildcard" && lastSeg2.tag !== "*") {
2923
+ const tag2 = lastSeg2.tag;
2924
+ if (!this._deepByTerminalTag.has(tag2)) this._deepByTerminalTag.set(tag2, []);
2925
+ this._deepByTerminalTag.get(tag2).push(expression);
2926
+ } else {
2927
+ this._deepWildcards.push(expression);
2928
+ }
2614
2929
  return this;
2615
2930
  }
2616
2931
  const depth = expression.length;
@@ -2728,6 +3043,12 @@ var ExpressionSet = class {
2728
3043
  if (matcher.matches(wildcardBucket[i])) return wildcardBucket[i];
2729
3044
  }
2730
3045
  }
3046
+ const deepBucket = this._deepByTerminalTag.get(tag);
3047
+ if (deepBucket) {
3048
+ for (let i = 0; i < deepBucket.length; i++) {
3049
+ if (matcher.matches(deepBucket[i])) return deepBucket[i];
3050
+ }
3051
+ }
2731
3052
  for (let i = 0; i < this._deepWildcards.length; i++) {
2732
3053
  if (matcher.matches(this._deepWildcards[i])) return this._deepWildcards[i];
2733
3054
  }
@@ -2787,6 +3108,24 @@ var MatcherView = class {
2787
3108
  const current = path[path.length - 1];
2788
3109
  return current.values !== void 0 && attrName in current.values;
2789
3110
  }
3111
+ /**
3112
+ * Get the value of a "kept" attribute from the nearest ancestor (or
3113
+ * current node) that declared it via `push(tag, attrs, ns, { keep: [...] })`.
3114
+ * @param {string} attrName
3115
+ * @returns {*}
3116
+ */
3117
+ getAnyParentAttr(attrName) {
3118
+ return this._matcher.getAnyParentAttr(attrName);
3119
+ }
3120
+ /**
3121
+ * Check whether any ancestor (or the current node) kept the given
3122
+ * attribute via `push(tag, attrs, ns, { keep: [...] })`.
3123
+ * @param {string} attrName
3124
+ * @returns {boolean}
3125
+ */
3126
+ hasAnyParentAttr(attrName) {
3127
+ return this._matcher.hasAnyParentAttr(attrName);
3128
+ }
2790
3129
  /**
2791
3130
  * Get current node's sibling position (child index in parent).
2792
3131
  * @returns {number}
@@ -2865,14 +3204,17 @@ var Matcher = class {
2865
3204
  this.siblingStacks = [];
2866
3205
  this._pathStringCache = null;
2867
3206
  this._view = new MatcherView(this);
3207
+ this._keptAttrs = [];
2868
3208
  }
2869
3209
  /**
2870
3210
  * Push a new tag onto the path.
2871
3211
  * @param {string} tagName
2872
3212
  * @param {Object|null} [attrValues=null]
2873
3213
  * @param {string|null} [namespace=null]
3214
+ * @param {Object|null} [options=null]
3215
+ * @param {string[]} [options.keep] - Names of attributes (from attrValues)
2874
3216
  */
2875
- push(tagName, attrValues = null, namespace = null) {
3217
+ push(tagName, attrValues = null, namespace = null, options = null) {
2876
3218
  this._pathStringCache = null;
2877
3219
  if (this.path.length > 0) {
2878
3220
  this.path[this.path.length - 1].values = void 0;
@@ -2901,6 +3243,16 @@ var Matcher = class {
2901
3243
  node.values = attrValues;
2902
3244
  }
2903
3245
  this.path.push(node);
3246
+ const depth = this.path.length;
3247
+ const keep = options !== null ? options.keep : null;
3248
+ if (keep !== null && keep !== void 0 && keep.length > 0 && attrValues) {
3249
+ for (let i = 0; i < keep.length; i++) {
3250
+ const name = keep[i];
3251
+ if (attrValues[name] !== void 0) {
3252
+ this._keptAttrs.push({ depth, name, value: attrValues[name] });
3253
+ }
3254
+ }
3255
+ }
2904
3256
  }
2905
3257
  /**
2906
3258
  * Pop the last tag from the path.
@@ -2913,6 +3265,10 @@ var Matcher = class {
2913
3265
  if (this.siblingStacks.length > this.path.length + 1) {
2914
3266
  this.siblingStacks.length = this.path.length + 1;
2915
3267
  }
3268
+ const poppedDepth = this.path.length + 1;
3269
+ while (this._keptAttrs.length > 0 && this._keptAttrs[this._keptAttrs.length - 1].depth >= poppedDepth) {
3270
+ this._keptAttrs.pop();
3271
+ }
2916
3272
  return node;
2917
3273
  }
2918
3274
  /**
@@ -2961,6 +3317,36 @@ var Matcher = class {
2961
3317
  const current = this.path[this.path.length - 1];
2962
3318
  return current.values !== void 0 && attrName in current.values;
2963
3319
  }
3320
+ /**
3321
+ * Get the value of a "kept" attribute from the nearest ancestor (or
3322
+ * current node) that declared it via `push(tag, attrs, ns, { keep: [...] })`.
3323
+ * Unlike getAttrValue(), this works regardless of how deep the path has
3324
+ * gone since the attribute was pushed — but only for attribute names that
3325
+ * were explicitly marked with `keep` at push time. Cost is proportional to
3326
+ * the number of currently-kept attributes (typically 0-3), not path depth.
3327
+ * @param {string} attrName
3328
+ * @returns {*} the value, or undefined if no ancestor kept this attribute
3329
+ */
3330
+ getAnyParentAttr(attrName) {
3331
+ const kept = this._keptAttrs;
3332
+ for (let i = kept.length - 1; i >= 0; i--) {
3333
+ if (kept[i].name === attrName) return kept[i].value;
3334
+ }
3335
+ return void 0;
3336
+ }
3337
+ /**
3338
+ * Check whether any ancestor (or the current node) kept the given
3339
+ * attribute via `push(tag, attrs, ns, { keep: [...] })`.
3340
+ * @param {string} attrName
3341
+ * @returns {boolean}
3342
+ */
3343
+ hasAnyParentAttr(attrName) {
3344
+ const kept = this._keptAttrs;
3345
+ for (let i = kept.length - 1; i >= 0; i--) {
3346
+ if (kept[i].name === attrName) return true;
3347
+ }
3348
+ return false;
3349
+ }
2964
3350
  /**
2965
3351
  * Get current node's sibling position (child index in parent).
2966
3352
  * @returns {number}
@@ -3029,6 +3415,7 @@ var Matcher = class {
3029
3415
  this._pathStringCache = null;
3030
3416
  this.path = [];
3031
3417
  this.siblingStacks = [];
3418
+ this._keptAttrs = [];
3032
3419
  }
3033
3420
  /**
3034
3421
  * Match current path against an Expression.
@@ -3152,7 +3539,8 @@ var Matcher = class {
3152
3539
  snapshot() {
3153
3540
  return {
3154
3541
  path: this.path.map((node) => ({ ...node })),
3155
- siblingStacks: this.siblingStacks.map((map) => new Map(map))
3542
+ siblingStacks: this.siblingStacks.map((map) => new Map(map)),
3543
+ keptAttrs: this._keptAttrs.map((entry) => ({ ...entry }))
3156
3544
  };
3157
3545
  }
3158
3546
  /**
@@ -3163,6 +3551,7 @@ var Matcher = class {
3163
3551
  this._pathStringCache = null;
3164
3552
  this.path = snapshot.path.map((node) => ({ ...node }));
3165
3553
  this.siblingStacks = snapshot.siblingStacks.map((map) => new Map(map));
3554
+ this._keptAttrs = (snapshot.keptAttrs || []).map((entry) => ({ ...entry }));
3166
3555
  }
3167
3556
  /**
3168
3557
  * Return the read-only {@link MatcherView} for this matcher.
@@ -4751,4 +5140,4 @@ var AwsQueryProtocol = class extends RpcProtocol {
4751
5140
  export {
4752
5141
  AwsQueryProtocol
4753
5142
  };
4754
- //# sourceMappingURL=chunk-OZ32AVV5.js.map
5143
+ //# sourceMappingURL=chunk-CRYMBICT.js.map