@cartridge/controller 0.13.10 → 0.13.11-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { WalletAccount as Sn, constants as ge, num as Bt, shortString as ft } from "starknet";
2
- import { R, t as $n, K as Ut, A as Mt, I as Ln, B as _n, N as $, H as ue, p as In, v as Pn, s as Rt } from "./index-C7KGk-LM.js";
3
- import { c as Ni, i as Bi, E as Ui, k as Mi, j as Ri, F as Oi, b as Fi, a as zi, l as ji, m as Hi, o as Wi, q as qi, g as Vi, h as Di, r as Zi, u as Ki, n as Xi, f as Gi, d as Yi, e as Ji } from "./index-C7KGk-LM.js";
2
+ import { R, t as $n, K as Ut, A as Mt, I as Ln, B as _n, N as $, H as ue, p as In, v as Pn, s as Rt } from "./index-hg9K2M84.js";
3
+ import { c as Ni, i as Bi, E as Ui, k as Mi, j as Ri, F as Oi, b as Fi, a as zi, l as ji, m as Hi, o as Wi, q as qi, g as Vi, h as Di, r as Zi, u as Ki, n as Xi, f as Gi, d as Yi, e as Ji } from "./index-hg9K2M84.js";
4
4
  const Tn = "standard:connect", Nn = "standard:disconnect", Bn = "standard:events", Un = "0.1.1";
5
5
  function Mn() {
6
6
  return Un;
@@ -249,9 +249,9 @@ function dr(t, e = {}) {
249
249
  if (typeof t != "string")
250
250
  throw new bt(t);
251
251
  if (n && !/^0x[0-9a-fA-F]*$/.test(t))
252
- throw new xt(t);
252
+ throw new kt(t);
253
253
  if (!t.startsWith("0x"))
254
- throw new xt(t);
254
+ throw new kt(t);
255
255
  }
256
256
  function Vt(t, e = {}) {
257
257
  const { strict: n = !1 } = e;
@@ -273,7 +273,7 @@ class bt extends ie {
273
273
  });
274
274
  }
275
275
  }
276
- class xt extends ie {
276
+ class kt extends ie {
277
277
  constructor(e) {
278
278
  super(`Value \`${e}\` is an invalid hex value.`, {
279
279
  metaMessages: [
@@ -590,7 +590,7 @@ const gr = (t, e) => {
590
590
  }, yr = {
591
591
  "http:": "80",
592
592
  "https:": "443"
593
- }, Cr = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, br = ["file:", "data:"], xr = (t) => {
593
+ }, Cr = /^(https?:)?\/\/([^/:]+)?(:(\d+))?/, br = ["file:", "data:"], kr = (t) => {
594
594
  if (t && br.find((a) => t.startsWith(a)))
595
595
  return "null";
596
596
  const e = document.location, n = Cr.exec(t);
@@ -598,11 +598,11 @@ const gr = (t, e) => {
598
598
  n ? (r = n[1] ? n[1] : e.protocol, s = n[2], i = n[4]) : (r = e.protocol, s = e.hostname, i = e.port);
599
599
  const o = i && i !== yr[r] ? `:${i}` : "";
600
600
  return `${r}//${s}${o}`;
601
- }, kt = ({ name: t, message: e, stack: n }) => ({
601
+ }, xt = ({ name: t, message: e, stack: n }) => ({
602
602
  name: t,
603
603
  message: e,
604
604
  stack: n
605
- }), kr = (t) => {
605
+ }), xr = (t) => {
606
606
  const e = new Error();
607
607
  return Object.keys(t).forEach((n) => e[n] = t[n]), e;
608
608
  }, vr = (t, e, n) => {
@@ -628,7 +628,7 @@ const gr = (t, e) => {
628
628
  resolution: m,
629
629
  returnValue: T
630
630
  };
631
- m === q.Rejected && T instanceof Error && (b.returnValue = kt(T), b.returnValueIsError = !0);
631
+ m === q.Rejected && T instanceof Error && (b.returnValue = xt(T), b.returnValueIsError = !0);
632
632
  try {
633
633
  i.postMessage(b, o);
634
634
  } catch (g) {
@@ -637,7 +637,7 @@ const gr = (t, e) => {
637
637
  penpal: O.Reply,
638
638
  id: w,
639
639
  resolution: q.Rejected,
640
- returnValue: kt(g),
640
+ returnValue: xt(g),
641
641
  returnValueIsError: !0
642
642
  };
643
643
  i.postMessage(S, o);
@@ -693,10 +693,10 @@ const Ar = () => ++Er, Qt = ".", en = (t) => t ? t.split(Qt) : [], Sr = (t) => t
693
693
  s(`${i} received message from origin ${_.origin} which did not match expected origin ${c}`);
694
694
  return;
695
695
  }
696
- const x = _.data;
696
+ const k = _.data;
697
697
  s(`${i}: Received ${f}() reply`), o.removeEventListener(H.Message, g);
698
- let X = x.returnValue;
699
- x.returnValueIsError && (X = kr(X)), (x.resolution === q.Fulfilled ? m : T)(X);
698
+ let X = k.returnValue;
699
+ k.returnValueIsError && (X = xr(X)), (k.resolution === q.Fulfilled ? m : T)(X);
700
700
  };
701
701
  o.addEventListener(H.Message, g);
702
702
  const S = {
@@ -770,7 +770,7 @@ const Ar = () => ++Er, Qt = ".", en = (t) => t ? t.split(Qt) : [], Sr = (t) => t
770
770
  }, Rr = (t) => {
771
771
  let { iframe: e, methods: n = {}, childOrigin: r, timeout: s, debug: i = !1 } = t;
772
772
  const o = mr(i), a = gr("Parent", o), { onDestroy: l, destroy: c } = a;
773
- r || (Mr(e), r = xr(e.src));
773
+ r || (Mr(e), r = kr(e.src));
774
774
  const d = r === "null" ? "*" : r, h = tn(n), u = Tr(o, h, r, d), f = Pr(h, r, d, a, o);
775
775
  return {
776
776
  promise: new Promise((C, m) => {
@@ -1606,7 +1606,7 @@ function be(t) {
1606
1606
  if (!Array.isArray(t))
1607
1607
  throw new Error("array expected");
1608
1608
  }
1609
- function xe(t, e) {
1609
+ function ke(t, e) {
1610
1610
  if (!cn(!0, e))
1611
1611
  throw new Error(`${t}: array of strings expected`);
1612
1612
  }
@@ -1622,7 +1622,7 @@ function it(...t) {
1622
1622
  // @__NO_SIDE_EFFECTS__
1623
1623
  function ot(t) {
1624
1624
  const e = typeof t == "string" ? t.split("") : t, n = e.length;
1625
- xe("alphabet", e);
1625
+ ke("alphabet", e);
1626
1626
  const r = new Map(e.map((s, i) => [s, i]));
1627
1627
  return {
1628
1628
  encode: (s) => (be(s), s.map((i) => {
@@ -1642,7 +1642,7 @@ function ot(t) {
1642
1642
  // @__NO_SIDE_EFFECTS__
1643
1643
  function at(t = "") {
1644
1644
  return Q("join", t), {
1645
- encode: (e) => (xe("join.decode", e), e.join(t)),
1645
+ encode: (e) => (ke("join.decode", e), e.join(t)),
1646
1646
  decode: (e) => (Q("join.decode", e), e.split(t))
1647
1647
  };
1648
1648
  }
@@ -1650,12 +1650,12 @@ function at(t = "") {
1650
1650
  function os(t, e = "=") {
1651
1651
  return le(t), Q("padding", e), {
1652
1652
  encode(n) {
1653
- for (xe("padding.encode", n); n.length * t % 8; )
1653
+ for (ke("padding.encode", n); n.length * t % 8; )
1654
1654
  n.push(e);
1655
1655
  return n;
1656
1656
  },
1657
1657
  decode(n) {
1658
- xe("padding.decode", n);
1658
+ ke("padding.decode", n);
1659
1659
  let r = n.length;
1660
1660
  if (r * t % 8)
1661
1661
  throw new Error("padding: invalid, string should have whole number of bytes");
@@ -1705,7 +1705,7 @@ function $t(t, e, n) {
1705
1705
  s.push(0);
1706
1706
  return s.reverse();
1707
1707
  }
1708
- const dn = (t, e) => e === 0 ? t : dn(e, t % e), ke = /* @__NO_SIDE_EFFECTS__ */ (t, e) => t + (e - dn(t, e)), Te = /* @__PURE__ */ (() => {
1708
+ const dn = (t, e) => e === 0 ? t : dn(e, t % e), xe = /* @__NO_SIDE_EFFECTS__ */ (t, e) => t + (e - dn(t, e)), Te = /* @__PURE__ */ (() => {
1709
1709
  let t = [];
1710
1710
  for (let e = 0; e < 40; e++)
1711
1711
  t.push(2 ** e);
@@ -1716,8 +1716,8 @@ function Lt(t, e, n, r) {
1716
1716
  throw new Error(`convertRadix2: wrong from=${e}`);
1717
1717
  if (n <= 0 || n > 32)
1718
1718
  throw new Error(`convertRadix2: wrong to=${n}`);
1719
- if (/* @__PURE__ */ ke(e, n) > 32)
1720
- throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${/* @__PURE__ */ ke(e, n)}`);
1719
+ if (/* @__PURE__ */ xe(e, n) > 32)
1720
+ throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${/* @__PURE__ */ xe(e, n)}`);
1721
1721
  let s = 0, i = 0;
1722
1722
  const o = Te[e], a = Te[n] - 1, l = [];
1723
1723
  for (const c of t) {
@@ -1755,7 +1755,7 @@ function cs(t) {
1755
1755
  function hn(t, e = !1) {
1756
1756
  if (le(t), t <= 0 || t > 32)
1757
1757
  throw new Error("radix2: bits should be in (0..32]");
1758
- if (/* @__PURE__ */ ke(8, t) > 32 || /* @__PURE__ */ ke(t, 8) > 32)
1758
+ if (/* @__PURE__ */ xe(8, t) > 32 || /* @__PURE__ */ xe(t, 8) > 32)
1759
1759
  throw new Error("radix2: carry overflow");
1760
1760
  return {
1761
1761
  encode: (n) => {
@@ -2253,7 +2253,7 @@ function bs(t, e = !1) {
2253
2253
  }
2254
2254
  };
2255
2255
  }
2256
- function xs(t) {
2256
+ function ks(t) {
2257
2257
  if (!Array.isArray(t))
2258
2258
  throw new Error(`expected array, got ${typeof t}`);
2259
2259
  for (const e of t)
@@ -2278,11 +2278,11 @@ function xs(t) {
2278
2278
  }
2279
2279
  };
2280
2280
  }
2281
- const ks = (t) => {
2281
+ const xs = (t) => {
2282
2282
  if (!Se(t))
2283
2283
  throw new Error("BaseCoder expected");
2284
2284
  return { encode: t.decode, decode: t.encode };
2285
- }, ne = { dict: ms, numberBigint: ys, tsEnum: Cs, decimal: bs, match: xs, reverse: ks }, vs = (t, e = !1, n = !1, r = !0) => {
2285
+ }, ne = { dict: ms, numberBigint: ys, tsEnum: Cs, decimal: bs, match: ks, reverse: xs }, vs = (t, e = !1, n = !1, r = !0) => {
2286
2286
  if (!M(t))
2287
2287
  throw new Error(`bigint/size: wrong value ${t}`);
2288
2288
  if (typeof e != "boolean")
@@ -2883,8 +2883,8 @@ const Ms = lt(N, {
2883
2883
  FreezeAccount: 1,
2884
2884
  AccountOwner: 2,
2885
2885
  CloseAccount: 3
2886
- }), W = (t, e) => e[t]?.symbol || t, xn = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
2887
- dt(xn, N, {
2886
+ }), W = (t, e) => e[t]?.symbol || t, kn = "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA";
2887
+ dt(kn, N, {
2888
2888
  initializeMint: {
2889
2889
  coder: p({
2890
2890
  decimals: N,
@@ -3066,7 +3066,7 @@ dt(Rs, $s(0), {
3066
3066
  wallet: { sign: !1, write: !1 },
3067
3067
  mint: { sign: !1, write: !1 },
3068
3068
  _sys: { address: yn, sign: !1, write: !1 },
3069
- _token: { address: xn, sign: !1, write: !1 },
3069
+ _token: { address: kn, sign: !1, write: !1 },
3070
3070
  _rent: { address: V, sign: !1, write: !1 }
3071
3071
  },
3072
3072
  hint: (t, e) => `Initialize associated token account=${t.account} with owner=${t.wallet} for token=${W(t.mint, e)}, payed by ${t.source}`
@@ -3674,19 +3674,19 @@ class Ds extends jr {
3674
3674
  ...S
3675
3675
  }) {
3676
3676
  let _;
3677
- const x = new URL(e ?? Ut), X = new qs();
3678
- T && x.searchParams.set("propagate_error", "true"), b && x.searchParams.set("error_display_mode", b), r && x.searchParams.set("v", encodeURIComponent(r)), s && x.searchParams.set("ps", encodeURIComponent(s)), i && x.searchParams.set("ns", encodeURIComponent(i)), o?.erc20 && x.searchParams.set(
3677
+ const k = new URL(e ?? Ut), X = new qs();
3678
+ T && k.searchParams.set("propagate_error", "true"), b && k.searchParams.set("error_display_mode", b), r && k.searchParams.set("v", encodeURIComponent(r)), s && k.searchParams.set("ps", encodeURIComponent(s)), i && k.searchParams.set("ns", encodeURIComponent(i)), o?.erc20 && k.searchParams.set(
3679
3679
  "erc20",
3680
3680
  encodeURIComponent(o.erc20.toString())
3681
- ), c && x.searchParams.set("rpc_url", encodeURIComponent(c)), d && x.searchParams.set("ref", encodeURIComponent(d)), h && x.searchParams.set("ref_group", encodeURIComponent(h)), u && x.searchParams.set("needs_session_creation", "true"), f && x.searchParams.set("username", encodeURIComponent(f)), a && x.searchParams.set("preset", a), l && x.searchParams.set("should_override_preset_policies", "true"), g && x.searchParams.set("webauthn_popup", "true"), (!a || l) && n ? x.searchParams.set(
3681
+ ), c && k.searchParams.set("rpc_url", encodeURIComponent(c)), d && k.searchParams.set("ref", encodeURIComponent(d)), h && k.searchParams.set("ref_group", encodeURIComponent(h)), u && k.searchParams.set("needs_session_creation", "true"), f && k.searchParams.set("username", encodeURIComponent(f)), a && k.searchParams.set("preset", a), l && k.searchParams.set("should_override_preset_policies", "true"), g && k.searchParams.set("webauthn_popup", "true"), (!a || l) && n ? k.searchParams.set(
3682
3682
  "policies",
3683
3683
  encodeURIComponent(JSON.stringify(n))
3684
3684
  ) : a && n && console.warn(
3685
3685
  "[Controller] Both `preset` and `policies` provided to ControllerProvider. Policies are ignored when preset is set. Use `shouldOverridePresetPolicies: true` to override."
3686
- ), m && (x.hash = `kc=${encodeURIComponent(m)}`), super({
3686
+ ), m && (k.hash = `kc=${encodeURIComponent(m)}`), super({
3687
3687
  ...S,
3688
3688
  id: "controller-keychain",
3689
- url: x,
3689
+ url: k,
3690
3690
  methods: {
3691
3691
  ...X.getIFrameMethods(),
3692
3692
  // Expose callback for keychain to notify parent that session was created and storage access granted
@@ -3718,7 +3718,7 @@ class Ds extends jr {
3718
3718
  }
3719
3719
  }
3720
3720
  const Y = /* @__PURE__ */ new Map(), Zs = `${Mt}/query`;
3721
- async function kn(t) {
3721
+ async function xn(t) {
3722
3722
  if (!t.addresses?.length && !t.usernames?.length)
3723
3723
  return { results: [] };
3724
3724
  const e = await fetch(`${Mt}/lookup`, {
@@ -3783,10 +3783,13 @@ const vn = [
3783
3783
  "discord",
3784
3784
  "walletconnect",
3785
3785
  "password",
3786
+ "sms",
3786
3787
  "metamask",
3787
3788
  "rabby",
3788
3789
  "phantom-evm"
3789
- ].filter((t) => Ln.includes(t));
3790
+ ].filter(
3791
+ (t) => Ln.includes(t)
3792
+ );
3790
3793
  function Gs(t, e) {
3791
3794
  if (!t || t.length === 0)
3792
3795
  return [];
@@ -3833,7 +3836,7 @@ async function Ys(t, e) {
3833
3836
  }
3834
3837
  async function Li(t) {
3835
3838
  const e = t.filter((n) => !Y.has(n));
3836
- return e.length > 0 && (await kn({ usernames: e })).results.forEach((r) => {
3839
+ return e.length > 0 && (await xn({ usernames: e })).results.forEach((r) => {
3837
3840
  Y.set(r.username, r.addresses[0]);
3838
3841
  }), new Map(
3839
3842
  t.map((n) => [n, Y.get(n)]).filter((n) => n[1] !== void 0)
@@ -3842,7 +3845,7 @@ async function Li(t) {
3842
3845
  async function _i(t) {
3843
3846
  t = t.map(Bt.toHex);
3844
3847
  const e = t.filter((n) => !Y.has(n));
3845
- return e.length > 0 && (await kn({
3848
+ return e.length > 0 && (await xn({
3846
3849
  addresses: e
3847
3850
  })).results.forEach((r) => {
3848
3851
  Y.set(r.addresses[0], r.username);
@@ -4055,7 +4058,7 @@ class Ii extends _n {
4055
4058
  return Promise.resolve(!0);
4056
4059
  }
4057
4060
  async disconnect() {
4058
- this.account = void 0, this.emitAccountsChanged([]);
4061
+ this.account = void 0;
4059
4062
  try {
4060
4063
  if (typeof localStorage < "u") {
4061
4064
  localStorage.removeItem("lastUsedConnector");
@@ -4070,7 +4073,7 @@ class Ii extends _n {
4070
4073
  console.error(new $().message);
4071
4074
  return;
4072
4075
  }
4073
- return await this.keychain.disconnect(), this.close();
4076
+ await this.keychain.disconnect(), this.close(), this.emitAccountsChanged([]);
4074
4077
  }
4075
4078
  async openProfile(e = "inventory") {
4076
4079
  if (!this.iframes)
@@ -4192,6 +4195,18 @@ class Ii extends _n {
4192
4195
  });
4193
4196
  }
4194
4197
  }
4198
+ async openBundle(e, n, r) {
4199
+ if (!this.iframes)
4200
+ return;
4201
+ if (!this.keychain || !this.iframes.keychain) {
4202
+ console.error(new $().message);
4203
+ return;
4204
+ }
4205
+ const { onPurchaseComplete: s, ...i } = r ?? {};
4206
+ this.iframes.keychain.setOnStarterpackPlay(s);
4207
+ const o = Object.keys(i).length > 0 ? i : void 0;
4208
+ await this.keychain.openBundle(e, n, o), this.iframes.keychain?.open();
4209
+ }
4195
4210
  async openStarterPack(e, n) {
4196
4211
  if (!this.iframes)
4197
4212
  return;
@@ -4336,7 +4351,7 @@ class Ii extends _n {
4336
4351
  });
4337
4352
  }
4338
4353
  }
4339
- const k = "cartridge-toast-container", Qs = 3e3, ei = "bottom-right", En = "cartridge-toast-show";
4354
+ const x = "cartridge-toast-container", Qs = 3e3, ei = "bottom-right", En = "cartridge-toast-show";
4340
4355
  function ut() {
4341
4356
  try {
4342
4357
  return typeof window < "u" && window.self !== window.top;
@@ -4357,8 +4372,8 @@ function ti() {
4357
4372
  return document;
4358
4373
  }
4359
4374
  function ni(t, e) {
4360
- let n = t.getElementById(k);
4361
- return n || (n = t.createElement("div"), n.id = k, t.body && t.body.appendChild(n)), n.className = e, n;
4375
+ let n = t.getElementById(x);
4376
+ return n || (n = t.createElement("div"), n.id = x, t.body && t.body.appendChild(n)), n.className = e, n;
4362
4377
  }
4363
4378
  function ri(t) {
4364
4379
  t.classList.add("closing"), setTimeout(() => {
@@ -4373,7 +4388,7 @@ function si(t) {
4373
4388
  }
4374
4389
  function ii() {
4375
4390
  return `
4376
- #${k} {
4391
+ #${x} {
4377
4392
  position: fixed;
4378
4393
  z-index: 999999;
4379
4394
  pointer-events: none;
@@ -4383,38 +4398,38 @@ function ii() {
4383
4398
  gap: 12px;
4384
4399
  }
4385
4400
 
4386
- #${k}.top-left {
4401
+ #${x}.top-left {
4387
4402
  top: 20px;
4388
4403
  left: 20px;
4389
4404
  align-items: flex-start;
4390
4405
  }
4391
4406
 
4392
- #${k}.top-right {
4407
+ #${x}.top-right {
4393
4408
  top: 20px;
4394
4409
  right: 20px;
4395
4410
  align-items: flex-end;
4396
4411
  }
4397
4412
 
4398
- #${k}.top-center {
4413
+ #${x}.top-center {
4399
4414
  top: 20px;
4400
4415
  left: 50%;
4401
4416
  transform: translateX(-50%);
4402
4417
  align-items: center;
4403
4418
  }
4404
4419
 
4405
- #${k}.bottom-left {
4420
+ #${x}.bottom-left {
4406
4421
  bottom: 20px;
4407
4422
  left: 20px;
4408
4423
  align-items: flex-start;
4409
4424
  }
4410
4425
 
4411
- #${k}.bottom-right {
4426
+ #${x}.bottom-right {
4412
4427
  bottom: 20px;
4413
4428
  right: 20px;
4414
4429
  align-items: flex-end;
4415
4430
  }
4416
4431
 
4417
- #${k}.bottom-center {
4432
+ #${x}.bottom-center {
4418
4433
  bottom: 20px;
4419
4434
  left: 50%;
4420
4435
  transform: translateX(-50%);
@@ -4430,18 +4445,18 @@ function ii() {
4430
4445
  pointer-events: auto;
4431
4446
  }
4432
4447
 
4433
- #${k}.top-right .cartridge-toast,
4434
- #${k}.bottom-right .cartridge-toast {
4448
+ #${x}.top-right .cartridge-toast,
4449
+ #${x}.bottom-right .cartridge-toast {
4435
4450
  align-self: flex-end;
4436
4451
  }
4437
4452
 
4438
- #${k}.top-left .cartridge-toast,
4439
- #${k}.bottom-left .cartridge-toast {
4453
+ #${x}.top-left .cartridge-toast,
4454
+ #${x}.bottom-left .cartridge-toast {
4440
4455
  align-self: flex-start;
4441
4456
  }
4442
4457
 
4443
- #${k}.top-center .cartridge-toast,
4444
- #${k}.bottom-center .cartridge-toast {
4458
+ #${x}.top-center .cartridge-toast,
4459
+ #${x}.bottom-center .cartridge-toast {
4445
4460
  align-self: center;
4446
4461
  }
4447
4462
 
@@ -4477,9 +4492,9 @@ function ii() {
4477
4492
  max-width: calc(100vw - 40px);
4478
4493
  }
4479
4494
 
4480
- #${k}.top-left,
4481
- #${k}.top-right,
4482
- #${k}.top-center {
4495
+ #${x}.top-left,
4496
+ #${x}.top-right,
4497
+ #${x}.top-center {
4483
4498
  top: 10px;
4484
4499
  left: 20px;
4485
4500
  right: 20px;
@@ -4487,9 +4502,9 @@ function ii() {
4487
4502
  align-items: stretch;
4488
4503
  }
4489
4504
 
4490
- #${k}.bottom-left,
4491
- #${k}.bottom-right,
4492
- #${k}.bottom-center {
4505
+ #${x}.bottom-left,
4506
+ #${x}.bottom-right,
4507
+ #${x}.bottom-center {
4493
4508
  bottom: 10px;
4494
4509
  left: 20px;
4495
4510
  right: 20px;
@@ -5278,7 +5293,7 @@ function Ci(t) {
5278
5293
  const bi = () => {
5279
5294
  const t = document.createElement("div"), e = document.createElementNS("http://www.w3.org/2000/svg", "svg");
5280
5295
  return e.setAttribute("width", "34"), e.setAttribute("height", "34"), e.setAttribute("viewBox", "0 0 30 30"), e.style.width = "100%", e.style.height = "100%", e.innerHTML = '<path d="M3 6.5V8C3 8.55312 3.44687 9 4 9H4.5H6V6.5C6 5.67188 5.32812 5 4.5 5C3.67188 5 3 5.67188 3 6.5ZM6.5 5C6.8125 5.41875 7 5.9375 7 6.5V16C7 17.1031 7.89687 18 9 18C10.1031 18 11 17.1031 11 16V15.8344C11 14.8219 11.8219 14 12.8344 14H18V8C18 6.34375 16.6562 5 15 5H6.5ZM17.5 19C19.4344 19 21 17.4344 21 15.5C21 15.225 20.775 15 20.5 15H12.8344C12.375 15 12 15.3719 12 15.8344V16C12 17.6562 10.6562 19 9 19H14.5H17.5Z" fill="white"/>', t.appendChild(e), t;
5281
- }, xi = (t) => {
5296
+ }, ki = (t) => {
5282
5297
  const e = t.borderRadius ?? 8, n = !isFinite(t.duration) || t.duration <= 0, r = document.createElement("div");
5283
5298
  r.className = "cartridge-toast-progress-bar", r.style.position = "absolute", r.style.bottom = "0", r.style.left = "0", r.style.right = "0", r.style.height = "4px", r.style.overflow = "hidden", r.style.borderBottomLeftRadius = `${e}px`, r.style.borderBottomRightRadius = `${e}px`, r.style.backgroundColor = "rgba(255, 255, 255, 0.2)";
5284
5299
  const s = document.createElement("div");
@@ -5291,14 +5306,14 @@ const bi = () => {
5291
5306
  }, t.duration)), r.appendChild(s), r;
5292
5307
  };
5293
5308
  function Tt(t, e, n, r) {
5294
- const s = xi({
5309
+ const s = ki({
5295
5310
  duration: e,
5296
5311
  onComplete: n,
5297
5312
  borderRadius: r
5298
5313
  });
5299
5314
  t.appendChild(s);
5300
5315
  }
5301
- function ki(t) {
5316
+ function xi(t) {
5302
5317
  switch (t.variant) {
5303
5318
  case "error":
5304
5319
  return ai(t);
@@ -5338,7 +5353,7 @@ function vi(t, e) {
5338
5353
  }
5339
5354
  function Ye(t, e) {
5340
5355
  si(t), vi(t, e.variant);
5341
- const n = e.position || ei, r = ni(t, n), s = ki(e), i = () => ri(s);
5356
+ const n = e.position || ei, r = ni(t, n), s = xi(e), i = () => ri(s);
5342
5357
  r.appendChild(s), e.onClick && (s.style.cursor = "pointer", s.addEventListener("click", (d) => {
5343
5358
  !d.target.closest("#close-button") && e.onClick && e.onClick();
5344
5359
  }));