forgeframe 0.0.2 → 0.0.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.
@@ -38,7 +38,7 @@ const p = {
38
38
  REQUEST: "request",
39
39
  /** Response to a previous request */
40
40
  RESPONSE: "response"
41
- }, h = {
41
+ }, u = {
42
42
  /** Host initialization complete */
43
43
  INIT: "forgeframe_init",
44
44
  /** Props update from consumer to host */
@@ -63,7 +63,13 @@ const p = {
63
63
  CONSUMER_EXPORT: "forgeframe_consumer_export",
64
64
  /** Get sibling components request */
65
65
  GET_SIBLINGS: "forgeframe_get_siblings"
66
- }, N = "__forgeframe__", ye = "0.0.1";
66
+ }, F = "__forgeframe__", ye = (() => {
67
+ if ("0.0.3".trim().length === 0)
68
+ throw new Error(
69
+ "ForgeFrame VERSION injection is missing. Configure __FORGEFRAME_VERSION__ in build/test tooling."
70
+ );
71
+ return "0.0.3";
72
+ })();
67
73
  class we {
68
74
  /**
69
75
  * Internal storage for event listeners mapped by event name.
@@ -215,14 +221,14 @@ class we {
215
221
  return this.listeners.get(e)?.size ?? 0;
216
222
  }
217
223
  }
218
- function Ne() {
224
+ function Fe() {
219
225
  const s = Date.now().toString(36), e = Math.random().toString(36).slice(2, 11);
220
226
  return `${s}_${e}`;
221
227
  }
222
228
  function z() {
223
229
  return Math.random().toString(36).slice(2, 11);
224
230
  }
225
- class Fe {
231
+ class Ne {
226
232
  /**
227
233
  * Array of registered cleanup tasks awaiting execution.
228
234
  * @internal
@@ -346,7 +352,7 @@ function _e() {
346
352
  s = n, e = i;
347
353
  }), resolve: s, reject: e };
348
354
  }
349
- function $e(s, e, t = "Operation timed out") {
355
+ function ke(s, e, t = "Operation timed out") {
350
356
  return new Promise((n, i) => {
351
357
  const r = setTimeout(() => {
352
358
  i(new Error(`${t} (${e}ms)`));
@@ -362,7 +368,7 @@ const j = "forgeframe:";
362
368
  function M(s) {
363
369
  return j + JSON.stringify(s);
364
370
  }
365
- function ke(s) {
371
+ function $e(s) {
366
372
  if (typeof s != "string" || !s.startsWith(j)) return null;
367
373
  try {
368
374
  const e = s.slice(j.length), t = JSON.parse(e);
@@ -482,8 +488,8 @@ class Ee {
482
488
  });
483
489
  try {
484
490
  e.postMessage(M(a), t);
485
- } catch (u) {
486
- throw this.pending.delete(o), clearTimeout(l), u;
491
+ } catch (h) {
492
+ throw this.pending.delete(o), clearTimeout(l), h;
487
493
  }
488
494
  return c.promise;
489
495
  }
@@ -526,7 +532,7 @@ class Ee {
526
532
  this.listener = (e) => {
527
533
  if (e.source === this.win || !this.isOriginTrusted(e.origin))
528
534
  return;
529
- const t = ke(e.data);
535
+ const t = $e(e.data);
530
536
  t && this.handleMessage(t, e.source, e.origin);
531
537
  }, this.win.addEventListener("message", this.listener);
532
538
  }
@@ -649,7 +655,7 @@ class J {
649
655
  const a = this.remoteFunctions.keys().next().value;
650
656
  a && this.remoteFunctions.delete(a);
651
657
  }
652
- const o = async (...a) => this.messenger.send(t, n, h.CALL, {
658
+ const o = async (...a) => this.messenger.send(t, n, u.CALL, {
653
659
  id: e.__id__,
654
660
  args: a
655
661
  });
@@ -673,7 +679,7 @@ class J {
673
679
  */
674
680
  setupCallHandler() {
675
681
  this.messenger.on(
676
- h.CALL,
682
+ u.CALL,
677
683
  async ({ id: e, args: t }) => {
678
684
  const n = this.localFunctions.get(e);
679
685
  if (!n)
@@ -775,14 +781,14 @@ function B(s, e, t = /* @__PURE__ */ new WeakSet()) {
775
781
  }
776
782
  return s;
777
783
  }
778
- function q(s, e, t, n, i = /* @__PURE__ */ new WeakSet()) {
784
+ function V(s, e, t, n, i = /* @__PURE__ */ new WeakSet()) {
779
785
  if (J.isFunctionRef(s))
780
786
  return e.deserialize(s, t, n);
781
787
  if (Array.isArray(s)) {
782
788
  if (i.has(s))
783
789
  throw new Error("Circular reference detected in serialized props");
784
790
  return i.add(s), s.map(
785
- (r) => q(r, e, t, n, i)
791
+ (r) => V(r, e, t, n, i)
786
792
  );
787
793
  }
788
794
  if (typeof s == "object" && s !== null) {
@@ -791,12 +797,12 @@ function q(s, e, t, n, i = /* @__PURE__ */ new WeakSet()) {
791
797
  i.add(s);
792
798
  const r = {};
793
799
  for (const [o, a] of Object.entries(s))
794
- r[o] = q(a, e, t, n, i);
800
+ r[o] = V(a, e, t, n, i);
795
801
  return r;
796
802
  }
797
803
  return s;
798
804
  }
799
- function V(s = window) {
805
+ function q(s = window) {
800
806
  try {
801
807
  return s.location.origin;
802
808
  } catch {
@@ -850,20 +856,20 @@ function Me(s = window) {
850
856
  return !1;
851
857
  }
852
858
  }
853
- const he = 32 * 1024;
859
+ const ue = 32 * 1024;
854
860
  function We(s) {
855
861
  const e = ze(s);
856
- return `${N}${e}`;
862
+ return `${F}${e}`;
857
863
  }
858
864
  function Oe(s) {
859
- if (!s || !s.startsWith(N))
865
+ if (!s || !s.startsWith(F))
860
866
  return null;
861
- const e = s.slice(N.length);
867
+ const e = s.slice(F.length);
862
868
  return je(e);
863
869
  }
864
870
  function X(s = window) {
865
871
  try {
866
- return s.name.startsWith(N);
872
+ return s.name.startsWith(F);
867
873
  } catch {
868
874
  return !1;
869
875
  }
@@ -874,9 +880,9 @@ function W(s, e = window) {
874
880
  function ze(s) {
875
881
  try {
876
882
  const e = JSON.stringify(s), t = btoa(encodeURIComponent(e)), n = new Blob([t]).size;
877
- if (n > he)
883
+ if (n > ue)
878
884
  throw new Error(
879
- `Payload size (${Math.round(n / 1024)}KB) exceeds maximum allowed size (${he / 1024}KB). Consider reducing the amount of data passed via props.`
885
+ `Payload size (${Math.round(n / 1024)}KB) exceeds maximum allowed size (${ue / 1024}KB). Consider reducing the amount of data passed via props.`
880
886
  );
881
887
  return t;
882
888
  } catch (e) {
@@ -903,11 +909,11 @@ function Be(s) {
903
909
  children: s.children
904
910
  };
905
911
  }
906
- function qe(s = window) {
912
+ function Ve(s = window) {
907
913
  return Oe(s.name);
908
914
  }
909
- const ue = 100, E = /* @__PURE__ */ new Map();
910
- function Ve() {
915
+ const he = 100, E = /* @__PURE__ */ new Map();
916
+ function qe() {
911
917
  const s = [];
912
918
  for (const [e, t] of E.entries())
913
919
  Pe(t) && s.push(e);
@@ -915,7 +921,7 @@ function Ve() {
915
921
  E.delete(e);
916
922
  }
917
923
  function Je(s, e) {
918
- if (E.size >= ue && Ve(), E.size >= ue) {
924
+ if (E.size >= he && qe(), E.size >= he) {
919
925
  const t = E.keys().next().value;
920
926
  t && E.delete(t);
921
927
  }
@@ -1152,7 +1158,7 @@ class K extends y {
1152
1158
  return e._minLength = 1, e;
1153
1159
  }
1154
1160
  }
1155
- class Y extends y {
1161
+ class G extends y {
1156
1162
  /** @internal */
1157
1163
  _min;
1158
1164
  /** @internal */
@@ -1167,7 +1173,7 @@ class Y extends y {
1167
1173
  }
1168
1174
  /** @internal */
1169
1175
  _clone() {
1170
- const e = new Y();
1176
+ const e = new G();
1171
1177
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e._min = this._min, e._max = this._max, e._int = this._int, e;
1172
1178
  }
1173
1179
  /**
@@ -1247,7 +1253,7 @@ class Y extends y {
1247
1253
  return e._max = -Number.MIN_VALUE, e;
1248
1254
  }
1249
1255
  }
1250
- class Z extends y {
1256
+ class Y extends y {
1251
1257
  /** @internal */
1252
1258
  _validate(e) {
1253
1259
  return typeof e != "boolean" ? {
@@ -1256,11 +1262,11 @@ class Z extends y {
1256
1262
  }
1257
1263
  /** @internal */
1258
1264
  _clone() {
1259
- const e = new Z();
1265
+ const e = new Y();
1260
1266
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
1261
1267
  }
1262
1268
  }
1263
- class G extends y {
1269
+ class Z extends y {
1264
1270
  /** @internal */
1265
1271
  _validate(e) {
1266
1272
  return typeof e != "function" ? {
@@ -1269,11 +1275,11 @@ class G extends y {
1269
1275
  }
1270
1276
  /** @internal */
1271
1277
  _clone() {
1272
- const e = new G();
1278
+ const e = new Z();
1273
1279
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e;
1274
1280
  }
1275
1281
  }
1276
- class F extends y {
1282
+ class N extends y {
1277
1283
  /** @internal */
1278
1284
  _itemSchema;
1279
1285
  /** @internal */
@@ -1321,7 +1327,7 @@ class F extends y {
1321
1327
  }
1322
1328
  /** @internal */
1323
1329
  _clone() {
1324
- const e = new F();
1330
+ const e = new N();
1325
1331
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e._itemSchema = this._itemSchema, e._minLength = this._minLength, e._maxLength = this._maxLength, e;
1326
1332
  }
1327
1333
  /**
@@ -1337,7 +1343,7 @@ class F extends y {
1337
1343
  * ```
1338
1344
  */
1339
1345
  of(e) {
1340
- const t = new F();
1346
+ const t = new N();
1341
1347
  return t._optional = this._optional, t._nullable = this._nullable, t._itemSchema = e, t._minLength = this._minLength, t._maxLength = this._maxLength, t;
1342
1348
  }
1343
1349
  /**
@@ -1380,7 +1386,7 @@ class F extends y {
1380
1386
  return this.min(1);
1381
1387
  }
1382
1388
  }
1383
- class $ extends y {
1389
+ class k extends y {
1384
1390
  /** @internal */
1385
1391
  _shape;
1386
1392
  /** @internal */
@@ -1429,7 +1435,7 @@ class $ extends y {
1429
1435
  }
1430
1436
  /** @internal */
1431
1437
  _clone() {
1432
- const e = new $();
1438
+ const e = new k();
1433
1439
  return e._optional = this._optional, e._nullable = this._nullable, e._default = this._default, e._shape = this._shape, e._strict = this._strict, e;
1434
1440
  }
1435
1441
  /**
@@ -1447,7 +1453,7 @@ class $ extends y {
1447
1453
  * ```
1448
1454
  */
1449
1455
  shape(e) {
1450
- const t = new $();
1456
+ const t = new k();
1451
1457
  return t._optional = this._optional, t._nullable = this._nullable, t._shape = e, t._strict = this._strict, t;
1452
1458
  }
1453
1459
  /**
@@ -1542,7 +1548,7 @@ const d = {
1542
1548
  * prop.number().positive()
1543
1549
  * ```
1544
1550
  */
1545
- number: () => new Y(),
1551
+ number: () => new G(),
1546
1552
  /**
1547
1553
  * Creates a boolean schema.
1548
1554
  *
@@ -1552,7 +1558,7 @@ const d = {
1552
1558
  * prop.boolean().default(false)
1553
1559
  * ```
1554
1560
  */
1555
- boolean: () => new Z(),
1561
+ boolean: () => new Y(),
1556
1562
  /**
1557
1563
  * Creates a function schema.
1558
1564
  *
@@ -1565,7 +1571,7 @@ const d = {
1565
1571
  * prop.function<(data: { id: string }) => Promise<void>>()
1566
1572
  * ```
1567
1573
  */
1568
- function: () => new G(),
1574
+ function: () => new Z(),
1569
1575
  /**
1570
1576
  * Creates an array schema.
1571
1577
  *
@@ -1578,7 +1584,7 @@ const d = {
1578
1584
  * prop.array().of(prop.number()).min(1).max(10)
1579
1585
  * ```
1580
1586
  */
1581
- array: () => new F(),
1587
+ array: () => new N(),
1582
1588
  /**
1583
1589
  * Creates an object schema.
1584
1590
  *
@@ -1594,7 +1600,7 @@ const d = {
1594
1600
  * prop.object().shape({ key: prop.string() }).strict()
1595
1601
  * ```
1596
1602
  */
1597
- object: () => new $(),
1603
+ object: () => new k(),
1598
1604
  /**
1599
1605
  * Creates a literal schema for exact value matching.
1600
1606
  *
@@ -1632,7 +1638,7 @@ const d = {
1632
1638
  * ```
1633
1639
  */
1634
1640
  any: () => new te()
1635
- }, R = {
1641
+ }, P = {
1636
1642
  uid: {
1637
1643
  schema: d.string().optional(),
1638
1644
  sendToHost: !0
@@ -1700,7 +1706,7 @@ const d = {
1700
1706
  }
1701
1707
  };
1702
1708
  function b(s) {
1703
- return typeof s == "object" && s !== null && "~standard" in s && typeof s["~standard"] == "object" && s["~standard"] !== null && s["~standard"].version === 1 && typeof s["~standard"].validate == "function";
1709
+ return typeof s == "object" && s !== null && "~standard" in s && typeof s["~standard"] == "object" && s["~standard"] !== null && s["~standard"].version === 1 && typeof s["~standard"].vendor == "string" && typeof s["~standard"].validate == "function";
1704
1710
  }
1705
1711
  function Ke(s, e, t) {
1706
1712
  const n = s["~standard"].validate(e);
@@ -1709,45 +1715,53 @@ function Ke(s, e, t) {
1709
1715
  `Prop "${t}" uses an async schema. ForgeFrame only supports synchronous schema validation. Please use a synchronous schema or remove async operations (like database lookups) from your schema definition.`
1710
1716
  );
1711
1717
  if (n.issues) {
1712
- const i = n.issues.map((r) => `${Ye(r.path, t)}: ${r.message}`);
1718
+ const i = n.issues.map((r) => `${Ge(r.path, t)}: ${r.message}`);
1713
1719
  throw new Error(`Validation failed: ${i.join("; ")}`);
1714
1720
  }
1715
1721
  return n.value;
1716
1722
  }
1717
- function Ye(s, e) {
1723
+ function Ge(s, e) {
1718
1724
  if (!s || s.length === 0)
1719
1725
  return e;
1720
- const t = s.map((n) => typeof n == "object" && n !== null && "key" in n ? String(n.key) : String(n));
1726
+ const t = s.map((n) => {
1727
+ if (typeof n == "object" && n !== null) {
1728
+ if ("key" in n && n.key !== void 0)
1729
+ return String(n.key);
1730
+ if ("index" in n && typeof n.index == "number")
1731
+ return String(n.index);
1732
+ }
1733
+ return String(n);
1734
+ });
1721
1735
  return `${e}.${t.join(".")}`;
1722
1736
  }
1723
1737
  function de(s, e, t) {
1724
1738
  const n = {
1725
- ...R,
1739
+ ...P,
1726
1740
  ...e
1727
1741
  }, i = {};
1728
1742
  for (const [r, o] of Object.entries(n)) {
1729
1743
  const c = b(o) ? { schema: o } : o;
1730
1744
  let l;
1731
- const u = c.alias, w = r in s, _ = u && u in s;
1745
+ const h = c.alias, w = r in s, _ = h && h in s;
1732
1746
  if (w)
1733
1747
  l = s[r];
1734
1748
  else if (_)
1735
- l = s[u];
1749
+ l = s[h];
1736
1750
  else if (c.value)
1737
1751
  l = c.value(t);
1738
1752
  else if (c.default !== void 0)
1739
1753
  l = typeof c.default == "function" ? c.default(t) : c.default;
1740
1754
  else if (c.schema && b(c.schema)) {
1741
- const P = c.schema["~standard"].validate(void 0);
1742
- !(P instanceof Promise) && !P.issues && (l = P.value);
1755
+ const O = c.schema["~standard"].validate(void 0);
1756
+ !(O instanceof Promise) && !O.issues && (l = O.value);
1743
1757
  }
1744
1758
  l !== void 0 && c.decorate && (l = c.decorate({ value: l, props: i })), i[r] = l;
1745
1759
  }
1746
1760
  return i;
1747
1761
  }
1748
- function Ze(s, e) {
1762
+ function Ye(s, e) {
1749
1763
  const t = {
1750
- ...R,
1764
+ ...P,
1751
1765
  ...e
1752
1766
  };
1753
1767
  for (const [n, i] of Object.entries(t)) {
@@ -1764,32 +1778,46 @@ function Ze(s, e) {
1764
1778
  }
1765
1779
  function fe(s, e, t, n) {
1766
1780
  const i = {
1767
- ...R,
1781
+ ...P,
1768
1782
  ...e
1769
1783
  }, r = {};
1770
1784
  for (const [o, a] of Object.entries(i)) {
1771
- const l = b(a) ? { schema: a } : a, u = s[o];
1785
+ const l = b(a) ? { schema: a } : a, h = s[o];
1772
1786
  if (l.sendToHost === !1 || l.sameDomain && !n) continue;
1773
1787
  if (l.trustedDomains) {
1774
1788
  const _ = l.trustedDomains;
1775
1789
  if (!L(_, t)) continue;
1776
1790
  }
1777
- let w = u;
1778
- l.hostDecorate && u !== void 0 && (w = l.hostDecorate({ value: u, props: s })), r[o] = w;
1791
+ let w = h;
1792
+ l.hostDecorate && h !== void 0 && (w = l.hostDecorate({ value: h, props: s })), r[o] = w;
1779
1793
  }
1780
1794
  return r;
1781
1795
  }
1782
- function Ge(s, e) {
1796
+ function Ze(s, e) {
1783
1797
  const t = new URLSearchParams(), n = {
1784
- ...R,
1798
+ ...P,
1785
1799
  ...e
1786
1800
  };
1787
1801
  for (const [i, r] of Object.entries(n)) {
1788
1802
  const a = b(r) ? { schema: r } : r, c = s[i];
1789
1803
  if (c === void 0 || typeof c == "function" || !a.queryParam) continue;
1790
1804
  const l = typeof a.queryParam == "string" ? a.queryParam : i;
1791
- let u;
1792
- typeof a.queryParam == "function" ? u = a.queryParam({ value: c }) : typeof c == "object" ? u = JSON.stringify(c) : u = String(c), t.set(l, u);
1805
+ let h;
1806
+ typeof a.queryParam == "function" ? h = a.queryParam({ value: c }) : typeof c == "object" ? h = JSON.stringify(c) : h = String(c), t.set(l, h);
1807
+ }
1808
+ return t;
1809
+ }
1810
+ function Qe(s, e) {
1811
+ const t = new URLSearchParams(), n = {
1812
+ ...P,
1813
+ ...e
1814
+ };
1815
+ for (const [i, r] of Object.entries(n)) {
1816
+ const a = b(r) ? { schema: r } : r, c = s[i];
1817
+ if (c === void 0 || typeof c == "function" || !a.bodyParam) continue;
1818
+ const l = typeof a.bodyParam == "string" ? a.bodyParam : i;
1819
+ let h;
1820
+ typeof a.bodyParam == "function" ? h = a.bodyParam({ value: c }) : typeof c == "object" ? h = JSON.stringify(c) : h = String(c), t.set(l, h);
1793
1821
  }
1794
1822
  return t;
1795
1823
  }
@@ -1806,7 +1834,7 @@ function Re(s, e = "") {
1806
1834
  }
1807
1835
  return t.filter(Boolean).join("&");
1808
1836
  }
1809
- function Qe(s) {
1837
+ function et(s) {
1810
1838
  const e = {};
1811
1839
  if (!s) return e;
1812
1840
  const t = s.split("&");
@@ -1822,29 +1850,29 @@ function Qe(s) {
1822
1850
  const a = i.split(".");
1823
1851
  let c = e;
1824
1852
  for (let l = 0; l < a.length - 1; l++) {
1825
- const u = a[l];
1826
- (!(u in c) || typeof c[u] != "object") && (c[u] = {}), c = c[u];
1853
+ const h = a[l];
1854
+ (!(h in c) || typeof c[h] != "object") && (c[h] = {}), c = c[h];
1827
1855
  }
1828
1856
  c[a[a.length - 1]] = o;
1829
1857
  }
1830
1858
  return e;
1831
1859
  }
1832
- function et(s) {
1860
+ function tt(s) {
1833
1861
  return typeof s == "object" && s !== null && s.__type__ === "dotify" && typeof s.__value__ == "string";
1834
1862
  }
1835
1863
  function pe(s, e, t) {
1836
1864
  const n = {
1837
- ...R,
1865
+ ...P,
1838
1866
  ...e
1839
1867
  }, i = {};
1840
1868
  for (const [r, o] of Object.entries(s)) {
1841
1869
  if (o === void 0) continue;
1842
1870
  const a = n[r];
1843
- i[r] = tt(o, a, t);
1871
+ i[r] = st(o, a, t);
1844
1872
  }
1845
1873
  return i;
1846
1874
  }
1847
- function tt(s, e, t) {
1875
+ function st(s, e, t) {
1848
1876
  if (typeof s == "function")
1849
1877
  return t.serialize(s);
1850
1878
  const n = e?.serialization ?? I.JSON;
@@ -1862,14 +1890,14 @@ function tt(s, e, t) {
1862
1890
  }
1863
1891
  function me(s, e, t, n, i, r) {
1864
1892
  const o = {
1865
- ...R,
1893
+ ...P,
1866
1894
  ...e
1867
1895
  }, a = {};
1868
1896
  for (const [c, l] of Object.entries(s)) {
1869
- const u = o[c];
1870
- a[c] = st(
1897
+ const h = o[c];
1898
+ a[c] = nt(
1871
1899
  l,
1872
- u,
1900
+ h,
1873
1901
  t,
1874
1902
  n,
1875
1903
  i,
@@ -1878,65 +1906,65 @@ function me(s, e, t, n, i, r) {
1878
1906
  }
1879
1907
  return a;
1880
1908
  }
1881
- function st(s, e, t, n, i, r) {
1882
- if (nt(s))
1909
+ function nt(s, e, t, n, i, r) {
1910
+ if (it(s))
1883
1911
  try {
1884
1912
  const o = decodeURIComponent(atob(s.__value__));
1885
1913
  return JSON.parse(o);
1886
1914
  } catch {
1887
1915
  return s;
1888
1916
  }
1889
- if (et(s))
1917
+ if (tt(s))
1890
1918
  try {
1891
- return Qe(s.__value__);
1919
+ return et(s.__value__);
1892
1920
  } catch {
1893
1921
  return s;
1894
1922
  }
1895
- return q(s, n, i, r);
1923
+ return V(s, n, i, r);
1896
1924
  }
1897
- function nt(s) {
1925
+ function it(s) {
1898
1926
  return typeof s == "object" && s !== null && s.__type__ === "base64" && typeof s.__value__ == "string";
1899
1927
  }
1900
- function O(s, e = "100%") {
1928
+ function R(s, e = "100%") {
1901
1929
  return s === void 0 ? e : typeof s == "number" ? `${s}px` : s;
1902
1930
  }
1903
- function k(s, e) {
1931
+ function $(s, e) {
1904
1932
  if (s === void 0) return e;
1905
1933
  if (typeof s == "number") return s;
1906
1934
  const t = parseInt(s, 10);
1907
1935
  return isNaN(t) ? e : t;
1908
1936
  }
1909
- function it(s) {
1937
+ function rt(s) {
1910
1938
  try {
1911
1939
  s.src = "about:blank", s.parentNode?.removeChild(s);
1912
1940
  } catch {
1913
1941
  }
1914
1942
  }
1915
- function rt(s, e) {
1916
- ct(s, e);
1943
+ function ot(s, e) {
1944
+ lt(s, e);
1917
1945
  }
1918
- function ot(s) {
1946
+ function at(s) {
1919
1947
  s.style.display = "", s.style.visibility = "visible";
1920
1948
  }
1921
1949
  function ge(s) {
1922
1950
  s.style.display = "none", s.style.visibility = "hidden";
1923
1951
  }
1924
- function at(s) {
1952
+ function ct(s) {
1925
1953
  try {
1926
1954
  s.focus(), s.contentWindow?.focus();
1927
1955
  } catch {
1928
1956
  }
1929
1957
  }
1930
- function ct(s, e) {
1931
- e.width !== void 0 && (s.style.width = O(e.width)), e.height !== void 0 && (s.style.height = O(e.height));
1958
+ function lt(s, e) {
1959
+ e.width !== void 0 && (s.style.width = R(e.width)), e.height !== void 0 && (s.style.height = R(e.height));
1932
1960
  }
1933
- class xe extends Error {
1961
+ class ve extends Error {
1934
1962
  constructor(e = "Popup blocked by browser") {
1935
1963
  super(e), this.name = "PopupOpenError";
1936
1964
  }
1937
1965
  }
1938
- function lt(s) {
1939
- const { url: e, name: t, dimensions: n } = s, i = k(n.width, 500), r = k(n.height, 500), o = Math.floor(window.screenX + (window.outerWidth - i) / 2), a = Math.floor(window.screenY + (window.outerHeight - r) / 2), c = [
1966
+ function ut(s) {
1967
+ const { url: e, name: t, dimensions: n } = s, i = $(n.width, 500), r = $(n.height, 500), o = Math.floor(window.screenX + (window.outerWidth - i) / 2), a = Math.floor(window.screenY + (window.outerHeight - r) / 2), c = [
1940
1968
  `width=${i}`,
1941
1969
  `height=${r}`,
1942
1970
  `left=${o}`,
@@ -1949,8 +1977,8 @@ function lt(s) {
1949
1977
  "resizable=yes",
1950
1978
  "scrollbars=yes"
1951
1979
  ].join(","), l = window.open(e, t, c);
1952
- if (!l || dt(l))
1953
- throw new xe();
1980
+ if (!l || ft(l))
1981
+ throw new ve();
1954
1982
  return l;
1955
1983
  }
1956
1984
  function ht(s) {
@@ -1959,13 +1987,13 @@ function ht(s) {
1959
1987
  } catch {
1960
1988
  }
1961
1989
  }
1962
- function ut(s) {
1990
+ function dt(s) {
1963
1991
  try {
1964
1992
  s.closed || s.focus();
1965
1993
  } catch {
1966
1994
  }
1967
1995
  }
1968
- function dt(s) {
1996
+ function ft(s) {
1969
1997
  if (!s) return !0;
1970
1998
  try {
1971
1999
  return !!(s.closed || s.innerHeight === 0 || s.innerWidth === 0);
@@ -1973,7 +2001,7 @@ function dt(s) {
1973
2001
  return !0;
1974
2002
  }
1975
2003
  }
1976
- function ft(s, e, t = {}) {
2004
+ function pt(s, e, t = {}) {
1977
2005
  const {
1978
2006
  initialInterval: n = 100,
1979
2007
  // Start fast to catch quick closes
@@ -1989,7 +2017,7 @@ function ft(s, e, t = {}) {
1989
2017
  } catch (w) {
1990
2018
  console.error("Error in popup close callback:", w);
1991
2019
  }
1992
- }, u = () => {
2020
+ }, h = () => {
1993
2021
  if (!c) {
1994
2022
  try {
1995
2023
  if (s.closed) {
@@ -2000,16 +2028,16 @@ function ft(s, e, t = {}) {
2000
2028
  l();
2001
2029
  return;
2002
2030
  }
2003
- o = Math.min(o * r, i), a = setTimeout(u, o);
2031
+ o = Math.min(o * r, i), a = setTimeout(h, o);
2004
2032
  }
2005
2033
  };
2006
- return a = setTimeout(u, o), () => {
2034
+ return a = setTimeout(h, o), () => {
2007
2035
  c = !0, clearTimeout(a);
2008
2036
  };
2009
2037
  }
2010
- function pt(s, e) {
2038
+ function mt(s, e) {
2011
2039
  try {
2012
- const t = k(e.width, s.outerWidth), n = k(
2040
+ const t = $(e.width, s.outerWidth), n = $(
2013
2041
  e.height,
2014
2042
  s.outerHeight
2015
2043
  );
@@ -2017,24 +2045,24 @@ function pt(s, e) {
2017
2045
  } catch {
2018
2046
  }
2019
2047
  }
2020
- function mt(s) {
2048
+ function gt(s) {
2021
2049
  const { doc: e, dimensions: t, uid: n, tag: i } = s, r = e.createElement("div");
2022
2050
  return r.id = `forgeframe-container-${n}`, r.setAttribute("data-forgeframe-tag", i), Object.assign(r.style, {
2023
2051
  display: "inline-block",
2024
2052
  position: "relative",
2025
- width: O(t.width),
2026
- height: O(t.height),
2053
+ width: R(t.width),
2054
+ height: R(t.height),
2027
2055
  overflow: "hidden"
2028
2056
  }), r;
2029
2057
  }
2030
- function gt(s) {
2058
+ function yt(s) {
2031
2059
  const { doc: e, dimensions: t, cspNonce: n } = s, i = e.createElement("div");
2032
2060
  Object.assign(i.style, {
2033
2061
  display: "flex",
2034
2062
  alignItems: "center",
2035
2063
  justifyContent: "center",
2036
- width: O(t.width),
2037
- height: O(t.height),
2064
+ width: R(t.width),
2065
+ height: R(t.height),
2038
2066
  backgroundColor: "#f5f5f5",
2039
2067
  position: "absolute",
2040
2068
  top: "0",
@@ -2057,18 +2085,18 @@ function gt(s) {
2057
2085
  }
2058
2086
  `, i.appendChild(o), i.appendChild(r), i;
2059
2087
  }
2060
- function yt(s, e = 200) {
2088
+ function wt(s, e = 200) {
2061
2089
  return new Promise((t) => {
2062
2090
  s.style.opacity = "0", s.style.transition = `opacity ${e}ms ease-in`, s.offsetHeight, s.style.opacity = "1", setTimeout(t, e);
2063
2091
  });
2064
2092
  }
2065
- function wt(s, e = 200) {
2093
+ function _t(s, e = 200) {
2066
2094
  return new Promise((t) => {
2067
2095
  s.style.transition = `opacity ${e}ms ease-out`, s.style.opacity = "0", setTimeout(t, e);
2068
2096
  });
2069
2097
  }
2070
- async function _t(s, e, t) {
2071
- e && (await wt(e, 150), e.remove()), t.style.display = "", t.style.visibility = "visible", t.style.opacity = "0", await yt(t, 150);
2098
+ async function Et(s, e, t) {
2099
+ e && (await _t(e, 150), e.remove()), t.style.display = "", t.style.visibility = "visible", t.style.opacity = "0", await wt(t, 150);
2072
2100
  }
2073
2101
  class se {
2074
2102
  /** Event emitter for lifecycle events. */
@@ -2125,11 +2153,11 @@ class se {
2125
2153
  * @param props - Initial props to pass to the component
2126
2154
  */
2127
2155
  constructor(e, t = {}) {
2128
- this._uid = Ne(), this.options = this.normalizeOptions(e), this.context = this.options.defaultContext, this.event = new we(), this.cleanup = new Fe();
2156
+ this._uid = Fe(), this.options = this.normalizeOptions(e), this.context = this.options.defaultContext, this.event = new we(), this.cleanup = new Ne();
2129
2157
  const n = this.createPropContext();
2130
2158
  this.props = de(t, this.options.props, n);
2131
2159
  const i = this.buildTrustedDomains();
2132
- this.messenger = new Ee(this.uid, window, V(), i), this.bridge = new J(this.messenger), this.setupMessageHandlers(), this.setupCleanup();
2160
+ this.messenger = new Ee(this.uid, window, q(), i), this.bridge = new J(this.messenger), this.setupMessageHandlers(), this.setupCleanup();
2133
2161
  }
2134
2162
  /**
2135
2163
  * Builds the list of trusted domains for messenger communication.
@@ -2170,7 +2198,7 @@ class se {
2170
2198
  throw new Error("Component has been destroyed");
2171
2199
  if (this.rendered)
2172
2200
  throw new Error("Component has already been rendered");
2173
- this.context = t ?? this.options.defaultContext, this.checkEligibility(), Ze(this.props, this.options.props), this.options.validate?.({ props: this.props }), this.container = this.resolveContainer(e), this.event.emit(f.PRERENDER), this.callPropCallback("onPrerender"), await this.prerender(), this.event.emit(f.PRERENDERED), this.callPropCallback("onPrerendered"), this.event.emit(f.RENDER), this.callPropCallback("onRender"), await this.open(), await this.waitForHost(), this.context === p.IFRAME && this.iframe && this.prerenderElement && (await _t(
2201
+ this.context = t ?? this.options.defaultContext, this.checkEligibility(), Ye(this.props, this.options.props), this.options.validate?.({ props: this.props }), this.container = this.resolveContainer(e), this.event.emit(f.PRERENDER), this.callPropCallback("onPrerender"), await this.prerender(), this.event.emit(f.PRERENDERED), this.callPropCallback("onPrerendered"), this.event.emit(f.RENDER), this.callPropCallback("onRender"), await this.open(), await this.waitForHost(), this.context === p.IFRAME && this.iframe && this.prerenderElement && (await Et(
2174
2202
  this.container,
2175
2203
  this.prerenderElement,
2176
2204
  this.iframe
@@ -2206,7 +2234,7 @@ class se {
2206
2234
  * For iframes, focuses the iframe element. For popups, brings the window to front.
2207
2235
  */
2208
2236
  async focus() {
2209
- this.context === p.IFRAME && this.iframe ? at(this.iframe) : this.context === p.POPUP && this.hostWindow && ut(this.hostWindow), this.event.emit(f.FOCUS), this.callPropCallback("onFocus");
2237
+ this.context === p.IFRAME && this.iframe ? ct(this.iframe) : this.context === p.POPUP && this.hostWindow && dt(this.hostWindow), this.event.emit(f.FOCUS), this.callPropCallback("onFocus");
2210
2238
  }
2211
2239
  /**
2212
2240
  * Resizes the component to the specified dimensions.
@@ -2214,7 +2242,7 @@ class se {
2214
2242
  * @param dimensions - New width and height for the component
2215
2243
  */
2216
2244
  async resize(e) {
2217
- this.context === p.IFRAME && this.iframe ? rt(this.iframe, e) : this.context === p.POPUP && this.hostWindow && pt(this.hostWindow, e), this.event.emit(f.RESIZE, e), this.callPropCallback("onResize", e);
2245
+ this.context === p.IFRAME && this.iframe ? ot(this.iframe, e) : this.context === p.POPUP && this.hostWindow && mt(this.hostWindow, e), this.event.emit(f.RESIZE, e), this.callPropCallback("onResize", e);
2218
2246
  }
2219
2247
  /**
2220
2248
  * Shows the component if hidden.
@@ -2223,7 +2251,7 @@ class se {
2223
2251
  * Only applicable to iframe context.
2224
2252
  */
2225
2253
  async show() {
2226
- this.context === p.IFRAME && this.iframe && ot(this.iframe);
2254
+ this.context === p.IFRAME && this.iframe && at(this.iframe);
2227
2255
  }
2228
2256
  /**
2229
2257
  * Hides the component.
@@ -2268,7 +2296,7 @@ class se {
2268
2296
  await this.messenger.send(
2269
2297
  this.hostWindow,
2270
2298
  o,
2271
- h.PROPS,
2299
+ u.PROPS,
2272
2300
  c
2273
2301
  );
2274
2302
  }
@@ -2394,7 +2422,7 @@ class se {
2394
2422
  */
2395
2423
  async prerender() {
2396
2424
  if (!this.container) return;
2397
- const e = this.options.prerenderTemplate ?? gt, t = this.options.containerTemplate ?? mt, n = this.resolveDimensions(), i = this.props.cspNonce;
2425
+ const e = this.options.prerenderTemplate ?? yt, t = this.options.containerTemplate ?? gt, n = this.resolveDimensions(), i = this.props.cspNonce;
2398
2426
  if (this.context === p.IFRAME) {
2399
2427
  const c = this.buildWindowName();
2400
2428
  this.iframe = this.createIframeElement(c), ge(this.iframe);
@@ -2460,22 +2488,22 @@ class se {
2460
2488
  async open() {
2461
2489
  const e = this.resolveUrl();
2462
2490
  this.syncTrustedDomainForUrl(e), this.openedHostDomain = this.resolveUrlOrigin(e);
2463
- const t = this.buildUrl(e);
2491
+ const t = this.buildUrl(e), n = this.buildBodyParams(), i = n.toString().length > 0;
2464
2492
  if (this.context === p.IFRAME) {
2465
2493
  if (!this.iframe)
2466
2494
  throw new Error("Iframe not created during prerender");
2467
- this.iframe.src = t, this.hostWindow = this.iframe.contentWindow;
2495
+ i ? this.submitBodyForm(this.iframe.name, t, n) : this.iframe.src = t, this.hostWindow = this.iframe.contentWindow;
2468
2496
  } else {
2469
- const n = this.buildWindowName();
2470
- this.hostWindow = lt({
2471
- url: t,
2472
- name: n,
2497
+ const r = this.buildWindowName();
2498
+ this.hostWindow = ut({
2499
+ url: i ? "about:blank" : t,
2500
+ name: r,
2473
2501
  dimensions: this.resolveDimensions()
2474
- });
2475
- const i = ft(this.hostWindow, () => {
2502
+ }), i && this.submitBodyForm(r, t, n);
2503
+ const o = pt(this.hostWindow, () => {
2476
2504
  this.destroy();
2477
2505
  });
2478
- this.cleanup.register(i);
2506
+ this.cleanup.register(o);
2479
2507
  }
2480
2508
  this.hostWindow && Je(this.uid, this.hostWindow);
2481
2509
  }
@@ -2484,11 +2512,39 @@ class se {
2484
2512
  * @internal
2485
2513
  */
2486
2514
  buildUrl(e = this.resolveUrl()) {
2487
- const n = Ge(this.props, this.options.props).toString();
2515
+ const n = Ze(this.props, this.options.props).toString();
2488
2516
  if (!n) return e;
2489
2517
  const i = e.includes("?") ? "&" : "?";
2490
2518
  return `${e}${i}${n}`;
2491
2519
  }
2520
+ /**
2521
+ * Builds POST body parameters from props marked with bodyParam.
2522
+ * @internal
2523
+ */
2524
+ buildBodyParams() {
2525
+ return Qe(this.props, this.options.props);
2526
+ }
2527
+ /**
2528
+ * Submits a hidden form to navigate a target window via POST.
2529
+ * @internal
2530
+ */
2531
+ submitBodyForm(e, t, n) {
2532
+ const i = this.container?.ownerDocument ?? document, r = i.body ?? i.documentElement;
2533
+ if (!r)
2534
+ throw new Error("Document root is unavailable for bodyParam form submission");
2535
+ const o = i.createElement("form");
2536
+ o.method = "POST", o.action = t, o.target = e, o.style.display = "none";
2537
+ for (const [a, c] of n.entries()) {
2538
+ const l = i.createElement("input");
2539
+ l.type = "hidden", l.name = a, l.value = c, o.appendChild(l);
2540
+ }
2541
+ r.appendChild(o);
2542
+ try {
2543
+ o.submit();
2544
+ } finally {
2545
+ o.remove();
2546
+ }
2547
+ }
2492
2548
  /**
2493
2549
  * Builds the window.name payload for the host window.
2494
2550
  * @internal
@@ -2508,7 +2564,7 @@ class se {
2508
2564
  uid: this.uid,
2509
2565
  tag: this.options.tag,
2510
2566
  context: this.context,
2511
- consumerDomain: V(),
2567
+ consumerDomain: q(),
2512
2568
  props: n,
2513
2569
  exports: this.createConsumerExports(),
2514
2570
  children: i
@@ -2523,7 +2579,7 @@ class se {
2523
2579
  if (!this.options.children) return;
2524
2580
  const e = this.options.children({ props: this.props }), t = {};
2525
2581
  for (const [n, i] of Object.entries(e)) {
2526
- const r = St(i);
2582
+ const r = Ct(i);
2527
2583
  if (!r)
2528
2584
  throw new Error(`Nested component "${n}" is missing component metadata`);
2529
2585
  if (typeof r.url != "string")
@@ -2546,14 +2602,14 @@ class se {
2546
2602
  */
2547
2603
  createConsumerExports() {
2548
2604
  return {
2549
- init: h.INIT,
2550
- close: h.CLOSE,
2551
- resize: h.RESIZE,
2552
- show: h.SHOW,
2553
- hide: h.HIDE,
2554
- onError: h.ERROR,
2555
- updateProps: h.PROPS,
2556
- export: h.EXPORT
2605
+ init: u.INIT,
2606
+ close: u.CLOSE,
2607
+ resize: u.RESIZE,
2608
+ show: u.SHOW,
2609
+ hide: u.HIDE,
2610
+ onError: u.ERROR,
2611
+ updateProps: u.PROPS,
2612
+ export: u.EXPORT
2557
2613
  };
2558
2614
  }
2559
2615
  /**
@@ -2570,7 +2626,7 @@ class se {
2570
2626
  async waitForHost() {
2571
2627
  this.initPromise = _e();
2572
2628
  try {
2573
- await $e(
2629
+ await ke(
2574
2630
  this.initPromise.promise,
2575
2631
  this.options.timeout,
2576
2632
  `Host component "${this.options.tag}" (uid: ${this._uid}) did not initialize within ${this.options.timeout}ms. Check that the host page loads correctly and calls the initialization code.`
@@ -2584,16 +2640,16 @@ class se {
2584
2640
  * @internal
2585
2641
  */
2586
2642
  setupMessageHandlers() {
2587
- this.messenger.on(h.INIT, () => (this.initPromise && this.initPromise.resolve(), { success: !0 })), this.messenger.on(h.CLOSE, async () => (await this.close(), { success: !0 })), this.messenger.on(h.RESIZE, async (e) => (await this.resize(e), { success: !0 })), this.messenger.on(h.FOCUS, async () => (await this.focus(), { success: !0 })), this.messenger.on(h.SHOW, async () => (await this.show(), { success: !0 })), this.messenger.on(h.HIDE, async () => (await this.hide(), { success: !0 })), this.messenger.on(
2588
- h.ERROR,
2643
+ this.messenger.on(u.INIT, () => (this.initPromise && this.initPromise.resolve(), { success: !0 })), this.messenger.on(u.CLOSE, async () => (await this.close(), { success: !0 })), this.messenger.on(u.RESIZE, async (e) => (await this.resize(e), { success: !0 })), this.messenger.on(u.FOCUS, async () => (await this.focus(), { success: !0 })), this.messenger.on(u.SHOW, async () => (await this.show(), { success: !0 })), this.messenger.on(u.HIDE, async () => (await this.hide(), { success: !0 })), this.messenger.on(
2644
+ u.ERROR,
2589
2645
  async (e) => {
2590
2646
  const t = new Error(e.message);
2591
2647
  return t.stack = e.stack, this.handleError(t), { success: !0 };
2592
2648
  }
2593
- ), this.messenger.on(h.EXPORT, async (e) => (this.exports = e, { success: !0 })), this.messenger.on(h.CONSUMER_EXPORT, async (e) => (this.consumerExports = e, { success: !0 })), this.messenger.on(
2594
- h.GET_SIBLINGS,
2649
+ ), this.messenger.on(u.EXPORT, async (e) => (this.exports = e, { success: !0 })), this.messenger.on(u.CONSUMER_EXPORT, async (e) => (this.consumerExports = e, { success: !0 })), this.messenger.on(
2650
+ u.GET_SIBLINGS,
2595
2651
  async (e) => {
2596
- const t = [], n = vt(e.tag);
2652
+ const t = [], n = xt(e.tag);
2597
2653
  if (n)
2598
2654
  for (const i of n.instances)
2599
2655
  i.uid !== e.uid && t.push({
@@ -2644,10 +2700,10 @@ class se {
2644
2700
  async destroy() {
2645
2701
  this.destroyed || (this.destroyed = !0, this.initPromise && (this.initPromise.reject(
2646
2702
  new Error(`Component "${this.options.tag}" was destroyed before initialization completed`)
2647
- ), this.initPromise = null), this.iframe && (it(this.iframe), this.iframe = null), this.context === p.POPUP && this.hostWindow && ht(this.hostWindow), this.hostWindow = null, this.openedHostDomain = null, this.dynamicUrlTrustedOrigin = null, this.prerenderElement && (this.prerenderElement.remove(), this.prerenderElement = null), await this.cleanup.cleanup(), this.event.emit(f.DESTROY), this.callPropCallback("onDestroy"), this.event.removeAllListeners());
2703
+ ), this.initPromise = null), this.iframe && (rt(this.iframe), this.iframe = null), this.context === p.POPUP && this.hostWindow && ht(this.hostWindow), this.hostWindow = null, this.openedHostDomain = null, this.dynamicUrlTrustedOrigin = null, this.prerenderElement && (this.prerenderElement.remove(), this.prerenderElement = null), await this.cleanup.cleanup(), this.event.emit(f.DESTROY), this.callPropCallback("onDestroy"), this.event.removeAllListeners());
2648
2704
  }
2649
2705
  }
2650
- class Et {
2706
+ class bt {
2651
2707
  /**
2652
2708
  * Creates a new HostComponent instance.
2653
2709
  *
@@ -2657,7 +2713,7 @@ class Et {
2657
2713
  * @param deferInit - Whether to defer INIT until a later explicit flush
2658
2714
  */
2659
2715
  constructor(e, t = {}, n, i = !1) {
2660
- this.propDefinitions = t, this.allowedConsumerDomains = n, this.deferInit = i, this.uid = e.uid, this.tag = e.tag, this.consumerDomain = e.consumerDomain, this.validateConsumerDomain(), this.event = new we(), this.messenger = new Ee(this.uid, window, V(), this.consumerDomain), this.setupMessageHandlers(), this.consumerWindow = this.resolveConsumerWindow(), this.bridge = new J(this.messenger), this.hostProps = this.buildHostProps(e), this.exposeHostProps(), this.deferInit || this.flushInit();
2716
+ this.propDefinitions = t, this.allowedConsumerDomains = n, this.deferInit = i, this.uid = e.uid, this.tag = e.tag, this.consumerDomain = e.consumerDomain, this.validateConsumerDomain(), this.event = new we(), this.messenger = new Ee(this.uid, window, q(), this.consumerDomain), this.setupMessageHandlers(), this.consumerWindow = this.resolveConsumerWindow(), this.bridge = new J(this.messenger), this.hostProps = this.buildHostProps(e), this.exposeHostProps(), this.deferInit || this.flushInit();
2661
2717
  }
2662
2718
  /** The hostProps object containing props and control methods passed from the consumer. */
2663
2719
  hostProps;
@@ -2801,7 +2857,7 @@ class Et {
2801
2857
  await this.messenger.send(
2802
2858
  this.consumerWindow,
2803
2859
  this.consumerDomain,
2804
- h.INIT,
2860
+ u.INIT,
2805
2861
  { uid: this.uid, tag: this.tag }
2806
2862
  );
2807
2863
  } catch (e) {
@@ -2829,7 +2885,7 @@ class Et {
2829
2885
  await this.messenger.send(
2830
2886
  this.consumerWindow,
2831
2887
  this.consumerDomain,
2832
- h.CLOSE,
2888
+ u.CLOSE,
2833
2889
  {}
2834
2890
  );
2835
2891
  }
@@ -2841,7 +2897,7 @@ class Et {
2841
2897
  window.focus(), await this.messenger.send(
2842
2898
  this.consumerWindow,
2843
2899
  this.consumerDomain,
2844
- h.FOCUS,
2900
+ u.FOCUS,
2845
2901
  {}
2846
2902
  );
2847
2903
  }
@@ -2853,7 +2909,7 @@ class Et {
2853
2909
  await this.messenger.send(
2854
2910
  this.consumerWindow,
2855
2911
  this.consumerDomain,
2856
- h.RESIZE,
2912
+ u.RESIZE,
2857
2913
  e
2858
2914
  );
2859
2915
  }
@@ -2865,7 +2921,7 @@ class Et {
2865
2921
  await this.messenger.send(
2866
2922
  this.consumerWindow,
2867
2923
  this.consumerDomain,
2868
- h.SHOW,
2924
+ u.SHOW,
2869
2925
  {}
2870
2926
  );
2871
2927
  }
@@ -2877,7 +2933,7 @@ class Et {
2877
2933
  await this.messenger.send(
2878
2934
  this.consumerWindow,
2879
2935
  this.consumerDomain,
2880
- h.HIDE,
2936
+ u.HIDE,
2881
2937
  {}
2882
2938
  );
2883
2939
  }
@@ -2898,7 +2954,7 @@ class Et {
2898
2954
  await this.messenger.send(
2899
2955
  this.consumerWindow,
2900
2956
  this.consumerDomain,
2901
- h.ERROR,
2957
+ u.ERROR,
2902
2958
  {
2903
2959
  message: e.message,
2904
2960
  stack: e.stack
@@ -2913,7 +2969,7 @@ class Et {
2913
2969
  await this.messenger.send(
2914
2970
  this.consumerWindow,
2915
2971
  this.consumerDomain,
2916
- h.EXPORT,
2972
+ u.EXPORT,
2917
2973
  e
2918
2974
  );
2919
2975
  }
@@ -2925,7 +2981,7 @@ class Et {
2925
2981
  await this.messenger.send(
2926
2982
  this.consumerWindow,
2927
2983
  this.consumerDomain,
2928
- h.CONSUMER_EXPORT,
2984
+ u.CONSUMER_EXPORT,
2929
2985
  e
2930
2986
  );
2931
2987
  }
@@ -2937,7 +2993,7 @@ class Et {
2937
2993
  return await this.messenger.send(
2938
2994
  this.consumerWindow,
2939
2995
  this.consumerDomain,
2940
- h.GET_SIBLINGS,
2996
+ u.GET_SIBLINGS,
2941
2997
  { uid: this.uid, tag: this.tag, options: e }
2942
2998
  ) ?? [];
2943
2999
  }
@@ -2950,7 +3006,7 @@ class Et {
2950
3006
  const t = {};
2951
3007
  for (const [n, i] of Object.entries(e))
2952
3008
  try {
2953
- t[n] = Se({
3009
+ t[n] = xe({
2954
3010
  tag: i.tag,
2955
3011
  url: i.url,
2956
3012
  props: i.props,
@@ -2967,7 +3023,7 @@ class Et {
2967
3023
  * @internal
2968
3024
  */
2969
3025
  setupMessageHandlers() {
2970
- this.messenger.on(h.PROPS, (e) => {
3026
+ this.messenger.on(u.PROPS, (e) => {
2971
3027
  try {
2972
3028
  const t = me(
2973
3029
  e,
@@ -3004,7 +3060,7 @@ function ne(s, e, t = {}) {
3004
3060
  if (e) {
3005
3061
  const i = g.getProps().getConsumerDomain();
3006
3062
  if (!L(e, i))
3007
- throw Rt(), new Error(
3063
+ throw vt(), new Error(
3008
3064
  `Consumer domain "${i}" is not allowed for this host component`
3009
3065
  );
3010
3066
  }
@@ -3012,28 +3068,28 @@ function ne(s, e, t = {}) {
3012
3068
  }
3013
3069
  if (!X())
3014
3070
  return null;
3015
- const n = qe();
3016
- return n ? (g = new Et(
3071
+ const n = Ve();
3072
+ return n ? (g = new bt(
3017
3073
  n,
3018
3074
  s,
3019
3075
  e,
3020
3076
  t.deferInit ?? !1
3021
3077
  ), g) : (console.error("Failed to parse ForgeFrame payload from window.name"), null);
3022
3078
  }
3023
- function bt() {
3024
- return X();
3025
- }
3026
3079
  function Pt() {
3027
3080
  return X();
3028
3081
  }
3029
3082
  function Ot() {
3030
- return window.hostProps;
3083
+ return X();
3031
3084
  }
3032
3085
  function Rt() {
3086
+ return window.hostProps;
3087
+ }
3088
+ function vt() {
3033
3089
  g && (g.destroy(), g = null), delete window.hostProps;
3034
3090
  }
3035
- const C = /* @__PURE__ */ new Map(), ve = /* @__PURE__ */ Symbol("forgeframe.component.options");
3036
- function xt(s) {
3091
+ const C = /* @__PURE__ */ new Map(), Se = /* @__PURE__ */ Symbol("forgeframe.component.options");
3092
+ function St(s) {
3037
3093
  if (!s.tag)
3038
3094
  throw new Error("Component tag is required");
3039
3095
  if (!/^[a-z][a-z0-9-]*$/.test(s.tag))
@@ -3053,8 +3109,8 @@ function xt(s) {
3053
3109
  if (C.has(s.tag))
3054
3110
  throw new Error(`Component "${s.tag}" is already registered`);
3055
3111
  }
3056
- function Se(s) {
3057
- xt(s);
3112
+ function xe(s) {
3113
+ St(s);
3058
3114
  const e = [];
3059
3115
  let t;
3060
3116
  if (W(s.tag)) {
@@ -3068,7 +3124,7 @@ function Se(s) {
3068
3124
  o !== -1 && e.splice(o, 1);
3069
3125
  }), r;
3070
3126
  };
3071
- return n.instances = e, n.isHost = () => W(s.tag), n.isEmbedded = () => W(s.tag), n.hostProps = t, n[ve] = s, n.canRenderTo = async (i) => {
3127
+ return n.instances = e, n.isHost = () => W(s.tag), n.isEmbedded = () => W(s.tag), n.hostProps = t, n[Se] = s, n.canRenderTo = async (i) => {
3072
3128
  try {
3073
3129
  return !!(be(i) || s.domain);
3074
3130
  } catch {
@@ -3076,13 +3132,13 @@ function Se(s) {
3076
3132
  }
3077
3133
  }, C.set(s.tag, n), n;
3078
3134
  }
3079
- function vt(s) {
3135
+ function xt(s) {
3080
3136
  return C.get(s);
3081
3137
  }
3082
- function St(s) {
3083
- return s[ve];
3138
+ function Ct(s) {
3139
+ return s[Se];
3084
3140
  }
3085
- async function Ct(s) {
3141
+ async function Dt(s) {
3086
3142
  await s.close();
3087
3143
  }
3088
3144
  async function Ce(s) {
@@ -3091,11 +3147,11 @@ async function Ce(s) {
3091
3147
  const t = [...e.instances];
3092
3148
  await Promise.all(t.map((n) => n.close()));
3093
3149
  }
3094
- async function Dt() {
3150
+ async function It() {
3095
3151
  const s = Array.from(C.keys());
3096
3152
  await Promise.all(s.map((e) => Ce(e)));
3097
3153
  }
3098
- function It(s, e) {
3154
+ function Tt(s, e) {
3099
3155
  const t = Object.keys(s), n = Object.keys(e);
3100
3156
  if (t.length !== n.length)
3101
3157
  return !1;
@@ -3104,12 +3160,12 @@ function It(s, e) {
3104
3160
  return !1;
3105
3161
  return !0;
3106
3162
  }
3107
- function Tt(s, e) {
3163
+ function Ft(s, e) {
3108
3164
  const { React: t } = e, { createElement: n, useRef: i, useEffect: r, useState: o, forwardRef: a } = t, c = a(
3109
3165
  function(w, _) {
3110
3166
  const {
3111
- onRendered: P,
3112
- onError: x,
3167
+ onRendered: O,
3168
+ onError: v,
3113
3169
  onClose: ie,
3114
3170
  context: De,
3115
3171
  className: re,
@@ -3117,23 +3173,23 @@ function Tt(s, e) {
3117
3173
  ...H
3118
3174
  } = w, D = i(null), A = i(null), U = i(null), [ae, Ie] = o(null);
3119
3175
  return r(() => {
3120
- const v = D.current;
3121
- if (!v) return;
3176
+ const S = D.current;
3177
+ if (!S) return;
3122
3178
  const m = s(H);
3123
- return A.current = m, P && m.event.once("rendered", P), ie && m.event.once("close", ie), x && m.event.on("error", x), m.render(v, De).catch((S) => {
3124
- Ie(S), x?.(S);
3179
+ return A.current = m, O && m.event.once("rendered", O), ie && m.event.once("close", ie), v && m.event.on("error", v), m.render(S, De).catch((x) => {
3180
+ Ie(x), v?.(x);
3125
3181
  }), () => {
3126
3182
  m.close().catch(() => {
3127
3183
  }), A.current = null, U.current = null;
3128
3184
  };
3129
3185
  }, []), r(() => {
3130
- const v = A.current;
3131
- if (!v) return;
3132
- const m = H, S = U.current;
3133
- S && It(S, m) || (U.current = m, v.updateProps(m).catch((Te) => {
3134
- x?.(Te);
3186
+ const S = A.current;
3187
+ if (!S) return;
3188
+ const m = H, x = U.current;
3189
+ x && Tt(x, m) || (U.current = m, S.updateProps(m).catch((Te) => {
3190
+ v?.(Te);
3135
3191
  }));
3136
- }, [H, x]), r(() => {
3192
+ }, [H, v]), r(() => {
3137
3193
  _ && typeof _ == "object" && D.current && (_.current = D.current);
3138
3194
  }, [_]), ae ? n(
3139
3195
  "div",
@@ -3154,9 +3210,9 @@ function Tt(s, e) {
3154
3210
  ), l = `ForgeFrame(${s.name || "Component"})`;
3155
3211
  return c.displayName = l, c;
3156
3212
  }
3157
- function Ft(s) {
3213
+ function kt(s) {
3158
3214
  return function(t) {
3159
- return Tt(t, { React: s });
3215
+ return Ft(t, { React: s });
3160
3216
  };
3161
3217
  }
3162
3218
  ne(void 0, void 0, { deferInit: !0 });
@@ -3185,13 +3241,13 @@ const $t = {
3185
3241
  * await instance.render('#container');
3186
3242
  * ```
3187
3243
  */
3188
- create: Se,
3244
+ create: xe,
3189
3245
  /**
3190
3246
  * Destroy a single component instance.
3191
3247
  *
3192
3248
  * @param instance - The component instance to destroy
3193
3249
  */
3194
- destroy: Ct,
3250
+ destroy: Dt,
3195
3251
  /**
3196
3252
  * Destroy all instances of a specific component by tag.
3197
3253
  *
@@ -3201,7 +3257,7 @@ const $t = {
3201
3257
  /**
3202
3258
  * Destroy all ForgeFrame component instances.
3203
3259
  */
3204
- destroyAll: Dt,
3260
+ destroyAll: It,
3205
3261
  /**
3206
3262
  * Check if the current window is a host component context.
3207
3263
  *
@@ -3211,7 +3267,7 @@ const $t = {
3211
3267
  *
3212
3268
  * @returns True if running inside a ForgeFrame iframe/popup
3213
3269
  */
3214
- isHost: bt,
3270
+ isHost: Pt,
3215
3271
  /**
3216
3272
  * Check if the current window is embedded by ForgeFrame.
3217
3273
  *
@@ -3220,7 +3276,7 @@ const $t = {
3220
3276
  *
3221
3277
  * @returns True if running inside a ForgeFrame iframe/popup
3222
3278
  */
3223
- isEmbedded: Pt,
3279
+ isEmbedded: Ot,
3224
3280
  /**
3225
3281
  * Get hostProps from the current host window.
3226
3282
  *
@@ -3229,7 +3285,7 @@ const $t = {
3229
3285
  *
3230
3286
  * @returns The hostProps object if in host context, undefined otherwise
3231
3287
  */
3232
- getHostProps: Ot,
3288
+ getHostProps: Rt,
3233
3289
  /**
3234
3290
  * Flush host initialization in embedded contexts.
3235
3291
  *
@@ -3259,7 +3315,7 @@ const $t = {
3259
3315
  /**
3260
3316
  * Error thrown when popup window fails to open.
3261
3317
  */
3262
- PopupOpenError: xe,
3318
+ PopupOpenError: ve,
3263
3319
  /**
3264
3320
  * Current library version.
3265
3321
  */
@@ -3307,32 +3363,32 @@ const $t = {
3307
3363
  };
3308
3364
  export {
3309
3365
  te as AnySchema,
3310
- F as ArraySchema,
3311
- Z as BooleanSchema,
3366
+ N as ArraySchema,
3367
+ Y as BooleanSchema,
3312
3368
  p as CONTEXT,
3313
3369
  f as EVENT,
3314
3370
  ee as EnumSchema,
3315
3371
  $t as ForgeFrame,
3316
- G as FunctionSchema,
3372
+ Z as FunctionSchema,
3317
3373
  Q as LiteralSchema,
3318
- Y as NumberSchema,
3319
- $ as ObjectSchema,
3374
+ G as NumberSchema,
3375
+ k as ObjectSchema,
3320
3376
  I as PROP_SERIALIZATION,
3321
- xe as PopupOpenError,
3377
+ ve as PopupOpenError,
3322
3378
  y as PropSchema,
3323
3379
  K as StringSchema,
3324
3380
  ye as VERSION,
3325
- Se as create,
3326
- Tt as createReactComponent,
3381
+ xe as create,
3382
+ Ft as createReactComponent,
3327
3383
  $t as default,
3328
- Ct as destroy,
3329
- Dt as destroyAll,
3384
+ Dt as destroy,
3385
+ It as destroyAll,
3330
3386
  Ce as destroyByTag,
3331
- Ot as getHostProps,
3387
+ Rt as getHostProps,
3332
3388
  ne as initHost,
3333
- Pt as isEmbedded,
3334
- bt as isHost,
3389
+ Ot as isEmbedded,
3390
+ Pt as isHost,
3335
3391
  b as isStandardSchema,
3336
3392
  d as prop,
3337
- Ft as withReactComponent
3393
+ kt as withReactComponent
3338
3394
  };