useblocks 1.1.56 → 1.1.60

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 (31) hide show
  1. package/iframe/js/amp.BP7EklKo.js +1 -1
  2. package/iframe/js/iframe-eblock.js +1 -1
  3. package/iframe/js/iframe.js +1 -1
  4. package/iframe/js/rules.4N5s3OV-.js +1 -1
  5. package/npm-publish.manifest.json +7 -7
  6. package/package.json +1 -1
  7. package/singlepage_headless_plugin.html +1 -1
  8. package/static/core/{4d493eba.js → 161d1254.js} +268 -257
  9. package/static/core/{4dadf572.js → 40f73dfb.js} +3 -3
  10. package/static/core/{289ba982.js → 43c3f160.js} +3270 -3187
  11. package/static/core/{58c4b8d7.js → 4c39852e.js} +5 -5
  12. package/static/core/{a4c19e27.js → 4e75b331.js} +4 -4
  13. package/static/core/{87969347.js → 53463a60.js} +675 -677
  14. package/static/core/{eb23332a.js → 7a15fa8b.js} +3 -3
  15. package/static/core/{12a9aa4e.js → 8815eb5b.js} +11514 -11159
  16. package/static/core/{4a5f1756.js → ba6c356e.js} +104 -104
  17. package/static/core/{b9bb2c5f.js → c9e59b34.js} +4634 -4271
  18. package/static/core/{fa354fb5.js → d9baa55e.js} +7 -7
  19. package/static/core/{bf446743.js → dbf19c2e.js} +248 -198
  20. package/static/core/{988589a5.js → f953827c.js} +7 -7
  21. package/static/esm/2474de05.js +131 -0
  22. package/static/esm/{3cde7cb6.js → 53b688bd.js} +48 -48
  23. package/two_step_headless_plugin.html +1 -1
  24. package/useblocks-core.f6bb8947.js +673 -0
  25. package/useblocks-esm.js +892 -529
  26. package/useblocks.d.ts +8 -0
  27. package/useblocks.js +698 -330
  28. package/static/esm/550bf3cb.js +0 -127
  29. package/useblocks-core.1279854f.js +0 -643
  30. /package/iframe/{iframe-eblock.1279854f.html → iframe-eblock.f6bb8947.html} +0 -0
  31. /package/iframe/{iframe.1279854f.html → iframe.f6bb8947.html} +0 -0
package/useblocks.js CHANGED
@@ -689,7 +689,7 @@ var __amdEnv = window.__useblocks__ || (window.__useblocks__ = {});
689
689
 
690
690
 
691
691
  // Configure AMD loader
692
- __amdEnv.require.config({ baseUrl: "./", paths: {"core":"useblocks-core.1279854f.js"} });
692
+ __amdEnv.require.config({ baseUrl: "./", paths: {"core":"useblocks-core.f6bb8947.js"} });
693
693
 
694
694
  // PublicPath (script detection: entry script lookup → document.currentScript)
695
695
  if (!__useblocks__.publicPath) {
@@ -1037,7 +1037,7 @@ if (!ns.assetUrl) {
1037
1037
  }
1038
1038
 
1039
1039
  if (!ns.version) {
1040
- ns.version = "1.1.56";
1040
+ ns.version = "1.1.60";
1041
1041
  }
1042
1042
 
1043
1043
  var modules = ns.modules = Object.create(null);
@@ -1523,26 +1523,33 @@ __useblocks__.define("useblocks.js", [
1523
1523
  "require",
1524
1524
  "exports",
1525
1525
  "module"
1526
- ], function(At, E, Tt) {
1526
+ ], function(ln, E, fn) {
1527
1527
  Object.defineProperties(E, {
1528
1528
  __esModule: { value: !0 },
1529
1529
  [Symbol.toStringTag]: { value: "Module" }
1530
1530
  });
1531
- var H = Object.defineProperty, F = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), V = (e, t) => {
1531
+ var ae = Object.defineProperty, ce = (e, t, r) => () => {
1532
+ if (r) throw r[0];
1533
+ try {
1534
+ return e && (t = e(e = 0)), t;
1535
+ } catch (n) {
1536
+ throw r = [n], n;
1537
+ }
1538
+ }, ue = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), le = (e, t) => {
1532
1539
  let r = {};
1533
- for (var n in e) H(r, n, {
1540
+ for (var n in e) ae(r, n, {
1534
1541
  get: e[n],
1535
1542
  enumerable: !0
1536
1543
  });
1537
- return t || H(r, Symbol.toStringTag, { value: "Module" }), r;
1538
- }, y = class fe {
1544
+ return t || ae(r, Symbol.toStringTag, { value: "Module" }), r;
1545
+ }, N = class lt {
1539
1546
  _inner;
1540
1547
  _isDisposed = !1;
1541
1548
  constructor(t = []) {
1542
1549
  this._inner = t;
1543
1550
  }
1544
1551
  addDisposable(t) {
1545
- return this._inner.push(t), t instanceof fe && t.addDispose(() => {
1552
+ return this._inner.push(t), t instanceof lt && t.addDispose(() => {
1546
1553
  this.removeDisposable(t);
1547
1554
  }), t;
1548
1555
  }
@@ -1563,10 +1570,10 @@ __useblocks__.define("useblocks.js", [
1563
1570
  }
1564
1571
  }
1565
1572
  };
1566
- function O(e) {
1573
+ function W(e) {
1567
1574
  return `service_container_${e}`;
1568
1575
  }
1569
- var _e = class B extends y {
1576
+ var dt = class se extends N {
1570
1577
  _parent;
1571
1578
  _injectCallbacks = [];
1572
1579
  _injections = Object.create(null);
@@ -1592,7 +1599,7 @@ __useblocks__.define("useblocks.js", [
1592
1599
  _find(t, r = !0) {
1593
1600
  return this._injections[t] || r && this._parent?._find(t);
1594
1601
  }
1595
- _onInject(t, r, n = new y()) {
1602
+ _onInject(t, r, n = new N()) {
1596
1603
  return n.addDisposable(this.onInject((o) => {
1597
1604
  t === o && (n.dispose(), r(this.getInstance(o)));
1598
1605
  })), this._parent && n.addDisposable(this._parent._onInject(t, r, n)), this.addDisposable(n), n;
@@ -1612,82 +1619,82 @@ __useblocks__.define("useblocks.js", [
1612
1619
  return typeof r == "function" ? Promise.resolve(r()) : new Promise((n) => this._onInject(t, () => n(this.getInstance(t))));
1613
1620
  }
1614
1621
  addService(t, r) {
1615
- const n = O(t);
1622
+ const n = W(t);
1616
1623
  this.injectFactory(n, (i, s = []) => s.indexOf(r) < 0 ? [...s, r] : s);
1617
- const o = new y();
1624
+ const o = new N();
1618
1625
  return o.addDispose(() => {
1619
- this.injectFactory(n, (i, s = []) => s.filter((d) => d !== r));
1626
+ this.injectFactory(n, (i, s = []) => s.filter((l) => l !== r));
1620
1627
  }), o;
1621
1628
  }
1622
1629
  addServiceFactory(t, r, n) {
1623
- const o = O(t);
1630
+ const o = W(t);
1624
1631
  let i;
1625
- this.injectFactory(o, (d, f = []) => (i = r(d, i), i === void 0 ? f : f.indexOf(i) < 0 ? [...f, i] : f), n);
1626
- const s = new y();
1632
+ this.injectFactory(o, (l, f = []) => (i = r(l, i), i === void 0 ? f : f.indexOf(i) < 0 ? [...f, i] : f), n);
1633
+ const s = new N();
1627
1634
  return s.addDispose(() => {
1628
- this.injectFactory(o, (d, f = []) => i === void 0 ? f : f.filter((u) => u !== i));
1635
+ this.injectFactory(o, (l, f = []) => i === void 0 ? f : f.filter((c) => c !== i));
1629
1636
  }), s;
1630
1637
  }
1631
1638
  getServices(t) {
1632
- const r = O(t);
1639
+ const r = W(t);
1633
1640
  return [...this.getInstance(r, !1) || [], ...this._parent?.getServices(t) || []];
1634
1641
  }
1635
1642
  createChild() {
1636
- return new B(this);
1643
+ return new se(this);
1637
1644
  }
1638
1645
  getOrCreateIsolatedContainer(t) {
1639
1646
  return this.getOrCreateInstance(t, () => {
1640
1647
  const r = this._parent?.getOrCreateIsolatedContainer(t);
1641
- return new B(r);
1648
+ return new se(r);
1642
1649
  });
1643
1650
  }
1644
1651
  dispose() {
1645
1652
  this._injections = Object.create(null);
1646
1653
  }
1647
1654
  };
1648
- function N(e) {
1655
+ function V(e) {
1649
1656
  return e.startsWith("__") ? e : `__${e}__`;
1650
1657
  }
1651
- function Ee(e) {
1658
+ function pt(e) {
1652
1659
  if (typeof globalThis > "u") throw new Error("[di] globalThis is required for namespace container access.");
1653
- const t = N(e), r = globalThis;
1660
+ const t = V(e), r = globalThis;
1654
1661
  return r[t] ??= {};
1655
1662
  }
1656
- function he(e) {
1663
+ function _t(e) {
1657
1664
  return e != null && typeof e == "object" && typeof e.inject == "function" && typeof e.getInstance == "function";
1658
1665
  }
1659
- function Ie(e) {
1660
- if (e) return N(e);
1661
- return N("useblocks".trim());
1666
+ function ht(e) {
1667
+ if (e) return V(e);
1668
+ return V("useblocks".trim());
1662
1669
  }
1663
- function $(e) {
1664
- const t = Ee(Ie(e));
1665
- if (he(t.container)) return t.container;
1666
- const r = new _e(null);
1670
+ function fe(e) {
1671
+ const t = pt(ht(e));
1672
+ if (_t(t.container)) return t.container;
1673
+ const r = new dt(null);
1667
1674
  return t.container = r, r;
1668
1675
  }
1669
- function ge(e) {
1670
- return $(e);
1676
+ function Et(e) {
1677
+ return fe(e);
1671
1678
  }
1672
- function ye() {
1679
+ function gt() {
1673
1680
  let e = new Date().getTime(), t = typeof performance < "u" && performance.now && performance.now() * 1e3 || 0;
1674
1681
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(r) {
1675
1682
  let n = Math.random() * 16;
1676
1683
  return e > 0 ? (n = (e + n) % 16 | 0, e = Math.floor(e / 16)) : (n = (t + n) % 16 | 0, t = Math.floor(t / 16)), (r === "x" ? n : n & 3 | 8).toString(16);
1677
1684
  });
1678
1685
  }
1679
- function Se() {
1680
- return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : ye();
1686
+ function mt() {
1687
+ return typeof crypto < "u" && typeof crypto.randomUUID == "function" ? crypto.randomUUID() : gt();
1681
1688
  }
1682
- function c(e = Se()) {
1689
+ function d(e = mt()) {
1683
1690
  return e;
1684
1691
  }
1685
- function q() {
1692
+ function de() {
1686
1693
  return "umd".trim();
1687
1694
  }
1688
- function Ae(e) {
1695
+ function yt(e) {
1689
1696
  if (typeof globalThis > "u") return;
1690
- const t = q(), r = globalThis[e] ?? {};
1697
+ const t = de(), r = globalThis[e] ?? {};
1691
1698
  globalThis[e] = r;
1692
1699
  const n = r.__diagnostics ??= {}, o = n.diModuleEval ??= {
1693
1700
  evalCount: 0,
@@ -1699,31 +1706,31 @@ __useblocks__.define("useblocks.js", [
1699
1706
  stack: new Error().stack
1700
1707
  }), o.evalCount += 1;
1701
1708
  }
1702
- function Te() {
1709
+ function At() {
1703
1710
  return `__${"useblocks".trim()}__`;
1704
1711
  }
1705
- function me(e, t) {
1706
- if (Ae(t), typeof globalThis > "u") return e;
1707
- const r = q(), n = globalThis, o = n[t] = n[t] || {}, i = o.__diagnostics = o.__diagnostics || {}, s = i.dependencyResolver = i.dependencyResolver || { entries: [] }, d = {
1712
+ function It(e, t) {
1713
+ if (yt(t), typeof globalThis > "u") return e;
1714
+ const r = de(), n = globalThis, o = n[t] = n[t] || {}, i = o.__diagnostics = o.__diagnostics || {}, s = i.dependencyResolver = i.dependencyResolver || { entries: [] }, l = {
1708
1715
  container: e,
1709
1716
  source: "packages/runtime-core/di/index.ts",
1710
1717
  buildSource: r,
1711
1718
  timestamp: Date.now(),
1712
1719
  stack: new Error().stack
1713
1720
  };
1714
- return s.entries.push(d), e;
1721
+ return s.entries.push(l), e;
1715
1722
  }
1716
- var T;
1717
- function De() {
1718
- if (T) return T;
1719
- const e = Te();
1720
- return T = me($(e), e), T;
1723
+ var F;
1724
+ function Tt() {
1725
+ if (F) return F;
1726
+ const e = At();
1727
+ return F = It(fe(e), e), F;
1721
1728
  }
1722
1729
  new Proxy({}, { get(e, t, r) {
1723
- const n = De(), o = Reflect.get(n, t, r);
1730
+ const n = Tt(), o = Reflect.get(n, t, r);
1724
1731
  return typeof o == "function" ? o.bind(n) : o;
1725
1732
  } });
1726
- function Oe(e, t = "BackendError") {
1733
+ function St(e, t = "BackendError") {
1727
1734
  switch (e) {
1728
1735
  case 400: return "ValidationError";
1729
1736
  case 401: return "AuthenticationFailed";
@@ -1738,7 +1745,7 @@ __useblocks__.define("useblocks.js", [
1738
1745
  default: return t;
1739
1746
  }
1740
1747
  }
1741
- var Ne = class {
1748
+ var vt = class {
1742
1749
  _plugins = new Map();
1743
1750
  _listeners = new Map();
1744
1751
  _getOrCreateEntry(e) {
@@ -1851,7 +1858,7 @@ __useblocks__.define("useblocks.js", [
1851
1858
  e.add(t, r);
1852
1859
  } };
1853
1860
  }
1854
- }, ve = class {
1861
+ }, wt = class {
1855
1862
  resolveRegistry;
1856
1863
  constructor(e) {
1857
1864
  this.resolveRegistry = e;
@@ -1898,86 +1905,86 @@ __useblocks__.define("useblocks.js", [
1898
1905
  forContext() {
1899
1906
  return this.target().forContext();
1900
1907
  }
1901
- }, v = null, Ce = "core";
1902
- function be() {
1908
+ }, q = null, Ot = "core";
1909
+ function Dt() {
1903
1910
  return typeof __useblocks__?.require != "function" ? Promise.reject(new Error("[loadEngine] AMD loader is unavailable")) : new Promise((e, t) => {
1904
- __useblocks__.require([Ce], (r) => e(r), (r) => t(r instanceof Error ? r : new Error("[loadEngine] Failed to require core module")));
1911
+ __useblocks__.require([Ot], (r) => e(r), (r) => t(r instanceof Error ? r : new Error("[loadEngine] Failed to require core module")));
1905
1912
  });
1906
1913
  }
1907
- function C() {
1908
- return v || (v = be()), v;
1914
+ function $() {
1915
+ return q || (q = Dt()), q;
1909
1916
  }
1910
- var b = null, w = null;
1911
- async function we(e) {
1917
+ var K = null, X = null;
1918
+ async function bt(e) {
1912
1919
  typeof e?.prefetch == "function" && await e.prefetch();
1913
1920
  }
1914
- function W() {
1915
- return b || (b = C().then(() => {})), b;
1921
+ function pe() {
1922
+ return K || (K = $().then(() => {})), K;
1916
1923
  }
1917
- function R(e) {
1918
- return w || (w = we(e)), w;
1924
+ function z(e) {
1925
+ return X || (X = bt(e)), X;
1919
1926
  }
1920
- function X(e) {
1921
- return Promise.all([W(), R(e)]).then(() => {});
1927
+ function _e(e) {
1928
+ return Promise.all([pe(), z(e)]).then(() => {});
1922
1929
  }
1923
- function Re(e) {
1930
+ function Nt(e) {
1924
1931
  const t = e?.startupPrefetchMode;
1925
1932
  return t === "eager" || t === "idle" || t === "manual" || t === "off" ? t : "eager";
1926
1933
  }
1927
- function P(e) {
1928
- Promise.resolve().then(() => X(e)).catch(() => {});
1934
+ function J(e) {
1935
+ Promise.resolve().then(() => _e(e)).catch(() => {});
1929
1936
  }
1930
- function Pe(e) {
1931
- Promise.resolve().then(() => R(e)).catch(() => {});
1937
+ function Ct(e) {
1938
+ Promise.resolve().then(() => z(e)).catch(() => {});
1932
1939
  }
1933
- function Le(e) {
1934
- const t = Re(e);
1935
- if (t === "eager") P(e);
1940
+ function Pt(e) {
1941
+ const t = Nt(e);
1942
+ if (t === "eager") J(e);
1936
1943
  else if (t === "idle") {
1937
1944
  const r = window.requestIdleCallback;
1938
- typeof r == "function" ? r(() => P(e), { timeout: 1500 }) : setTimeout(() => P(e), 0);
1945
+ typeof r == "function" ? r(() => J(e), { timeout: 1500 }) : setTimeout(() => J(e), 0);
1939
1946
  }
1940
1947
  }
1941
- var Me = "PluginRegistry";
1942
- function xe(e = ge()) {
1943
- return e.getOrCreateInstance(Me, () => new Ne());
1948
+ var Lt = "PluginRegistry";
1949
+ function Rt(e = Et()) {
1950
+ return e.getOrCreateInstance(Lt, () => new vt());
1944
1951
  }
1945
- var ke = new ve(() => xe()), S = new WeakMap(), je = "data-useblocks-config-styles";
1946
- function Ue(e) {
1952
+ var Mt = new wt(() => Rt()), P = new WeakMap(), xt = "data-useblocks-config-styles";
1953
+ function kt(e) {
1947
1954
  return typeof e == "string" ? e.trim() : "";
1948
1955
  }
1949
- function K(e, t) {
1956
+ function he(e, t) {
1950
1957
  if (e.firstChild) {
1951
1958
  e.insertBefore(t, e.firstChild);
1952
1959
  return;
1953
1960
  }
1954
1961
  e.appendChild(t);
1955
1962
  }
1956
- function Ge(e, t, r) {
1963
+ function Ut(e, t, r) {
1957
1964
  if (!e || typeof document > "u") return null;
1958
- const n = Ue(t), o = S.get(e), i = r || e;
1959
- if (!n) return o && (o.remove(), S.delete(e)), null;
1960
- if (o) return o.textContent !== n && (o.textContent = n), (o.parentNode !== i || o !== i.firstChild) && K(i, o), o;
1965
+ const n = kt(t), o = P.get(e), i = r || e;
1966
+ if (!n) return o && (o.remove(), P.delete(e)), null;
1967
+ if (o) return o.textContent !== n && (o.textContent = n), (o.parentNode !== i || o !== i.firstChild) && he(i, o), o;
1961
1968
  const s = document.createElement("style");
1962
- return s.setAttribute(je, "true"), s.textContent = n, K(i, s), S.set(e, s), s;
1969
+ return s.setAttribute(xt, "true"), s.textContent = n, he(i, s), P.set(e, s), s;
1963
1970
  }
1964
- function Be(e) {
1971
+ function Ft(e) {
1965
1972
  if (!e) return;
1966
- const t = S.get(e);
1967
- t && (t.remove(), S.delete(e));
1973
+ const t = P.get(e);
1974
+ t && (t.remove(), P.delete(e));
1968
1975
  }
1969
- function I(e) {
1976
+ function T(e) {
1970
1977
  if (e instanceof DOMException && e.name === "AbortError") return e;
1971
1978
  const t = e === void 0 ? "The operation was aborted." : typeof e == "string" ? e : e instanceof Error ? e.message : String(e);
1972
1979
  return new DOMException(t, "AbortError");
1973
1980
  }
1974
- function _(e) {
1975
- if (e?.aborted) throw I(e.reason);
1981
+ function h(e) {
1982
+ if (e?.aborted) throw T(e.reason);
1976
1983
  }
1977
- function He(e, t) {
1978
- return t ? (_(t), new Promise((r, n) => {
1984
+ function jt(e, t) {
1985
+ return t ? (h(t), new Promise((r, n) => {
1979
1986
  const o = () => {
1980
- i(), n(I(t.reason));
1987
+ i(), n(T(t.reason));
1981
1988
  }, i = () => {
1982
1989
  t.removeEventListener("abort", o);
1983
1990
  };
@@ -1988,10 +1995,10 @@ __useblocks__.define("useblocks.js", [
1988
1995
  });
1989
1996
  })) : e;
1990
1997
  }
1991
- function Fe(e) {
1998
+ function Bt(e) {
1992
1999
  return typeof CSS < "u" && typeof CSS.escape == "function" ? CSS.escape(e) : e.replace(/([^a-zA-Z0-9_-])/g, "\\$1");
1993
2000
  }
1994
- function L(e, t = document) {
2001
+ function Y(e, t = document) {
1995
2002
  try {
1996
2003
  const n = t.querySelector(e);
1997
2004
  if (n) return n;
@@ -2002,75 +2009,75 @@ __useblocks__.define("useblocks.js", [
2002
2009
  for (let n = 0; n < r.length; n++) {
2003
2010
  const o = r[n]?.shadowRoot;
2004
2011
  if (!o) continue;
2005
- const i = L(e, o);
2012
+ const i = Y(e, o);
2006
2013
  if (i) return i;
2007
2014
  }
2008
2015
  return null;
2009
2016
  }
2010
- function Y(e, t = []) {
2017
+ function Ee(e, t = []) {
2011
2018
  const r = e.querySelectorAll("*");
2012
2019
  for (let n = 0; n < r.length; n++) {
2013
2020
  const o = r[n]?.shadowRoot;
2014
- o && (t.push(o), Y(o, t));
2021
+ o && (t.push(o), Ee(o, t));
2015
2022
  }
2016
2023
  return t;
2017
2024
  }
2018
- function Ve(e, t, r) {
2025
+ function Ht(e, t, r) {
2019
2026
  if (e.isConnected) return e;
2020
2027
  const n = e.id?.trim();
2021
- return n ? z(`#${Fe(n)}`, t, r) : Promise.reject(I("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."));
2028
+ return n ? ge(`#${Bt(n)}`, t, r) : Promise.reject(T("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."));
2022
2029
  }
2023
- function z(e, t, r) {
2024
- if (_(r), typeof e < "u") {
2030
+ function ge(e, t, r) {
2031
+ if (h(r), typeof e < "u") {
2025
2032
  if (typeof e == "string") {
2026
- const n = e, o = L(n);
2033
+ const n = e, o = Y(n);
2027
2034
  if (o) return o;
2028
- const i = t.addDisposable(new y());
2029
- return new Promise((s, d) => {
2030
- const f = (h) => {
2031
- i.dispose(), h();
2032
- }, u = () => {
2033
- f(() => d(I(r?.reason)));
2035
+ const i = t.addDisposable(new N());
2036
+ return new Promise((s, l) => {
2037
+ const f = (m) => {
2038
+ i.dispose(), m();
2039
+ }, c = () => {
2040
+ f(() => l(T(r?.reason)));
2034
2041
  };
2035
2042
  if (r?.aborted) {
2036
- u();
2043
+ c();
2037
2044
  return;
2038
2045
  }
2039
- r?.addEventListener("abort", u), i.addDispose(() => r?.removeEventListener("abort", u));
2040
- const l = document.body ?? document.documentElement;
2041
- if (!l) {
2042
- f(() => d(I("Document is not ready to observe mount element")));
2046
+ r?.addEventListener("abort", c), i.addDispose(() => r?.removeEventListener("abort", c));
2047
+ const u = document.body ?? document.documentElement;
2048
+ if (!u) {
2049
+ f(() => l(T("Document is not ready to observe mount element")));
2043
2050
  return;
2044
2051
  }
2045
- const p = new Set(), ue = new MutationObserver(() => {
2046
- const h = L(n);
2047
- if (h) {
2048
- f(() => s(h));
2052
+ const p = new Set(), b = new MutationObserver(() => {
2053
+ const m = Y(n);
2054
+ if (m) {
2055
+ f(() => s(m));
2049
2056
  return;
2050
2057
  }
2051
- de();
2052
- }), le = (h) => {
2053
- p.has(h) || (p.add(h), ue.observe(h, {
2058
+ U();
2059
+ }), g = (m) => {
2060
+ p.has(m) || (p.add(m), b.observe(m, {
2054
2061
  attributes: !0,
2055
2062
  childList: !0,
2056
2063
  subtree: !0
2057
2064
  }));
2058
- }, de = () => {
2059
- const h = document.documentElement;
2060
- if (h) for (const St of Y(h)) le(St);
2065
+ }, U = () => {
2066
+ const m = document.documentElement;
2067
+ if (m) for (const un of Ee(m)) g(un);
2061
2068
  };
2062
- le(l), de(), i.addDispose(() => ue.disconnect());
2069
+ g(u), U(), i.addDispose(() => b.disconnect());
2063
2070
  });
2064
2071
  }
2065
- return e instanceof Element ? Ve(e, t, r) : e;
2072
+ return e instanceof Element ? Ht(e, t, r) : e;
2066
2073
  }
2067
2074
  return e;
2068
2075
  }
2069
- var g = new Map();
2070
- function J() {
2076
+ var S = new Map();
2077
+ function me() {
2071
2078
  return !1;
2072
2079
  }
2073
- var $e = `
2080
+ var Gt = `
2074
2081
  .blocks-app-initial-spinner-wrapper {
2075
2082
  width: 100%;
2076
2083
  height: 100%;
@@ -2100,11 +2107,11 @@ __useblocks__.define("useblocks.js", [
2100
2107
  transform: rotate(360deg);
2101
2108
  }
2102
2109
  }`;
2103
- function qe() {
2110
+ function Wt() {
2104
2111
  return () => {};
2105
2112
  }
2106
- function We(e, t) {
2107
- if (!J() || !e || typeof document > "u") return qe();
2113
+ function Vt(e, t) {
2114
+ if (!me() || !e || typeof document > "u") return Wt();
2108
2115
  e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach((s) => {
2109
2116
  s.remove();
2110
2117
  });
@@ -2113,21 +2120,329 @@ __useblocks__.define("useblocks.js", [
2113
2120
  const n = document.createElement("div");
2114
2121
  n.classList.add("blocks-app-initial-spinner"), r.appendChild(n);
2115
2122
  const o = document.createElement("style");
2116
- o.setAttribute(t, "true"), o.textContent = $e, document.head?.appendChild(o), e.appendChild(r);
2123
+ o.setAttribute(t, "true"), o.textContent = Gt, document.head?.appendChild(o), e.appendChild(r);
2117
2124
  let i = !1;
2118
2125
  return () => {
2119
2126
  i || (i = !0, r.remove(), o.remove());
2120
2127
  };
2121
2128
  }
2122
- function A(e) {
2123
- return c(e);
2129
+ var C, ye = ce((() => {
2130
+ ye(), C = typeof C < "u" ? C : typeof self < "u" ? self : typeof window < "u" ? window : {};
2131
+ }));
2132
+ function Ae() {
2133
+ throw new Error("setTimeout has not been defined");
2134
+ }
2135
+ function Ie() {
2136
+ throw new Error("clearTimeout has not been defined");
2137
+ }
2138
+ function Te(e) {
2139
+ if (A === setTimeout) return setTimeout(e, 0);
2140
+ if ((A === Ae || !A) && setTimeout) return A = setTimeout, setTimeout(e, 0);
2141
+ try {
2142
+ return A(e, 0);
2143
+ } catch {
2144
+ try {
2145
+ return A.call(null, e, 0);
2146
+ } catch {
2147
+ return A.call(this, e, 0);
2148
+ }
2149
+ }
2150
+ }
2151
+ function qt(e) {
2152
+ if (I === clearTimeout) return clearTimeout(e);
2153
+ if ((I === Ie || !I) && clearTimeout) return I = clearTimeout, clearTimeout(e);
2154
+ try {
2155
+ return I(e);
2156
+ } catch {
2157
+ try {
2158
+ return I.call(null, e);
2159
+ } catch {
2160
+ return I.call(this, e);
2161
+ }
2162
+ }
2163
+ }
2164
+ function $t() {
2165
+ !w || !O || (w = !1, O.length ? y = O.concat(y) : L = -1, y.length && Se());
2166
+ }
2167
+ function Se() {
2168
+ if (!w) {
2169
+ var e = Te($t);
2170
+ w = !0;
2171
+ for (var t = y.length; t;) {
2172
+ for (O = y, y = []; ++L < t;) O && O[L].run();
2173
+ L = -1, t = y.length;
2174
+ }
2175
+ O = null, w = !1, qt(e);
2176
+ }
2177
+ }
2178
+ function Kt(e) {
2179
+ var t = new Array(arguments.length - 1);
2180
+ if (arguments.length > 1) for (var r = 1; r < arguments.length; r++) t[r - 1] = arguments[r];
2181
+ y.push(new ve(e, t)), y.length === 1 && !w && Te(Se);
2182
+ }
2183
+ function ve(e, t) {
2184
+ this.fun = e, this.array = t;
2185
+ }
2186
+ function v() {}
2187
+ function Xt(e) {
2188
+ throw new Error("process.binding is not supported");
2189
+ }
2190
+ function zt() {
2191
+ return "/";
2192
+ }
2193
+ function Jt(e) {
2194
+ throw new Error("process.chdir is not supported");
2195
+ }
2196
+ function Yt() {
2197
+ return 0;
2198
+ }
2199
+ function Qt(e) {
2200
+ var t = je.call(D) * .001, r = Math.floor(t), n = Math.floor(t % 1 * 1e9);
2201
+ return e && (r = r - e[0], n = n - e[1], n < 0 && (r--, n += 1e9)), [r, n];
2202
+ }
2203
+ function Zt() {
2204
+ return (new Date() - Be) / 1e3;
2205
+ }
2206
+ var A, I, y, w, O, L, we, Oe, De, be, Ne, Ce, Pe, Le, Re, Me, xe, ke, Ue, Fe, D, je, Be, j;
2207
+ ce((() => {
2208
+ ye(), A = Ae, I = Ie, typeof C.setTimeout == "function" && (A = setTimeout), typeof C.clearTimeout == "function" && (I = clearTimeout), y = [], w = !1, L = -1, ve.prototype.run = function() {
2209
+ this.fun.apply(null, this.array);
2210
+ }, we = "browser", Oe = "browser", De = {}, be = [], Ne = {}, Ce = {}, Pe = {}, Le = v, Re = v, Me = v, xe = v, ke = v, Ue = v, Fe = v, D = C.performance || {}, je = D.now || D.mozNow || D.msNow || D.oNow || D.webkitNow || function() {
2211
+ return new Date().getTime();
2212
+ }, Be = new Date(), j = {
2213
+ nextTick: Kt,
2214
+ title: we,
2215
+ browser: !0,
2216
+ env: De,
2217
+ argv: be,
2218
+ version: "",
2219
+ versions: Ne,
2220
+ on: Le,
2221
+ addListener: Re,
2222
+ once: Me,
2223
+ off: xe,
2224
+ removeListener: ke,
2225
+ removeAllListeners: Ue,
2226
+ emit: Fe,
2227
+ binding: Xt,
2228
+ cwd: zt,
2229
+ chdir: Jt,
2230
+ umask: Yt,
2231
+ hrtime: Qt,
2232
+ platform: Oe,
2233
+ release: Ce,
2234
+ config: Pe,
2235
+ uptime: Zt
2236
+ };
2237
+ }))();
2238
+ function R(e) {
2239
+ for (; e.endsWith("/");) e = e.slice(0, e.length - 1);
2240
+ return /\/wp-json$/i.test(e) ? e : `${e}/wp-json`;
2241
+ }
2242
+ function Q(...e) {
2243
+ const t = e.filter((i) => i != null);
2244
+ if (t.length === 0) return;
2245
+ if (t.length === 1) return t[0];
2246
+ const r = t.find((i) => i.aborted);
2247
+ if (r) return r;
2248
+ if (typeof AbortSignal < "u" && typeof AbortSignal.any == "function") return AbortSignal.any(t);
2249
+ const n = new AbortController(), o = (i) => {
2250
+ n.signal.aborted || n.abort(i.reason);
2251
+ };
2252
+ for (const i of t) i.addEventListener("abort", () => o(i), { once: !0 });
2253
+ return n.signal;
2254
+ }
2255
+ var He = 3e5, Ge = 15e3, _ = null, We = !1;
2256
+ function nr() {
2257
+ return !0;
2258
+ }
2259
+ function or() {
2260
+ const e = String(j.env.REACT_APP_OPENAPI_FAILOVER_TTL_MS || "").trim();
2261
+ if (!e) return He;
2262
+ const t = Number(e);
2263
+ return Number.isFinite(t) && t > 0 ? t : He;
2264
+ }
2265
+ function ir() {
2266
+ const e = String(j.env.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS || "").trim();
2267
+ if (!e) return Ge;
2268
+ const t = Number(e);
2269
+ return Number.isFinite(t) && t > 0 ? t : Ge;
2270
+ }
2271
+ function sr() {
2272
+ return R("https://app.useblocks.io/api".trim());
2273
+ }
2274
+ function ar(e) {
2275
+ const t = e.trim();
2276
+ if (!t) return [];
2277
+ if (t.startsWith("[")) try {
2278
+ const r = JSON.parse(t);
2279
+ if (!Array.isArray(r)) throw new Error("expected JSON array");
2280
+ return r.map((n) => String(n).trim()).filter(Boolean);
2281
+ } catch {
2282
+ return We || (We = !0), [];
2283
+ }
2284
+ return t.split(",").map((r) => r.trim()).filter(Boolean);
2285
+ }
2286
+ function cr(e) {
2287
+ const t = new Set(), r = [];
2288
+ for (const n of e) {
2289
+ const o = R(n);
2290
+ t.has(o) || (t.add(o), r.push(o));
2291
+ }
2292
+ return r;
2293
+ }
2294
+ function Ve(e) {
2295
+ const t = String(e || "").trim();
2296
+ return t ? R(t) : sr();
2297
+ }
2298
+ function qe(e, t = []) {
2299
+ return e ? cr([e, ...t]).slice(0, 3) : [];
2300
+ }
2301
+ function $e() {
2302
+ return ar(String(j.env.REACT_APP_OPENAPI_FAILOVER_BASE_URLS || "").trim());
2303
+ }
2304
+ function ur(e = Date.now()) {
2305
+ return _ ? e - _.switchedAt >= or() : !0;
2306
+ }
2307
+ function Ke(e = Date.now()) {
2308
+ _ && ur(e) && (_ = null);
2309
+ }
2310
+ function M(e) {
2311
+ if (!nr()) return !1;
2312
+ const t = Ve(e);
2313
+ if (!t) return !1;
2314
+ const r = $e();
2315
+ return r.length === 0 ? !1 : qe(t, r).length > 1;
2316
+ }
2317
+ function x(e) {
2318
+ const t = Ve(e);
2319
+ if (!t) return [];
2320
+ const r = $e();
2321
+ return r.length === 0 ? [t] : qe(t, r);
2322
+ }
2323
+ function Xe(e) {
2324
+ const t = x(e);
2325
+ if (t.length === 0) return "";
2326
+ if (Ke(), _) {
2327
+ const r = t.indexOf(_.activeUrl);
2328
+ if (r >= 0) return t[r];
2329
+ }
2330
+ return t[0];
2331
+ }
2332
+ function lr(e) {
2333
+ const t = x(e);
2334
+ if (t.length <= 1 || (Ke(), !_ || !t.includes(_.activeUrl))) return t;
2335
+ const r = _.activeUrl;
2336
+ return [r, ...t.filter((n) => n !== r)];
2337
+ }
2338
+ function fr(e) {
2339
+ return Xe(e) || void 0;
2340
+ }
2341
+ function dr(e) {
2342
+ const t = e || void 0;
2343
+ if (typeof AbortController > "u") return {
2344
+ signal: t,
2345
+ timeoutError: () => {},
2346
+ done: () => {}
2347
+ };
2348
+ const r = ir(), n = new AbortController();
2349
+ let o;
2350
+ const i = setTimeout(() => {
2351
+ o = pr(r), n.abort(o);
2352
+ }, r);
2353
+ return {
2354
+ signal: Q(t, n.signal),
2355
+ timeoutError: () => o,
2356
+ done: () => clearTimeout(i)
2357
+ };
2358
+ }
2359
+ function pr(e) {
2360
+ const t = `[apiOriginFailover] origin attempt timed out after ${e}ms`;
2361
+ if (typeof DOMException == "function") return new DOMException(t, "TimeoutError");
2362
+ const r = new Error(t);
2363
+ return r.name = "TimeoutError", r;
2364
+ }
2365
+ function _r(e) {
2366
+ return e === 502 || e === 503 || e === 504;
2367
+ }
2368
+ function hr(e) {
2369
+ return !(e instanceof Error) && !(e instanceof DOMException) ? !1 : e.name === "TimeoutError" ? !0 : e instanceof TypeError;
2370
+ }
2371
+ var ze;
2372
+ function Er(e) {
2373
+ ze = e;
2374
+ }
2375
+ function Je(e, t) {
2376
+ if (!M(t)) return;
2377
+ const r = x(t);
2378
+ if (r.length <= 1) return;
2379
+ const n = r.indexOf(R(e));
2380
+ if (n < 0) return;
2381
+ const o = n + 1;
2382
+ if (o >= r.length) return;
2383
+ const i = r[o], s = _?.activeUrl;
2384
+ _ = {
2385
+ activeUrl: i,
2386
+ switchedAt: Date.now()
2387
+ }, s !== i && ze?.();
2388
+ }
2389
+ function gr(e, t) {
2390
+ if (!M(t)) return;
2391
+ const r = R(e), n = x(t);
2392
+ if (n.includes(r)) {
2393
+ if (r === n[0]) {
2394
+ _ = null;
2395
+ return;
2396
+ }
2397
+ _?.activeUrl !== r && (_ = {
2398
+ activeUrl: r,
2399
+ switchedAt: Date.now()
2400
+ });
2401
+ }
2402
+ }
2403
+ function mr() {
2404
+ _ = null;
2405
+ }
2406
+ async function yr(e, t, r, n) {
2407
+ const o = n?.attemptTimeout ?? M(r), i = M(r) ? lr(r) : x(r).length > 0 ? [Xe(r)] : [];
2408
+ if (i.length === 0) throw new Error("[apiOriginFailover] no API base URL configured");
2409
+ const s = e.startsWith("/") ? e : `/${e}`;
2410
+ let l, f;
2411
+ for (let c = 0; c < i.length; c++) {
2412
+ const u = i[c], p = c === i.length - 1, b = o ? dr(t.signal) : void 0;
2413
+ try {
2414
+ const g = await fetch(`${u}${s}`, {
2415
+ ...t,
2416
+ ...b ? { signal: b.signal } : {}
2417
+ });
2418
+ if (!g.ok && _r(g.status)) {
2419
+ if (l = g, !p) {
2420
+ Je(u, r);
2421
+ continue;
2422
+ }
2423
+ break;
2424
+ }
2425
+ return g.ok && gr(u, r), g;
2426
+ } catch (g) {
2427
+ const U = b?.timeoutError();
2428
+ if (!U && !hr(g)) throw g;
2429
+ f = U || g, p || Je(u, r);
2430
+ } finally {
2431
+ b?.done();
2432
+ }
2433
+ }
2434
+ if (M(r) && mr(), l) return l;
2435
+ throw f instanceof Error ? f : new Error("[apiOriginFailover] fetch chain failed");
2436
+ }
2437
+ function k(e) {
2438
+ return d(e);
2124
2439
  }
2125
- A("HANDLE_ATOM_INSERT");
2126
- A("SETTINGS_PANEL_EVENT");
2127
- A("MODAL_SHOW_EVENT");
2128
- A("MODAL_CLOSE_EVENT");
2129
- A("MODAL_UPDATE_EVENT");
2130
- var Xe = F(((e) => {
2440
+ k("HANDLE_ATOM_INSERT");
2441
+ k("SETTINGS_PANEL_EVENT");
2442
+ k("MODAL_SHOW_EVENT");
2443
+ k("MODAL_CLOSE_EVENT");
2444
+ k("MODAL_UPDATE_EVENT");
2445
+ var Ar = ue(((e) => {
2131
2446
  var t = {
2132
2447
  isMounted: function() {
2133
2448
  return !1;
@@ -2136,168 +2451,221 @@ __useblocks__.define("useblocks.js", [
2136
2451
  enqueueReplaceState: function() {},
2137
2452
  enqueueSetState: function() {}
2138
2453
  }, r = Object.assign, n = {};
2139
- function o(u, l, p) {
2140
- this.props = u, this.context = l, this.refs = n, this.updater = p || t;
2141
- }
2142
- o.prototype.isReactComponent = {}, o.prototype.setState = function(u, l) {
2143
- if (typeof u != "object" && typeof u != "function" && u != null) throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
2144
- this.updater.enqueueSetState(this, u, l, "setState");
2145
- }, o.prototype.forceUpdate = function(u) {
2146
- this.updater.enqueueForceUpdate(this, u, "forceUpdate");
2454
+ function o(c, u, p) {
2455
+ this.props = c, this.context = u, this.refs = n, this.updater = p || t;
2456
+ }
2457
+ o.prototype.isReactComponent = {}, o.prototype.setState = function(c, u) {
2458
+ if (typeof c != "object" && typeof c != "function" && c != null) throw Error("takes an object of state variables to update or a function which returns an object of state variables.");
2459
+ this.updater.enqueueSetState(this, c, u, "setState");
2460
+ }, o.prototype.forceUpdate = function(c) {
2461
+ this.updater.enqueueForceUpdate(this, c, "forceUpdate");
2147
2462
  };
2148
2463
  function i() {}
2149
2464
  i.prototype = o.prototype;
2150
- function s(u, l, p) {
2151
- this.props = u, this.context = l, this.refs = n, this.updater = p || t;
2465
+ function s(c, u, p) {
2466
+ this.props = c, this.context = u, this.refs = n, this.updater = p || t;
2152
2467
  }
2153
- var d = s.prototype = new i();
2154
- d.constructor = s, r(d, o.prototype), d.isPureReactComponent = !0;
2468
+ var l = s.prototype = new i();
2469
+ l.constructor = s, r(l, o.prototype), l.isPureReactComponent = !0;
2155
2470
  Array.isArray;
2156
2471
  }));
2157
- F(((e, t) => {
2158
- t.exports = Xe();
2472
+ ue(((e, t) => {
2473
+ t.exports = Ar();
2159
2474
  }))();
2160
2475
  function a(e) {
2161
- return c(e);
2476
+ return d(e);
2162
2477
  }
2163
- var Q;
2478
+ var Ye;
2164
2479
  (function(e) {
2165
2480
  e.BEFORE_SAVE_EMAIL = a(), e.ON_SAVEBUTTON_CLICK_ID = a(), e.ON_NEXTBUTTON_CLICK_ID = a(), e.ON_PREVIOUSBUTTON_CLICK_ID = a(), e.ON_MODEL_CHANGE = a(), e.WILL_EMAIL_INIT_ID = a(), e.ON_EMAIL_INIT_ID = a(), e.ON_BLOCK_INIT_ID = a(), e.ON_CONTENT_CHANGED_ID = a(), e.ON_PREHEADER_CHANGED_ID = a(), e.ON_SUBJECT_CHANGED_ID = a(), e.ON_EMAIL_CHANGED_ID = a(), e.ON_BLOCK_CHANGED_ID = a(), e.ON_CHUNKS_LOADED = a(), e.ON_SEND_TESTEMAIL_ID = a(), e.ON_SEND_LIVEPREVIEW_ID = a(), e.ON_SHARE_ID = a(), e.ON_SHOW_PREVIEW_ID = a(), e.ON_EMAIL_CLONE_ID = a(), e.ON_SEND_EMAIL_MODAL_ID = a(), e.ON_NOTIFICATION = a(), e.READ_LOCALE = a(), e.ON_TRANSLATE_ID = a(), e.ON_CODE_VALIDATE_ID = a(), e.UPLOAD_EVENT_ID = a(), e.PROXY_URL_EVENT_ID = a(), e.FILE_PROXY_EVENT_ID = a(), e.ON_LIMIT_ID = a(), e.ON_BROWSER_EXTENSION_DETECTED_ID = a(), e.ON_LAYOUT_CONVERT_REQUEST_ID = a(), e.ON_BROWSER_TRANSLATE_DETECTED_ID = a(), e.AI_TEXT_REQUEST_ID = a(), e.AI_IMAGE_REQUEST_ID = a(), e.AI_TEXT_PROGRESS_ID = a(), e.AI_IMAGE_PROGRESS_ID = a(), e.AI_TEXT_STREAM_ID = a();
2166
- })(Q || (Q = {}));
2481
+ })(Ye || (Ye = {}));
2167
2482
  a("APP_LOAD_EVENT");
2168
2483
  a("CONFIG_CHANGED_EVENT");
2169
- function M(e) {
2170
- for (; e.endsWith("/");) e = e.slice(0, e.length - 1);
2171
- return /\/wp-json$/i.test(e) ? e : `${e}/wp-json`;
2484
+ function Qe(e) {
2485
+ return String(e.standaloneKey || "").trim() || void 0;
2172
2486
  }
2173
- M("https://app.useblocks.io/api");
2174
- var Z;
2175
- (function(e) {
2176
- const t = "https://racs.rest/v3";
2177
- function r(o, i) {
2178
- const s = {
2179
- method: "POST",
2180
- headers: {
2181
- "Content-Type": "application/json",
2182
- Accept: "application/json"
2183
- },
2184
- body: JSON.stringify(i)
2185
- };
2186
- return fetch(`${t}?resource=${o}&dataset=${document.location.hostname}`, s);
2187
- }
2188
- e.post = r;
2189
- async function n(o, i = 0) {
2190
- const s = {
2191
- method: "POST",
2192
- headers: {
2193
- "Content-Type": "application/json",
2194
- Accept: "application/json"
2195
- },
2196
- body: `{"filter":{},"limit":${i}}`
2197
- };
2198
- return await (await fetch(`${t}/get?resource=${o}&dataset=${document.location.hostname}`, s)).json();
2199
- }
2200
- e.getAll = n;
2201
- })(Z || (Z = {}));
2202
- var x = new Map(), ee = new WeakMap();
2487
+ function Tr(e) {
2488
+ return e.standaloneOnAuthFailure === !0 ? !0 : e.config?.standaloneOnAuthFailure === !0;
2489
+ }
2490
+ function Ze(e) {
2491
+ return Tr(e) ? !!Qe(e) : !1;
2492
+ }
2493
+ function Sr(e) {
2494
+ return !!Qe(e) && !Ze(e);
2495
+ }
2496
+ function et(e) {
2497
+ return Sr(e);
2498
+ }
2499
+ var B = new Map(), Z = new Set();
2500
+ function vr(e, t) {
2501
+ Z.has(e) || Z.add(e);
2502
+ }
2503
+ function ee() {
2504
+ B.clear(), Z.clear();
2505
+ }
2506
+ Er(ee);
2507
+ var tt = new WeakMap();
2203
2508
  function te(e) {
2204
- const t = String(e || "").trim();
2205
- if (t) return M(t);
2206
- return M("https://app.useblocks.io/api".trim());
2509
+ return fr(e);
2510
+ }
2511
+ function wr(e, t) {
2512
+ const r = new Error(`[Loader] appInit request failed: ${e} ${t}`);
2513
+ return r.status = e, r;
2514
+ }
2515
+ function Or() {
2516
+ const e = new Error("[Loader] appInit skipped: empty auth token");
2517
+ return e.terminal = !0, e;
2207
2518
  }
2208
- async function Ye(e) {
2519
+ async function Dr(e) {
2209
2520
  if (!e.getAuthToken) return;
2210
- const t = await e.getAuthToken(e.user, e.project, void 0);
2211
- return t ? `Bearer ${t}` : void 0;
2521
+ const t = await e.getAuthToken(e.user, e.project, void 0), r = String(t || "").trim();
2522
+ return r ? `Bearer ${r}` : void 0;
2212
2523
  }
2213
- function ze(e) {
2524
+ async function br(e) {
2525
+ if (!e.getAuthToken) return !0;
2526
+ try {
2527
+ const t = await e.getAuthToken(e.user, e.project, void 0);
2528
+ return !!String(t || "").trim();
2529
+ } catch {
2530
+ return !1;
2531
+ }
2532
+ }
2533
+ function Nr(e) {
2214
2534
  return async ({ baseUrl: t }) => {
2215
2535
  const r = te(t);
2216
2536
  if (!r) throw new Error("[Loader] appInit warmup requires baseUrl or REACT_APP_OPENAPI_BASE_URL");
2217
2537
  const n = new Headers({
2218
2538
  Accept: "application/json",
2219
2539
  "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8"
2220
- }), o = await Ye(e);
2540
+ }), o = await Dr(e);
2541
+ if (e.getAuthToken && !o) throw Or();
2221
2542
  o && n.set("authorization", o);
2222
- const i = await fetch(`${r}/app/v1/app_init`, {
2543
+ const i = await yr("/app/v1/app_init", {
2223
2544
  method: "POST",
2224
2545
  headers: n,
2225
2546
  body: new URLSearchParams(),
2226
2547
  credentials: "same-origin"
2227
- });
2228
- if (!i.ok) throw new Error(`[Loader] appInit request failed: ${i.status} ${i.statusText}`);
2548
+ }, r, { attemptTimeout: Ze(e) || void 0 });
2549
+ if (!i.ok) throw wr(i.status, i.statusText);
2229
2550
  return i.json();
2230
2551
  };
2231
2552
  }
2232
- function Je(e) {
2553
+ function Cr(e) {
2233
2554
  return JSON.stringify({
2234
2555
  baseUrl: te(e.baseUrl) || "",
2235
2556
  project: e.project ?? "",
2236
2557
  userId: e.user?.id ?? ""
2237
2558
  });
2238
2559
  }
2239
- function Qe(e) {
2560
+ function Pr(e) {
2561
+ if (!(e instanceof Error)) return !1;
2562
+ const t = e;
2563
+ return t.terminal ? !0 : t.status === 403 || t.status === 404;
2564
+ }
2565
+ function Lr(e) {
2566
+ return e.appInit ? !0 : !(e.jwtAuth && !e.getAuthToken);
2567
+ }
2568
+ function Rr(e) {
2240
2569
  return async (t) => {
2241
- const r = Je(t), n = x.get(r);
2570
+ const r = Cr(t), n = B.get(r);
2242
2571
  if (n) return n;
2243
2572
  const o = Promise.resolve(e(t)).catch((i) => {
2244
- throw x.delete(r), i;
2573
+ throw vr(r, i), Pr(i) || B.delete(r), i;
2245
2574
  });
2246
- return x.set(r, o), o;
2575
+ return B.set(r, o), o;
2247
2576
  };
2248
2577
  }
2249
- function Ze(e) {
2250
- if (e.standaloneKey) return e;
2251
- const t = e.appInit || ze(e);
2252
- let r = ee.get(t);
2253
- return r || (r = Qe(t), ee.set(t, r)), Promise.resolve(r({
2254
- baseUrl: e.baseUrl,
2255
- user: e.user,
2256
- project: e.project,
2257
- prevApp: void 0
2258
- })).catch((n) => {}), {
2578
+ function Mr(e) {
2579
+ if (et(e) || !e.appInit && !te(e.baseUrl) || !Lr(e)) return e;
2580
+ const t = e.appInit || Nr(e);
2581
+ let r = tt.get(t);
2582
+ return r || (r = Rr(t), tt.set(t, r)), (async () => {
2583
+ await br(e) && await r({
2584
+ baseUrl: e.baseUrl,
2585
+ user: e.user,
2586
+ project: e.project,
2587
+ prevApp: void 0
2588
+ });
2589
+ })().catch(() => {}), {
2259
2590
  ...e,
2260
2591
  appInit: r
2261
2592
  };
2262
2593
  }
2263
- var re = new WeakMap();
2264
- function et(e) {
2265
- let t = null;
2266
- return async (r, n, o) => (t || (t = Promise.resolve(e(r, n, o)).finally(() => {
2267
- t = null;
2268
- })), t);
2594
+ function xr(e) {
2595
+ const t = e.replace(/-/g, "+").replace(/_/g, "/").padEnd(e.length + (4 - e.length % 4) % 4, "="), r = atob(t), n = new Uint8Array(r.length);
2596
+ for (let o = 0; o < r.length; o++) n[o] = r.charCodeAt(o);
2597
+ return new TextDecoder().decode(n);
2598
+ }
2599
+ function kr(e) {
2600
+ const [t, r, n] = e.split("."), o = JSON.parse(xr(r));
2601
+ return {
2602
+ exp: o.exp,
2603
+ createdAt: o.iat,
2604
+ data: o
2605
+ };
2606
+ }
2607
+ var rt = 0;
2608
+ function Ur() {
2609
+ return rt;
2610
+ }
2611
+ function Fr() {
2612
+ rt += 1, ee();
2613
+ }
2614
+ var nt = new WeakMap(), ot = new WeakMap(), jr = 3e4;
2615
+ function Br(e, t) {
2616
+ return JSON.stringify({
2617
+ userId: e?.id ?? "",
2618
+ project: t ?? ""
2619
+ });
2620
+ }
2621
+ function Hr(e, t) {
2622
+ try {
2623
+ const r = kr(e)?.exp;
2624
+ if (typeof r == "number" && Number.isFinite(r) && r > 0) return r * 1e3;
2625
+ } catch {}
2626
+ return t + jr;
2627
+ }
2628
+ function Gr(e) {
2629
+ const t = new Map(), r = new Map();
2630
+ return async (n, o, i) => {
2631
+ const s = Br(n, o);
2632
+ if (i) return r.delete(s), t.delete(s), ee(), e(n, o, i);
2633
+ const l = r.get(s);
2634
+ if (l && !t.has(s)) {
2635
+ if (l.expiresAtMs > Date.now()) return l.token;
2636
+ r.delete(s);
2637
+ }
2638
+ let f = t.get(s);
2639
+ return f || (f = Promise.resolve(e(n, o, i)).then((c) => {
2640
+ const u = String(c || "").trim();
2641
+ return u && r.set(s, {
2642
+ token: c,
2643
+ expiresAtMs: Hr(u, Date.now())
2644
+ }), c;
2645
+ }).finally(() => {
2646
+ t.delete(s);
2647
+ }), t.set(s, f)), f;
2648
+ };
2269
2649
  }
2270
- function tt(e) {
2271
- if (e.standaloneKey) return e;
2650
+ function Wr(e) {
2651
+ if (et(e)) return e;
2272
2652
  const t = e.getAuthToken;
2273
2653
  if (!t) return e;
2274
- let r = re.get(t);
2275
- return r || (r = et(t), re.set(t, r)), Promise.resolve(r(e.user, e.project, void 0)).catch((n) => {}), {
2654
+ let r = nt.get(t);
2655
+ const n = Ur();
2656
+ return (!r || ot.get(t) !== n) && (r = Gr(t), nt.set(t, r), ot.set(t, n)), Promise.resolve(r(e.user, e.project, void 0)).catch((o) => {}), {
2276
2657
  ...e,
2277
2658
  getAuthToken: r
2278
2659
  };
2279
2660
  }
2280
- function ne(...e) {
2281
- const t = e.filter((i) => i != null);
2282
- if (t.length === 0) return;
2283
- if (t.length === 1) return t[0];
2284
- const r = t.find((i) => i.aborted);
2285
- if (r) return r;
2286
- if (typeof AbortSignal < "u" && typeof AbortSignal.any == "function") return AbortSignal.any(t);
2287
- const n = new AbortController(), o = (i) => {
2288
- n.signal.aborted || n.abort(i.reason);
2289
- };
2290
- for (const i of t) i.addEventListener("abort", () => o(i), { once: !0 });
2291
- return n.signal;
2292
- }
2293
- var k = "Editor mount element was removed from the document. Call instance.destroy() on host unmount.";
2294
- function rt() {
2295
- return I(k);
2661
+ var re = "Editor mount element was removed from the document. Call instance.destroy() on host unmount.";
2662
+ function Vr() {
2663
+ return T(re);
2296
2664
  }
2297
- function oe(e) {
2298
- return !(e instanceof DOMException) || e.name !== "AbortError" ? !1 : e.message === k;
2665
+ function it(e) {
2666
+ return !(e instanceof DOMException) || e.name !== "AbortError" ? !1 : e.message === re;
2299
2667
  }
2300
- function nt(e, t, r) {
2668
+ function qr(e, t, r) {
2301
2669
  if (typeof document > "u") return;
2302
2670
  let n = !1, o;
2303
2671
  const i = () => {
@@ -2312,44 +2680,44 @@ __useblocks__.define("useblocks.js", [
2312
2680
  o = new MutationObserver(() => {
2313
2681
  e.isConnected || s();
2314
2682
  });
2315
- let d = e.parentNode;
2316
- for (; d;) o.observe(d, { childList: !0 }), d = d.parentNode;
2683
+ let l = e.parentNode;
2684
+ for (; l;) o.observe(l, { childList: !0 }), l = l.parentNode;
2317
2685
  }
2318
- function ot(e) {
2686
+ function $r(e) {
2319
2687
  const { hostElementOption: t, resolvedElement: r, externalSignal: n, disposable: o } = e;
2320
2688
  if (t === void 0 || !(r instanceof Element)) return n;
2321
2689
  const i = new AbortController();
2322
- return nt(r, () => {
2323
- r.id, i.abort(rt());
2324
- }, o), ne(n, i.signal);
2690
+ return qr(r, () => {
2691
+ r.id, i.abort(Vr());
2692
+ }, o), Q(n, i.signal);
2325
2693
  }
2326
- var j = "Superseded by newer init() on the same mount element";
2327
- function ie() {
2328
- return I(j);
2694
+ var ne = "Superseded by newer init() on the same mount element";
2695
+ function st() {
2696
+ return T(ne);
2329
2697
  }
2330
- function se(e) {
2331
- return !(e instanceof DOMException) || e.name !== "AbortError" ? !1 : e.message === j;
2698
+ function at(e) {
2699
+ return !(e instanceof DOMException) || e.name !== "AbortError" ? !1 : e.message === ne;
2332
2700
  }
2333
- var m = new Map(), D = new WeakMap();
2334
- function it(e) {
2701
+ var H = new Map(), G = new WeakMap();
2702
+ function Kr(e) {
2335
2703
  if (e instanceof Element) {
2336
2704
  const t = e.id?.trim();
2337
2705
  if (t) return `#${t}`;
2338
2706
  }
2339
2707
  }
2340
- function st(e) {
2708
+ function Xr(e) {
2341
2709
  if (!(e instanceof Element)) return { release: () => {} };
2342
- const t = it(e);
2343
- D.get(e)?.abort(ie()), t && m.get(t)?.abort(ie());
2710
+ const t = Kr(e);
2711
+ G.get(e)?.abort(st()), t && H.get(t)?.abort(st());
2344
2712
  const r = new AbortController();
2345
- return D.set(e, r), t && m.set(t, r), {
2713
+ return G.set(e, r), t && H.set(t, r), {
2346
2714
  signal: r.signal,
2347
2715
  release: () => {
2348
- D.get(e) === r && D.delete(e), t && m.get(t) === r && m.delete(t);
2716
+ G.get(e) === r && G.delete(e), t && H.get(t) === r && H.delete(t);
2349
2717
  }
2350
2718
  };
2351
2719
  }
2352
- var at = V({ FileManagerApiError: () => ct }), ct = class pe extends Error {
2720
+ var zr = le({ FileManagerApiError: () => Jr }), Jr = class ft extends Error {
2353
2721
  code;
2354
2722
  status;
2355
2723
  details;
@@ -2357,38 +2725,38 @@ __useblocks__.define("useblocks.js", [
2357
2725
  return this.status;
2358
2726
  }
2359
2727
  constructor(t, r, n, o) {
2360
- super(t), this.name = "FileManagerApiError", this.code = r, this.status = n, this.details = o, Error.captureStackTrace && Error.captureStackTrace(this, pe);
2728
+ super(t), this.name = "FileManagerApiError", this.code = r, this.status = n, this.details = o, Error.captureStackTrace && Error.captureStackTrace(this, ft);
2361
2729
  }
2362
- }, ut = V({ mapHttpStatusToErrorCode: () => Oe });
2363
- function lt(e, t) {
2730
+ }, Yr = le({ mapHttpStatusToErrorCode: () => St });
2731
+ function Qr(e, t) {
2364
2732
  return {
2365
2733
  ...e,
2366
2734
  element: t
2367
2735
  };
2368
2736
  }
2369
- function U() {
2737
+ function oe() {
2370
2738
  return () => {};
2371
2739
  }
2372
- function dt(e) {
2740
+ function Zr(e) {
2373
2741
  const t = e.element;
2374
- return !t || typeof t == "string" || typeof document > "u" ? U() : (Ge(t, e.config?.styles, t), () => {
2375
- Be(t);
2742
+ return !t || typeof t == "string" || typeof document > "u" ? oe() : (Ut(t, e.config?.styles, t), () => {
2743
+ Ft(t);
2376
2744
  });
2377
2745
  }
2378
- function ft(e) {
2379
- if (!J() || e.initialSpinner === !1 || typeof document > "u") return {
2746
+ function en(e) {
2747
+ if (!me() || e.initialSpinner === !1 || typeof document > "u") return {
2380
2748
  options: e,
2381
- cleanup: U()
2749
+ cleanup: oe()
2382
2750
  };
2383
2751
  const t = e.element;
2384
2752
  if (!t || typeof t == "string") return {
2385
2753
  options: e,
2386
- cleanup: U()
2754
+ cleanup: oe()
2387
2755
  };
2388
2756
  t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach((o) => {
2389
2757
  o.remove();
2390
2758
  });
2391
- const r = We(t, "data-useblocks"), n = e.handleChunkLoaded;
2759
+ const r = Vt(t, "data-useblocks"), n = e.handleChunkLoaded;
2392
2760
  return {
2393
2761
  options: {
2394
2762
  ...e,
@@ -2399,103 +2767,103 @@ __useblocks__.define("useblocks.js", [
2399
2767
  cleanup: r
2400
2768
  };
2401
2769
  }
2402
- function pt(e) {
2770
+ function tn(e) {
2403
2771
  return e?.length ? e.some((t) => Array.isArray(t) ? !1 : !!(t && typeof t == "object" && "url" in t)) : !1;
2404
2772
  }
2405
- function ae(e) {
2773
+ function ct(e) {
2406
2774
  return e instanceof DOMException && e.name === "AbortError";
2407
2775
  }
2408
- function ce(e) {
2776
+ function ut(e) {
2409
2777
  try {
2410
2778
  e.destroy();
2411
2779
  } catch {}
2412
2780
  }
2413
- function G(e, ...t) {
2414
- const r = g.get(e);
2415
- t.some((n) => n !== void 0 && n === r) && g.delete(e);
2781
+ function ie(e, ...t) {
2782
+ const r = S.get(e);
2783
+ t.some((n) => n !== void 0 && n === r) && S.delete(e);
2416
2784
  }
2417
- var _t = "1.1.56";
2418
- async function Et(e) {
2419
- await X(typeof __useblocks__ < "u" ? __useblocks__ : void 0);
2785
+ var rn = "1.1.60";
2786
+ async function nn(e) {
2787
+ await _e(typeof __useblocks__ < "u" ? __useblocks__ : void 0);
2420
2788
  }
2421
- async function ht(e) {
2422
- return It(e);
2789
+ async function on(e) {
2790
+ return sn(e);
2423
2791
  }
2424
- async function It(e) {
2425
- _(e.signal);
2426
- const t = new y();
2792
+ async function sn(e) {
2793
+ h(e.signal);
2794
+ const t = new N();
2427
2795
  let r;
2428
2796
  try {
2429
- const n = await z(e.element, t, e.signal), o = ot({
2797
+ const n = await ge(e.element, t, e.signal), o = $r({
2430
2798
  hostElementOption: e.element,
2431
2799
  resolvedElement: n,
2432
2800
  externalSignal: e.signal,
2433
2801
  disposable: t
2434
- }), i = st(n);
2802
+ }), i = Xr(n);
2435
2803
  r = i.release;
2436
- const s = ne(o, i.signal);
2437
- return await He(gt(e, n, s), s);
2804
+ const s = Q(o, i.signal);
2805
+ return await jt(an(e, n, s), s);
2438
2806
  } finally {
2439
2807
  r?.(), t.dispose();
2440
2808
  }
2441
2809
  }
2442
- async function gt(e, t, r) {
2443
- _(r);
2444
- const n = Ze(tt(lt(e, t))), o = r != null ? {
2810
+ async function an(e, t, r) {
2811
+ h(r), Fr();
2812
+ const n = Mr(Wr(Qr(e, t))), o = r != null ? {
2445
2813
  ...n,
2446
2814
  signal: r
2447
2815
  } : n;
2448
2816
  if (t) {
2449
- const u = g.get(t);
2450
- if (u) {
2451
- let l;
2817
+ const c = S.get(t);
2818
+ if (c) {
2819
+ let u;
2452
2820
  try {
2453
- l = await u, _(r);
2821
+ u = await c, h(r);
2454
2822
  } catch (p) {
2455
- if (_(r), G(t, u), ae(p)) throw p;
2456
- l = void 0;
2823
+ if (h(r), ie(t, c), ct(p)) throw p;
2824
+ u = void 0;
2457
2825
  }
2458
- if (l) if (l.getElement() === t) try {
2459
- return await l.reset(o);
2826
+ if (u) if (u.getElement() === t) try {
2827
+ return await u.reset(o);
2460
2828
  } catch (p) {
2461
- if (_(r), se(p) || oe(p) || ae(p) && r?.aborted) throw p;
2462
- G(t, u, l), ce(l);
2829
+ if (h(r), at(p) || it(p) || ct(p) && r?.aborted) throw p;
2830
+ ie(t, c, u), ut(u);
2463
2831
  }
2464
- else G(t, u, l), ce(l);
2832
+ else ie(t, c, u), ut(u);
2465
2833
  }
2466
2834
  }
2467
- _(r);
2468
- const i = dt(n), s = ft(n), d = r != null ? {
2835
+ h(r);
2836
+ const i = Zr(n), s = en(n), l = r != null ? {
2469
2837
  ...s.options,
2470
2838
  signal: r
2471
2839
  } : s.options;
2472
2840
  let f;
2473
2841
  try {
2474
- await W(), _(r);
2475
- const u = typeof __useblocks__ < "u" ? __useblocks__ : void 0;
2476
- pt(d.plugins) ? (await R(u), _(r)) : Pe(u), _(r), f = C().then((p) => p.init(d)), t && g.set(t, f);
2477
- const l = await f;
2478
- if (r?.aborted && (l.destroy(), _(r)), t) if (g.get(t) === f) g.set(t, l);
2479
- else throw l.destroy(), _(r), I(r?.reason);
2480
- return l;
2481
- } catch (u) {
2482
- throw i(), s.cleanup(), t && f && g.get(t) === f && g.delete(t), u;
2842
+ await pe(), h(r);
2843
+ const c = typeof __useblocks__ < "u" ? __useblocks__ : void 0;
2844
+ tn(l.plugins) ? (await z(c), h(r)) : Ct(c), h(r), f = $().then((p) => p.init(l)), t && S.set(t, f);
2845
+ const u = await f;
2846
+ if (r?.aborted && (u.destroy(), h(r)), t) if (S.get(t) === f) S.set(t, u);
2847
+ else throw u.destroy(), h(r), T(r?.reason);
2848
+ return u;
2849
+ } catch (c) {
2850
+ throw i(), s.cleanup(), t && f && S.get(t) === f && S.delete(t), c;
2483
2851
  }
2484
2852
  }
2485
- async function yt(e) {
2486
- return (await C()).parseAMP(e);
2853
+ async function cn(e) {
2854
+ return (await $()).parseAMP(e);
2487
2855
  }
2488
- typeof window < "u" && Le(typeof __useblocks__ < "u" ? __useblocks__ : void 0), E.ELEMENT_DETACHED_ABORT_MESSAGE = k, E.SUPERSEDED_INIT_ABORT_MESSAGE = j, Object.defineProperty(E, "errors", {
2856
+ typeof window < "u" && Pt(typeof __useblocks__ < "u" ? __useblocks__ : void 0), E.ELEMENT_DETACHED_ABORT_MESSAGE = re, E.SUPERSEDED_INIT_ABORT_MESSAGE = ne, Object.defineProperty(E, "errors", {
2489
2857
  enumerable: !0,
2490
2858
  get: function() {
2491
- return at;
2859
+ return zr;
2492
2860
  }
2493
2861
  }), Object.defineProperty(E, "helpers", {
2494
2862
  enumerable: !0,
2495
2863
  get: function() {
2496
- return ut;
2864
+ return Yr;
2497
2865
  }
2498
- }), E.init = ht, E.isElementDetachedError = oe, E.isSupersededInitError = se, E.parseAMP = yt, E.pluginRegistry = ke, E.preload = Et, E.version = _t;
2866
+ }), E.init = on, E.isElementDetachedError = it, E.isSupersededInitError = at, E.parseAMP = cn, E.pluginRegistry = Mt, E.preload = nn, E.version = rn;
2499
2867
  });
2500
2868
 
2501
2869