@tonconnect/ui-react 0.0.4 → 0.0.6

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/lib/index.js CHANGED
@@ -26,7 +26,7 @@ var __objRest = (source, exclude) => {
26
26
  }
27
27
  return target;
28
28
  };
29
- import require$$0$2, { createContext as createContext$1, memo as memo$1, useContext as useContext$1, useEffect, useState } from "react";
29
+ import require$$0$2, { createContext as createContext$1, memo, useContext as useContext$1, useEffect, useState } from "react";
30
30
  var commonjsGlobal$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
31
31
  function getAugmentedNamespace$1(n2) {
32
32
  var f = n2.default;
@@ -4218,7 +4218,8 @@ var __awaiter$3 = globalThis && globalThis.__awaiter || function(thisArg, _argum
4218
4218
  });
4219
4219
  };
4220
4220
  class InjectedProvider {
4221
- constructor(injectedWalletKey) {
4221
+ constructor(storage, injectedWalletKey) {
4222
+ this.injectedWalletKey = injectedWalletKey;
4222
4223
  this.type = "injected";
4223
4224
  this.unsubscribeCallback = null;
4224
4225
  this.listenSubscriptions = false;
@@ -4227,13 +4228,14 @@ class InjectedProvider {
4227
4228
  if (!InjectedProvider.isWindowContainsWallet(window2, injectedWalletKey)) {
4228
4229
  throw new WalletNotInjectedError();
4229
4230
  }
4231
+ this.connectionStorage = new BridgeConnectionStorage(storage);
4230
4232
  this.injectedWallet = window2[injectedWalletKey].tonconnect;
4231
4233
  }
4232
4234
  static fromStorage(storage) {
4233
4235
  return __awaiter$3(this, void 0, void 0, function* () {
4234
4236
  const bridgeConnectionStorage = new BridgeConnectionStorage(storage);
4235
4237
  const connection = yield bridgeConnectionStorage.getInjectedConnection();
4236
- return new InjectedProvider(connection.jsBridgeKey);
4238
+ return new InjectedProvider(storage, connection.jsBridgeKey);
4237
4239
  });
4238
4240
  }
4239
4241
  static isWalletInjected(injectedWalletKey) {
@@ -4248,23 +4250,8 @@ class InjectedProvider {
4248
4250
  static isWindowContainsWallet(window2, injectedWalletKey) {
4249
4251
  return !!window2 && injectedWalletKey in window2 && typeof window2[injectedWalletKey] === "object" && "tonconnect" in window2[injectedWalletKey];
4250
4252
  }
4251
- connect(message, auto = false) {
4252
- this.injectedWallet.connect(PROTOCOL_VERSION, message, auto).then((connectEvent) => {
4253
- if (connectEvent.event === "connect") {
4254
- this.makeSubscriptions();
4255
- this.listenSubscriptions = true;
4256
- }
4257
- this.listeners.forEach((listener) => listener(connectEvent));
4258
- }).catch((e2) => {
4259
- const connectEventError = {
4260
- event: "connect_error",
4261
- payload: {
4262
- code: 0,
4263
- message: e2 === null || e2 === void 0 ? void 0 : e2.toString()
4264
- }
4265
- };
4266
- this.listeners.forEach((listener) => listener(connectEventError));
4267
- });
4253
+ connect(message) {
4254
+ this._connect(PROTOCOL_VERSION, message);
4268
4255
  }
4269
4256
  restoreConnection() {
4270
4257
  return __awaiter$3(this, void 0, void 0, function* () {
@@ -4272,10 +4259,12 @@ class InjectedProvider {
4272
4259
  const connectEvent = yield this.injectedWallet.restoreConnection();
4273
4260
  if (connectEvent.event === "connect") {
4274
4261
  this.makeSubscriptions();
4275
- this.listenSubscriptions = true;
4276
4262
  this.listeners.forEach((listener) => listener(connectEvent));
4263
+ } else {
4264
+ yield this.connectionStorage.removeConnection();
4277
4265
  }
4278
4266
  } catch (e2) {
4267
+ yield this.connectionStorage.removeConnection();
4279
4268
  console.error(e2);
4280
4269
  }
4281
4270
  });
@@ -4289,7 +4278,7 @@ class InjectedProvider {
4289
4278
  disconnect() {
4290
4279
  this.closeAllListeners();
4291
4280
  this.injectedWallet.disconnect();
4292
- return Promise.resolve();
4281
+ return this.connectionStorage.removeConnection();
4293
4282
  }
4294
4283
  closeAllListeners() {
4295
4284
  var _a;
@@ -4306,7 +4295,30 @@ class InjectedProvider {
4306
4295
  return this.injectedWallet.send(Object.assign(Object.assign({}, request), { id: "0" }));
4307
4296
  });
4308
4297
  }
4298
+ _connect(protocolVersion, message) {
4299
+ return __awaiter$3(this, void 0, void 0, function* () {
4300
+ try {
4301
+ const connectEvent = yield this.injectedWallet.connect(protocolVersion, message);
4302
+ if (connectEvent.event === "connect") {
4303
+ yield this.updateSession();
4304
+ this.makeSubscriptions();
4305
+ }
4306
+ this.listeners.forEach((listener) => listener(connectEvent));
4307
+ } catch (e2) {
4308
+ console.debug(e2);
4309
+ const connectEventError = {
4310
+ event: "connect_error",
4311
+ payload: {
4312
+ code: 0,
4313
+ message: e2 === null || e2 === void 0 ? void 0 : e2.toString()
4314
+ }
4315
+ };
4316
+ this.listeners.forEach((listener) => listener(connectEventError));
4317
+ }
4318
+ });
4319
+ }
4309
4320
  makeSubscriptions() {
4321
+ this.listenSubscriptions = true;
4310
4322
  this.unsubscribeCallback = this.injectedWallet.listen((e2) => {
4311
4323
  if (this.listenSubscriptions) {
4312
4324
  this.listeners.forEach((listener) => listener(e2));
@@ -4316,6 +4328,12 @@ class InjectedProvider {
4316
4328
  }
4317
4329
  });
4318
4330
  }
4331
+ updateSession() {
4332
+ return this.connectionStorage.storeConnection({
4333
+ type: "injected",
4334
+ jsBridgeKey: this.injectedWalletKey
4335
+ });
4336
+ }
4319
4337
  }
4320
4338
  InjectedProvider.window = getWindow$1();
4321
4339
  var __awaiter$2 = globalThis && globalThis.__awaiter || function(thisArg, _arguments, P2, generator) {
@@ -4400,9 +4418,12 @@ var __awaiter$1 = globalThis && globalThis.__awaiter || function(thisArg, _argum
4400
4418
  });
4401
4419
  };
4402
4420
  class WalletsListManager {
4403
- constructor() {
4421
+ constructor(walletsListSource) {
4404
4422
  this.walletsListCache = null;
4405
4423
  this.walletsListSource = "https://raw.githubusercontent.com/ton-connect/wallets-list/main/wallets.json";
4424
+ if (walletsListSource) {
4425
+ this.walletsListSource = walletsListSource;
4426
+ }
4406
4427
  }
4407
4428
  getWallets() {
4408
4429
  return __awaiter$1(this, void 0, void 0, function* () {
@@ -4416,11 +4437,11 @@ class WalletsListManager {
4416
4437
  getEmbeddedWallet() {
4417
4438
  return __awaiter$1(this, void 0, void 0, function* () {
4418
4439
  const walletsList = yield this.getWallets();
4419
- const injectedWallets = walletsList.filter(isWalletInfoInjected);
4420
- if (injectedWallets.length !== 1) {
4440
+ const embeddedWallets = walletsList.filter((item) => isWalletInfoInjected(item) && item.embedded);
4441
+ if (embeddedWallets.length !== 1) {
4421
4442
  return null;
4422
4443
  }
4423
- return injectedWallets[0].embedded ? injectedWallets[0] : null;
4444
+ return embeddedWallets[0];
4424
4445
  });
4425
4446
  }
4426
4447
  fetchWalletsList() {
@@ -4543,6 +4564,7 @@ class TonConnect {
4543
4564
  manifestUrl: (options === null || options === void 0 ? void 0 : options.manifestUrl) || getWebPageManifest(),
4544
4565
  storage: (options === null || options === void 0 ? void 0 : options.storage) || new DefaultStorage()
4545
4566
  };
4567
+ this.walletsList = new WalletsListManager(options === null || options === void 0 ? void 0 : options.walletsListSource);
4546
4568
  if (!this.dappSettings.manifestUrl) {
4547
4569
  throw new DappMetadataError("Dapp tonconnect-manifest.json must be specified if window.location.origin is undefined. See more https://github.com/ton-connect/docs/blob/main/requests-responses.md#app-manifest");
4548
4570
  }
@@ -4637,7 +4659,7 @@ class TonConnect {
4637
4659
  createProvider(wallet) {
4638
4660
  let provider;
4639
4661
  if (isWalletConnectionSourceJS(wallet)) {
4640
- provider = new InjectedProvider(wallet.jsBridgeKey);
4662
+ provider = new InjectedProvider(this.dappSettings.storage, wallet.jsBridgeKey);
4641
4663
  } else {
4642
4664
  provider = new BridgeProvider(this.dappSettings.storage, wallet);
4643
4665
  }
@@ -4720,6 +4742,8 @@ class TonConnect {
4720
4742
  }
4721
4743
  }
4722
4744
  TonConnect.walletsList = new WalletsListManager();
4745
+ TonConnect.isWalletInjected = (walletJSKey) => InjectedProvider.isWalletInjected(walletJSKey);
4746
+ TonConnect.isInsideWalletBrowser = (walletJSKey) => InjectedProvider.isInsideWalletBrowser(walletJSKey);
4723
4747
  function toUserFriendlyAddress$1(hexAddress) {
4724
4748
  const { wc, hex } = parseHexAddress$1(hexAddress);
4725
4749
  const bounceableTag = 17;
@@ -4828,7 +4852,7 @@ let Updates = null;
4828
4852
  let Effects = null;
4829
4853
  let ExecCount = 0;
4830
4854
  function createRoot(fn, detachedOwner) {
4831
- const listener = Listener, owner = Owner, unowned = fn.length === 0, root = unowned && true ? UNOWNED : {
4855
+ const listener = Listener, owner = Owner, unowned = fn.length === 0, root = unowned ? UNOWNED : {
4832
4856
  owned: null,
4833
4857
  cleanups: null,
4834
4858
  context: null,
@@ -4924,8 +4948,8 @@ function createResource(pSource, pFetcher, pOptions) {
4924
4948
  runUpdates(() => {
4925
4949
  if (!err)
4926
4950
  setValue(() => v);
4927
- setError(err);
4928
4951
  setState(err ? "errored" : "ready");
4952
+ setError(err);
4929
4953
  for (const c2 of contexts.keys())
4930
4954
  c2.decrement();
4931
4955
  contexts.clear();
@@ -4964,7 +4988,7 @@ function createResource(pSource, pFetcher, pOptions) {
4964
4988
  refetching
4965
4989
  }));
4966
4990
  if (typeof p2 !== "object" || !(p2 && "then" in p2)) {
4967
- loadEnd(pr, p2);
4991
+ loadEnd(pr, p2, void 0, lookup2);
4968
4992
  return p2;
4969
4993
  }
4970
4994
  pr = p2;
@@ -4974,7 +4998,7 @@ function createResource(pSource, pFetcher, pOptions) {
4974
4998
  setState(resolved ? "refreshing" : "pending");
4975
4999
  trigger();
4976
5000
  }, false);
4977
- return p2.then((v) => loadEnd(p2, v, void 0, lookup2), (e2) => loadEnd(p2, void 0, castError(e2)));
5001
+ return p2.then((v) => loadEnd(p2, v, void 0, lookup2), (e2) => loadEnd(p2, void 0, castError(e2), lookup2));
4978
5002
  }
4979
5003
  Object.defineProperties(read, {
4980
5004
  state: {
@@ -5013,11 +5037,13 @@ function batch(fn) {
5013
5037
  return runUpdates(fn, false);
5014
5038
  }
5015
5039
  function untrack(fn) {
5016
- let result, listener = Listener;
5040
+ const listener = Listener;
5017
5041
  Listener = null;
5018
- result = fn();
5019
- Listener = listener;
5020
- return result;
5042
+ try {
5043
+ return fn();
5044
+ } finally {
5045
+ Listener = listener;
5046
+ }
5021
5047
  }
5022
5048
  function on(deps, fn, options) {
5023
5049
  const isArray = Array.isArray(deps);
@@ -5055,7 +5081,7 @@ function onCleanup(fn) {
5055
5081
  function getListener() {
5056
5082
  return Listener;
5057
5083
  }
5058
- function createContext(defaultValue) {
5084
+ function createContext(defaultValue, options) {
5059
5085
  const id = Symbol("context");
5060
5086
  return {
5061
5087
  id,
@@ -5353,7 +5379,7 @@ function resolveChildren(children2) {
5353
5379
  }
5354
5380
  return children2;
5355
5381
  }
5356
- function createProvider(id) {
5382
+ function createProvider(id, options) {
5357
5383
  return function provider(props) {
5358
5384
  let res;
5359
5385
  createRenderEffect(() => res = untrack(() => {
@@ -5361,7 +5387,7 @@ function createProvider(id) {
5361
5387
  [id]: props.value
5362
5388
  };
5363
5389
  return children(() => props.children);
5364
- }));
5390
+ }), void 0);
5365
5391
  return res;
5366
5392
  };
5367
5393
  }
@@ -5473,6 +5499,8 @@ const propTraps = {
5473
5499
  return _.get(property);
5474
5500
  },
5475
5501
  has(_, property) {
5502
+ if (property === $PROXY)
5503
+ return true;
5476
5504
  return _.has(property);
5477
5505
  },
5478
5506
  set: trueFn,
@@ -5493,68 +5521,116 @@ const propTraps = {
5493
5521
  }
5494
5522
  };
5495
5523
  function resolveSource(s2) {
5496
- return (s2 = typeof s2 === "function" ? s2() : s2) == null ? {} : s2;
5524
+ return !(s2 = typeof s2 === "function" ? s2() : s2) ? {} : s2;
5497
5525
  }
5498
5526
  function mergeProps(...sources) {
5499
- return new Proxy({
5500
- get(property) {
5501
- for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5502
- const v = resolveSource(sources[i2])[property];
5503
- if (v !== void 0)
5504
- return v;
5505
- }
5506
- },
5507
- has(property) {
5508
- for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5509
- if (property in resolveSource(sources[i2]))
5510
- return true;
5527
+ let proxy = false;
5528
+ for (let i2 = 0; i2 < sources.length; i2++) {
5529
+ const s2 = sources[i2];
5530
+ proxy = proxy || !!s2 && $PROXY in s2;
5531
+ sources[i2] = typeof s2 === "function" ? (proxy = true, createMemo(s2)) : s2;
5532
+ }
5533
+ if (proxy) {
5534
+ return new Proxy({
5535
+ get(property) {
5536
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5537
+ const v = resolveSource(sources[i2])[property];
5538
+ if (v !== void 0)
5539
+ return v;
5540
+ }
5541
+ },
5542
+ has(property) {
5543
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5544
+ if (property in resolveSource(sources[i2]))
5545
+ return true;
5546
+ }
5547
+ return false;
5548
+ },
5549
+ keys() {
5550
+ const keys = [];
5551
+ for (let i2 = 0; i2 < sources.length; i2++)
5552
+ keys.push(...Object.keys(resolveSource(sources[i2])));
5553
+ return [...new Set(keys)];
5554
+ }
5555
+ }, propTraps);
5556
+ }
5557
+ const target = {};
5558
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5559
+ if (sources[i2]) {
5560
+ const descriptors = Object.getOwnPropertyDescriptors(sources[i2]);
5561
+ for (const key in descriptors) {
5562
+ if (key in target)
5563
+ continue;
5564
+ Object.defineProperty(target, key, {
5565
+ enumerable: true,
5566
+ get() {
5567
+ for (let i3 = sources.length - 1; i3 >= 0; i3--) {
5568
+ const v = (sources[i3] || {})[key];
5569
+ if (v !== void 0)
5570
+ return v;
5571
+ }
5572
+ }
5573
+ });
5511
5574
  }
5512
- return false;
5513
- },
5514
- keys() {
5515
- const keys = [];
5516
- for (let i2 = 0; i2 < sources.length; i2++)
5517
- keys.push(...Object.keys(resolveSource(sources[i2])));
5518
- return [...new Set(keys)];
5519
5575
  }
5520
- }, propTraps);
5576
+ }
5577
+ return target;
5521
5578
  }
5522
5579
  function splitProps(props, ...keys) {
5523
5580
  const blocked = new Set(keys.flat());
5581
+ if ($PROXY in props) {
5582
+ const res = keys.map((k) => {
5583
+ return new Proxy({
5584
+ get(property) {
5585
+ return k.includes(property) ? props[property] : void 0;
5586
+ },
5587
+ has(property) {
5588
+ return k.includes(property) && property in props;
5589
+ },
5590
+ keys() {
5591
+ return k.filter((property) => property in props);
5592
+ }
5593
+ }, propTraps);
5594
+ });
5595
+ res.push(new Proxy({
5596
+ get(property) {
5597
+ return blocked.has(property) ? void 0 : props[property];
5598
+ },
5599
+ has(property) {
5600
+ return blocked.has(property) ? false : property in props;
5601
+ },
5602
+ keys() {
5603
+ return Object.keys(props).filter((k) => !blocked.has(k));
5604
+ }
5605
+ }, propTraps));
5606
+ return res;
5607
+ }
5524
5608
  const descriptors = Object.getOwnPropertyDescriptors(props);
5525
- const res = keys.map((k) => {
5609
+ keys.push(Object.keys(descriptors).filter((k) => !blocked.has(k)));
5610
+ return keys.map((k) => {
5526
5611
  const clone = {};
5527
5612
  for (let i2 = 0; i2 < k.length; i2++) {
5528
5613
  const key = k[i2];
5614
+ if (!(key in props))
5615
+ continue;
5529
5616
  Object.defineProperty(clone, key, descriptors[key] ? descriptors[key] : {
5530
5617
  get() {
5531
5618
  return props[key];
5532
5619
  },
5533
5620
  set() {
5534
5621
  return true;
5535
- }
5622
+ },
5623
+ enumerable: true
5536
5624
  });
5537
5625
  }
5538
5626
  return clone;
5539
5627
  });
5540
- res.push(new Proxy({
5541
- get(property) {
5542
- return blocked.has(property) ? void 0 : props[property];
5543
- },
5544
- has(property) {
5545
- return blocked.has(property) ? false : property in props;
5546
- },
5547
- keys() {
5548
- return Object.keys(props).filter((k) => !blocked.has(k));
5549
- }
5550
- }, propTraps));
5551
- return res;
5552
5628
  }
5553
5629
  function For(props) {
5554
5630
  const fallback = "fallback" in props && {
5555
5631
  fallback: () => props.fallback
5556
5632
  };
5557
- return createMemo(mapArray(() => props.each, props.children, fallback ? fallback : void 0));
5633
+ return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
5558
5634
  }
5559
5635
  function Show(props) {
5560
5636
  let strictEqual = false;
@@ -5571,11 +5647,12 @@ function Show(props) {
5571
5647
  return fn ? untrack(() => child(c2)) : child;
5572
5648
  }
5573
5649
  return props.fallback;
5574
- });
5650
+ }, void 0, void 0);
5575
5651
  }
5576
5652
  function Switch(props) {
5577
5653
  let strictEqual = false;
5578
5654
  let keyed = false;
5655
+ const equals = (a2, b) => a2[0] === b[0] && (strictEqual ? a2[1] === b[1] : !a2[1] === !b[1]) && a2[2] === b[2];
5579
5656
  const conditions = children(() => props.children), evalConditions = createMemo(() => {
5580
5657
  let conds = conditions();
5581
5658
  if (!Array.isArray(conds))
@@ -5589,7 +5666,7 @@ function Switch(props) {
5589
5666
  }
5590
5667
  return [-1];
5591
5668
  }, void 0, {
5592
- equals: (a2, b) => a2[0] === b[0] && (strictEqual ? a2[1] === b[1] : !a2[1] === !b[1]) && a2[2] === b[2]
5669
+ equals
5593
5670
  });
5594
5671
  return createMemo(() => {
5595
5672
  const [index, when, cond] = evalConditions();
@@ -5599,7 +5676,7 @@ function Switch(props) {
5599
5676
  const fn = typeof c2 === "function" && c2.length > 0;
5600
5677
  strictEqual = keyed || fn;
5601
5678
  return fn ? untrack(() => c2(when)) : c2;
5602
- });
5679
+ }, void 0, void 0);
5603
5680
  }
5604
5681
  function Match(props) {
5605
5682
  return props;
@@ -5607,18 +5684,18 @@ function Match(props) {
5607
5684
  const booleans = ["allowfullscreen", "async", "autofocus", "autoplay", "checked", "controls", "default", "disabled", "formnovalidate", "hidden", "indeterminate", "ismap", "loop", "multiple", "muted", "nomodule", "novalidate", "open", "playsinline", "readonly", "required", "reversed", "seamless", "selected"];
5608
5685
  const Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
5609
5686
  const ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
5610
- const Aliases = {
5687
+ const Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
5611
5688
  className: "class",
5612
5689
  htmlFor: "for"
5613
- };
5614
- const PropAliases = {
5690
+ });
5691
+ const PropAliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
5615
5692
  class: "className",
5616
5693
  formnovalidate: "formNoValidate",
5617
5694
  ismap: "isMap",
5618
5695
  nomodule: "noModule",
5619
5696
  playsinline: "playsInline",
5620
5697
  readonly: "readOnly"
5621
- };
5698
+ });
5622
5699
  const DelegatedEvents = /* @__PURE__ */ new Set(["beforeinput", "click", "dblclick", "contextmenu", "focusin", "focusout", "input", "keydown", "keyup", "mousedown", "mousemove", "mouseout", "mouseover", "mouseup", "pointerdown", "pointermove", "pointerout", "pointerover", "pointerup", "touchend", "touchmove", "touchstart"]);
5623
5700
  const SVGElements = /* @__PURE__ */ new Set([
5624
5701
  "altGlyph",
@@ -5702,11 +5779,6 @@ const SVGNamespace = {
5702
5779
  xlink: "http://www.w3.org/1999/xlink",
5703
5780
  xml: "http://www.w3.org/XML/1998/namespace"
5704
5781
  };
5705
- function memo(fn, equals) {
5706
- return createMemo(fn, void 0, !equals ? {
5707
- equals
5708
- } : void 0);
5709
- }
5710
5782
  function reconcileArrays(parentNode, a2, b) {
5711
5783
  let bLength = b.length, aEnd = a2.length, bEnd = bLength, aStart = 0, bStart = 0, after = a2[aEnd - 1].nextSibling, map = null;
5712
5784
  while (aStart < aEnd || bStart < bEnd) {
@@ -5764,12 +5836,12 @@ function reconcileArrays(parentNode, a2, b) {
5764
5836
  }
5765
5837
  }
5766
5838
  const $$EVENTS = "_$DX_DELEGATE";
5767
- function render(code, element, init) {
5839
+ function render(code, element, init, options = {}) {
5768
5840
  let disposer;
5769
5841
  createRoot((dispose2) => {
5770
5842
  disposer = dispose2;
5771
5843
  element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
5772
- });
5844
+ }, options.owner);
5773
5845
  return () => {
5774
5846
  disposer();
5775
5847
  element.textContent = "";
@@ -5866,11 +5938,14 @@ function style(node, value, prev) {
5866
5938
  }
5867
5939
  return prev;
5868
5940
  }
5869
- function spread(node, accessor, isSVG, skipChildren) {
5870
- if (typeof accessor === "function") {
5871
- createRenderEffect((current) => spreadExpression(node, accessor(), current, isSVG, skipChildren));
5872
- } else
5873
- spreadExpression(node, accessor, void 0, isSVG, skipChildren);
5941
+ function spread(node, props = {}, isSVG, skipChildren) {
5942
+ const prevProps = {};
5943
+ if (!skipChildren) {
5944
+ createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
5945
+ }
5946
+ createRenderEffect(() => props.ref && props.ref(node));
5947
+ createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
5948
+ return prevProps;
5874
5949
  }
5875
5950
  function use(fn, element, arg) {
5876
5951
  return untrack(() => fn(element, arg));
@@ -5928,9 +6003,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
5928
6003
  if (value === prev)
5929
6004
  return prev;
5930
6005
  if (prop === "ref") {
5931
- if (!skipRef) {
6006
+ if (!skipRef)
5932
6007
  value(node);
5933
- }
5934
6008
  } else if (prop.slice(0, 3) === "on:") {
5935
6009
  const e2 = prop.slice(3);
5936
6010
  prev && node.removeEventListener(e2, prev);
@@ -5985,7 +6059,7 @@ function eventHandler(e2) {
5985
6059
  sharedConfig.done = true;
5986
6060
  document.querySelectorAll("[id^=pl-]").forEach((elem) => elem.remove());
5987
6061
  }
5988
- while (node !== null) {
6062
+ while (node) {
5989
6063
  const handler = node[key];
5990
6064
  if (handler && !node.disabled) {
5991
6065
  const data = node[`${key}Data`];
@@ -5993,18 +6067,9 @@ function eventHandler(e2) {
5993
6067
  if (e2.cancelBubble)
5994
6068
  return;
5995
6069
  }
5996
- node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
6070
+ node = node._$host || node.parentNode || node.host;
5997
6071
  }
5998
6072
  }
5999
- function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
6000
- props || (props = {});
6001
- if (!skipChildren) {
6002
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
6003
- }
6004
- createRenderEffect(() => props.ref && props.ref(node));
6005
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
6006
- return prevProps;
6007
- }
6008
6073
  function insertExpression(parent, value, current, marker, unwrapArray) {
6009
6074
  if (sharedConfig.context && !current)
6010
6075
  current = [...parent.childNodes];
@@ -6118,7 +6183,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap2) {
6118
6183
  }
6119
6184
  return dynamic;
6120
6185
  }
6121
- function appendNodes(parent, array, marker) {
6186
+ function appendNodes(parent, array, marker = null) {
6122
6187
  for (let i2 = 0, len = array.length; i2 < len; i2++)
6123
6188
  parent.insertBefore(array[i2], marker);
6124
6189
  }
@@ -6177,10 +6242,11 @@ function Portal(props) {
6177
6242
  const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
6178
6243
  mode: "open"
6179
6244
  }) : container;
6180
- Object.defineProperty(container, "host", {
6245
+ Object.defineProperty(container, "_$host", {
6181
6246
  get() {
6182
6247
  return marker.parentNode;
6183
- }
6248
+ },
6249
+ configurable: true
6184
6250
  });
6185
6251
  insert(renderRoot, renderPortal());
6186
6252
  mount.appendChild(container);
@@ -6483,9 +6549,9 @@ function wrap$1(value, name) {
6483
6549
  for (let i2 = 0, l2 = keys.length; i2 < l2; i2++) {
6484
6550
  const prop = keys[i2];
6485
6551
  if (desc[prop].get) {
6486
- const get = desc[prop].get.bind(p2);
6487
6552
  Object.defineProperty(value, prop, {
6488
- get
6553
+ enumerable: desc[prop].enumerable,
6554
+ get: desc[prop].get.bind(p2)
6489
6555
  });
6490
6556
  }
6491
6557
  }
@@ -6541,7 +6607,7 @@ function getDataNodes(target) {
6541
6607
  function getDataNode(nodes, property, value) {
6542
6608
  return nodes[property] || (nodes[property] = createDataNode(value));
6543
6609
  }
6544
- function proxyDescriptor(target, property) {
6610
+ function proxyDescriptor$1(target, property) {
6545
6611
  const desc = Reflect.getOwnPropertyDescriptor(target, property);
6546
6612
  if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME)
6547
6613
  return desc;
@@ -6593,8 +6659,7 @@ const proxyTraps$1 = {
6593
6659
  has(target, property) {
6594
6660
  if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === "__proto__")
6595
6661
  return true;
6596
- const tracked = getDataNodes(target)[property];
6597
- tracked && tracked();
6662
+ this.get(target, property, target);
6598
6663
  return property in target;
6599
6664
  },
6600
6665
  set() {
@@ -6604,16 +6669,15 @@ const proxyTraps$1 = {
6604
6669
  return true;
6605
6670
  },
6606
6671
  ownKeys,
6607
- getOwnPropertyDescriptor: proxyDescriptor
6672
+ getOwnPropertyDescriptor: proxyDescriptor$1
6608
6673
  };
6609
6674
  function setProperty(state, property, value, deleting = false) {
6610
6675
  if (!deleting && state[property] === value)
6611
6676
  return;
6612
- const prev = state[property];
6613
- const len = state.length;
6614
- if (value === void 0) {
6677
+ const prev = state[property], len = state.length;
6678
+ if (value === void 0)
6615
6679
  delete state[property];
6616
- } else
6680
+ else
6617
6681
  state[property] = value;
6618
6682
  let nodes = getDataNodes(state), node;
6619
6683
  if (node = getDataNode(nodes, property, prev))
@@ -6709,59 +6773,235 @@ var THEME = /* @__PURE__ */ ((THEME2) => {
6709
6773
  THEME2["LIGHT"] = "LIGHT";
6710
6774
  return THEME2;
6711
6775
  })(THEME || {});
6712
- function hexToRgb(hex) {
6713
- if (hex[0] === "#") {
6714
- hex = hex.slice(1);
6715
- }
6716
- const bigint = parseInt(hex, 16);
6717
- const r = bigint >> 16 & 255;
6718
- const g = bigint >> 8 & 255;
6719
- const b = bigint & 255;
6720
- return [r, g, b].join(",");
6721
- }
6722
- const generateLightColors = (accentColor) => ({
6723
- primary: accentColor,
6724
- secondary: `rgba(${hexToRgb(accentColor)}, 0.16)`,
6725
- backgroundPrimary: "#FFFFFF",
6726
- backgroundSecondary: "#EFF1F3",
6727
- font: {
6728
- accent: accentColor,
6776
+ const defaultLightColorsSet = {
6777
+ constant: {
6778
+ black: "#000000",
6779
+ white: "#FFFFFF"
6780
+ },
6781
+ connectButton: {
6782
+ background: "#31A6F5",
6783
+ foreground: "#FFFFFF"
6784
+ },
6785
+ accent: "#31A6F5",
6786
+ icon: {
6729
6787
  primary: "#0F0F0F",
6730
6788
  secondary: "#7A8999",
6731
- third: "#7A8999"
6789
+ tertiary: "#C1CAD2",
6790
+ success: "#29CC6A"
6791
+ },
6792
+ background: {
6793
+ primary: "#FFFFFF",
6794
+ secondary: "#F1F3F5"
6795
+ },
6796
+ text: {
6797
+ primary: "#0F0F0F",
6798
+ secondary: "#7A8999",
6799
+ subhead: "#6A7785"
6732
6800
  }
6733
- });
6734
- const generateDarkColors = (accentColor) => ({
6735
- primary: accentColor,
6736
- secondary: accentColor,
6737
- backgroundPrimary: "#121214",
6738
- backgroundSecondary: "#18181A",
6739
- font: {
6740
- accent: "#E5E5EA",
6801
+ };
6802
+ const defaultDarkColorsSet = {
6803
+ constant: {
6804
+ black: "#000000",
6805
+ white: "#FFFFFF"
6806
+ },
6807
+ connectButton: {
6808
+ background: "#31A6F5",
6809
+ foreground: "#FFFFFF"
6810
+ },
6811
+ accent: "#E5E5EA",
6812
+ icon: {
6813
+ primary: "#E5E5EA",
6814
+ secondary: "#909099",
6815
+ tertiary: "#434347",
6816
+ success: "#29CC6A"
6817
+ },
6818
+ background: {
6819
+ primary: "#121214",
6820
+ secondary: "#18181A"
6821
+ },
6822
+ text: {
6741
6823
  primary: "#E5E5EA",
6742
6824
  secondary: "#7D7D85",
6743
- third: "#909099"
6825
+ subhead: "#8C8C93"
6744
6826
  }
6745
- });
6746
- const defaultLightColors = generateLightColors("#31A6F5");
6747
- const defaultDarkColors = generateDarkColors("#262629");
6827
+ };
6828
+ var isMergeableObject = function isMergeableObject2(value) {
6829
+ return isNonNullObject(value) && !isSpecial(value);
6830
+ };
6831
+ function isNonNullObject(value) {
6832
+ return !!value && typeof value === "object";
6833
+ }
6834
+ function isSpecial(value) {
6835
+ var stringValue = Object.prototype.toString.call(value);
6836
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
6837
+ }
6838
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
6839
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
6840
+ function isReactElement(value) {
6841
+ return value.$$typeof === REACT_ELEMENT_TYPE;
6842
+ }
6843
+ function emptyTarget(val) {
6844
+ return Array.isArray(val) ? [] : {};
6845
+ }
6846
+ function cloneUnlessOtherwiseSpecified(value, options) {
6847
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
6848
+ }
6849
+ function defaultArrayMerge(target, source, options) {
6850
+ return target.concat(source).map(function(element) {
6851
+ return cloneUnlessOtherwiseSpecified(element, options);
6852
+ });
6853
+ }
6854
+ function getMergeFunction(key, options) {
6855
+ if (!options.customMerge) {
6856
+ return deepmerge;
6857
+ }
6858
+ var customMerge = options.customMerge(key);
6859
+ return typeof customMerge === "function" ? customMerge : deepmerge;
6860
+ }
6861
+ function getEnumerableOwnPropertySymbols(target) {
6862
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
6863
+ return target.propertyIsEnumerable(symbol);
6864
+ }) : [];
6865
+ }
6866
+ function getKeys(target) {
6867
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
6868
+ }
6869
+ function propertyIsOnObject(object, property) {
6870
+ try {
6871
+ return property in object;
6872
+ } catch (_) {
6873
+ return false;
6874
+ }
6875
+ }
6876
+ function propertyIsUnsafe(target, key) {
6877
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
6878
+ }
6879
+ function mergeObject(target, source, options) {
6880
+ var destination = {};
6881
+ if (options.isMergeableObject(target)) {
6882
+ getKeys(target).forEach(function(key) {
6883
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
6884
+ });
6885
+ }
6886
+ getKeys(source).forEach(function(key) {
6887
+ if (propertyIsUnsafe(target, key)) {
6888
+ return;
6889
+ }
6890
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
6891
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
6892
+ } else {
6893
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
6894
+ }
6895
+ });
6896
+ return destination;
6897
+ }
6898
+ function deepmerge(target, source, options) {
6899
+ options = options || {};
6900
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
6901
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
6902
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
6903
+ var sourceIsArray = Array.isArray(source);
6904
+ var targetIsArray = Array.isArray(target);
6905
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
6906
+ if (!sourceAndTargetTypesMatch) {
6907
+ return cloneUnlessOtherwiseSpecified(source, options);
6908
+ } else if (sourceIsArray) {
6909
+ return options.arrayMerge(target, source, options);
6910
+ } else {
6911
+ return mergeObject(target, source, options);
6912
+ }
6913
+ }
6914
+ deepmerge.all = function deepmergeAll(array, options) {
6915
+ if (!Array.isArray(array)) {
6916
+ throw new Error("first argument should be an array");
6917
+ }
6918
+ return array.reduce(function(prev, next) {
6919
+ return deepmerge(prev, next, options);
6920
+ }, {});
6921
+ };
6922
+ var deepmerge_1 = deepmerge;
6923
+ var cjs = deepmerge_1;
6924
+ /*!
6925
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
6926
+ *
6927
+ * Copyright (c) 2014-2017, Jon Schlinkert.
6928
+ * Released under the MIT License.
6929
+ */
6930
+ function isObject(o2) {
6931
+ return Object.prototype.toString.call(o2) === "[object Object]";
6932
+ }
6933
+ function isPlainObject(o2) {
6934
+ var ctor, prot;
6935
+ if (isObject(o2) === false)
6936
+ return false;
6937
+ ctor = o2.constructor;
6938
+ if (ctor === void 0)
6939
+ return true;
6940
+ prot = ctor.prototype;
6941
+ if (isObject(prot) === false)
6942
+ return false;
6943
+ if (prot.hasOwnProperty("isPrototypeOf") === false) {
6944
+ return false;
6945
+ }
6946
+ return true;
6947
+ }
6948
+ function mergeOptions(options, defaultOptions) {
6949
+ if (!options) {
6950
+ return defaultOptions;
6951
+ }
6952
+ const overwriteMerge = (_, sourceArray, __) => sourceArray;
6953
+ return cjs(defaultOptions, options, {
6954
+ arrayMerge: overwriteMerge,
6955
+ isMergeableObject: isPlainObject
6956
+ });
6957
+ }
6748
6958
  const [themeState, setThemeState] = createStore({
6749
6959
  theme: THEME.LIGHT,
6750
- accentColor: defaultLightColors.primary,
6751
- colors: defaultLightColors
6960
+ colors: defaultLightColorsSet,
6961
+ borderRadius: "m"
6752
6962
  });
6753
- function setTheme(theme) {
6754
- if (theme === THEME.LIGHT) {
6755
- setThemeState({
6756
- theme,
6757
- colors: defaultLightColors
6758
- });
6759
- } else {
6760
- setThemeState({
6761
- theme,
6762
- colors: defaultDarkColors
6763
- });
6963
+ const themeColorsMappingDefault = {
6964
+ [THEME.LIGHT]: defaultLightColorsSet,
6965
+ [THEME.DARK]: defaultDarkColorsSet
6966
+ };
6967
+ const themeCustomColors = {
6968
+ [THEME.LIGHT]: void 0,
6969
+ [THEME.DARK]: void 0
6970
+ };
6971
+ function setTheme(theme, colorsSet) {
6972
+ if (colorsSet) {
6973
+ themeCustomColors[THEME.DARK] = mergeOptions(
6974
+ colorsSet[THEME.DARK],
6975
+ themeCustomColors[THEME.DARK]
6976
+ );
6977
+ themeCustomColors[THEME.LIGHT] = mergeOptions(
6978
+ colorsSet[THEME.LIGHT],
6979
+ themeCustomColors[THEME.LIGHT]
6980
+ );
6764
6981
  }
6982
+ setThemeState({
6983
+ theme,
6984
+ colors: mergeOptions(themeCustomColors[theme], themeColorsMappingDefault[theme])
6985
+ });
6986
+ }
6987
+ function setBorderRadius(borderRadius) {
6988
+ setThemeState({ borderRadius });
6989
+ }
6990
+ function setColors(colorsSet) {
6991
+ themeCustomColors[THEME.DARK] = mergeOptions(
6992
+ colorsSet[THEME.DARK],
6993
+ themeCustomColors[THEME.DARK]
6994
+ );
6995
+ themeCustomColors[THEME.LIGHT] = mergeOptions(
6996
+ colorsSet[THEME.LIGHT],
6997
+ themeCustomColors[THEME.LIGHT]
6998
+ );
6999
+ setThemeState((state) => ({
7000
+ colors: mergeOptions(
7001
+ themeCustomColors[state.theme],
7002
+ themeColorsMappingDefault[state.theme]
7003
+ )
7004
+ }));
6765
7005
  }
6766
7006
  const GlobalStyles = () => {
6767
7007
  document.body.addEventListener("mousedown", () => document.body.classList.add("using-mouse"));
@@ -6799,22 +7039,41 @@ const GlobalStyles = () => {
6799
7039
  `;
6800
7040
  return createComponent(Styles, {});
6801
7041
  };
7042
+ function hexToRgb(hex) {
7043
+ if (hex[0] === "#") {
7044
+ hex = hex.slice(1);
7045
+ }
7046
+ const bigint = parseInt(hex, 16);
7047
+ const r = bigint >> 16 & 255;
7048
+ const g = bigint >> 8 & 255;
7049
+ const b = bigint & 255;
7050
+ return [r, g, b].join(",");
7051
+ }
7052
+ function rgba(color, opacity) {
7053
+ if (color[0] === "#") {
7054
+ color = hexToRgb(color);
7055
+ }
7056
+ return `rgba(${color}, ${opacity})`;
7057
+ }
7058
+ const borders$3 = {
7059
+ m: "16px",
7060
+ s: "8px",
7061
+ none: "0"
7062
+ };
6802
7063
  const ButtonStyled$2 = styled.button`
6803
- background-color: ${(props) => props.appearance === "flat" ? props.theme.colors.backgroundPrimary : props.theme.colors[props.appearance]};
6804
- color: ${(props) => props.appearance === "primary" ? "white" : props.appearance === "flat" ? props.theme.colors.font.primary : props.theme.colors.font.accent};
7064
+ background-color: ${(props) => rgba(props.theme.colors.accent, 0.12)};
7065
+ color: ${(props) => props.theme.colors.accent};
6805
7066
 
6806
- box-shadow: ${(props) => props.appearance === "flat" ? "0 4px 24px rgba(0, 0, 0, 0.16);" : "unset;"}
6807
-
6808
7067
  padding: 9px 16px;
6809
7068
  border: none;
6810
- border-radius: 16px;
7069
+ border-radius: ${(props) => borders$3[props.theme.borderRadius]};
6811
7070
  cursor: pointer;
6812
7071
 
6813
7072
  font-size: 14px;
6814
7073
  font-weight: 590;
6815
7074
  line-height: 18px;
6816
7075
  letter-spacing: -0.154px;
6817
-
7076
+
6818
7077
  transition: transform 0.1s ease-in-out;
6819
7078
 
6820
7079
  &:hover {
@@ -6826,13 +7085,12 @@ const ButtonStyled$2 = styled.button`
6826
7085
  }
6827
7086
  `;
6828
7087
  const Button = (props) => {
6829
- const appearance = () => props.appearance || "primary";
6830
7088
  return createComponent(ButtonStyled$2, {
6831
7089
  get ["class"]() {
6832
7090
  return props.class;
6833
7091
  },
6834
- get appearance() {
6835
- return appearance();
7092
+ get id() {
7093
+ return props.id;
6836
7094
  },
6837
7095
  onClick: () => props.onClick(),
6838
7096
  ref(r$) {
@@ -7240,7 +7498,7 @@ const rotationDegrees = {
7240
7498
  };
7241
7499
  const ArrowIcon = (props) => {
7242
7500
  const theme = useTheme();
7243
- const fill = () => props.fill || theme.colors.font.third;
7501
+ const fill = () => props.fill || theme.colors.icon.secondary;
7244
7502
  const direction = () => props.direction || "left";
7245
7503
  const Svg = styled("svg")`
7246
7504
  transform: rotate(${(props2) => rotationDegrees[props2.svgDirection]}deg);
@@ -7265,7 +7523,7 @@ const ArrowIcon = (props) => {
7265
7523
  const _tmpl$$e = /* @__PURE__ */ template$1(`<svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0.900031 0.900397L5.00002 5.00039M5.00002 5.00039L9.10003 9.1004M5.00002 5.00039L9.10003 0.900391M5.00002 5.00039L0.900024 9.1004" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);
7266
7524
  const CloseIcon = (props) => {
7267
7525
  const theme = useTheme();
7268
- const fill = () => props.fill || theme.colors.font.third;
7526
+ const fill = () => props.fill || theme.colors.icon.secondary;
7269
7527
  return (() => {
7270
7528
  const _el$ = _tmpl$$e.cloneNode(true), _el$2 = _el$.firstChild;
7271
7529
  createRenderEffect(() => setAttribute(_el$2, "stroke", fill()));
@@ -7280,7 +7538,7 @@ const IconButtonStyled = styled.button`
7280
7538
  width: 32px;
7281
7539
  height: 32px;
7282
7540
  border-radius: 50%;
7283
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
7541
+ background-color: ${(props) => props.theme.colors.background.secondary};
7284
7542
  border: none;
7285
7543
  cursor: pointer;
7286
7544
 
@@ -7365,14 +7623,12 @@ const ModalBackgroundStyled = styled.div`
7365
7623
  const ModalWrapperClass = u`
7366
7624
  position: relative;
7367
7625
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 16px 64px rgba(0, 0, 0, 0.16);
7368
- border-radius: 24px;
7369
7626
  min-height: 100px;
7370
7627
  width: 440px;
7371
7628
  padding: 44px 56px 24px;
7372
7629
 
7373
7630
  ${media("mobile")} {
7374
7631
  width: 100%;
7375
- border-radius: 24px 24px 0 0;
7376
7632
  }
7377
7633
  `;
7378
7634
  const CloseButtonStyled = styled(IconButton)`
@@ -7383,6 +7639,11 @@ const CloseButtonStyled = styled(IconButton)`
7383
7639
  const _tmpl$$d = /* @__PURE__ */ template$1(`<div></div>`);
7384
7640
  const clickOutside = clickOutside$1;
7385
7641
  const keyPressed = escPressed;
7642
+ const borders$2 = {
7643
+ m: "24px",
7644
+ s: "16px",
7645
+ none: "0"
7646
+ };
7386
7647
  const Modal = (props) => {
7387
7648
  const theme = useTheme();
7388
7649
  return createComponent(Transition, {
@@ -7443,9 +7704,23 @@ const Modal = (props) => {
7443
7704
  onClick: () => props.onClose()
7444
7705
  }), null);
7445
7706
  insert(_el$, () => props.children, null);
7446
- createRenderEffect(() => className(_el$, cn(ModalWrapperClass, props.class, u`
7447
- background-color: ${theme.colors.backgroundPrimary};
7448
- `)));
7707
+ createRenderEffect((_p$) => {
7708
+ const _v$ = props.id, _v$2 = cn(ModalWrapperClass, props.class, u`
7709
+ background-color: ${theme.colors.background.primary};
7710
+ border-radius: ${borders$2[theme.borderRadius]};
7711
+
7712
+ ${media("mobile")} {
7713
+ border-radius: ${borders$2[theme.borderRadius]}
7714
+ ${borders$2[theme.borderRadius]} 0 0;
7715
+ }
7716
+ `);
7717
+ _v$ !== _p$._v$ && setAttribute(_el$, "id", _p$._v$ = _v$);
7718
+ _v$2 !== _p$._v$2 && className(_el$, _p$._v$2 = _v$2);
7719
+ return _p$;
7720
+ }, {
7721
+ _v$: void 0,
7722
+ _v$2: void 0
7723
+ });
7449
7724
  return _el$;
7450
7725
  }
7451
7726
  });
@@ -7490,7 +7765,7 @@ const H1Styled$2 = styled.h1`
7490
7765
  text-align: center;
7491
7766
  letter-spacing: 0.072px;
7492
7767
 
7493
- color: ${(props) => props.theme.colors.font.primary};
7768
+ color: ${(props) => props.theme.colors.text.primary};
7494
7769
 
7495
7770
  margin-top: 0;
7496
7771
  margin-bottom: 6px;
@@ -7503,7 +7778,7 @@ const H1 = (props) => {
7503
7778
  },
7504
7779
  get children() {
7505
7780
  var _a;
7506
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7781
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7507
7782
  }
7508
7783
  });
7509
7784
  };
@@ -7516,7 +7791,7 @@ const H2Styled$1 = styled.h2`
7516
7791
  text-align: center;
7517
7792
  letter-spacing: -0.32px;
7518
7793
 
7519
- color: ${(props) => props.theme.colors.font.secondary};
7794
+ color: ${(props) => props.theme.colors.text.secondary};
7520
7795
 
7521
7796
  margin-top: 0;
7522
7797
  margin-bottom: 32px;
@@ -7529,7 +7804,7 @@ const H2 = (props) => {
7529
7804
  },
7530
7805
  get children() {
7531
7806
  var _a;
7532
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7807
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7533
7808
  }
7534
7809
  });
7535
7810
  };
@@ -7541,17 +7816,17 @@ const H3Styled = styled.h3`
7541
7816
 
7542
7817
  letter-spacing: -0.24px;
7543
7818
 
7544
- color: ${(props) => props.theme.colors.font.primary};
7819
+ color: ${(props) => props.theme.colors.text.primary};
7545
7820
 
7546
7821
  margin-top: 0;
7547
- margin-bottom: 0px;
7822
+ margin-bottom: 0;
7548
7823
  `;
7549
7824
  const H3 = (props) => {
7550
7825
  const [t2] = useI18n();
7551
7826
  return createComponent(H3Styled, {
7552
7827
  get children() {
7553
7828
  var _a;
7554
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7829
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7555
7830
  }
7556
7831
  });
7557
7832
  };
@@ -7567,7 +7842,7 @@ const TextStyled$3 = styled.div`
7567
7842
  const Text = (inputs) => {
7568
7843
  const theme = useTheme();
7569
7844
  const [t2] = useI18n();
7570
- const color = () => inputs.color || theme.colors.font.primary;
7845
+ const color = () => inputs.color || theme.colors.text.primary;
7571
7846
  const props = mergeProps({
7572
7847
  fontSize: "14px",
7573
7848
  fontWeight: "510",
@@ -7595,14 +7870,14 @@ const Text = (inputs) => {
7595
7870
  },
7596
7871
  get children() {
7597
7872
  var _a;
7598
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7873
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7599
7874
  }
7600
7875
  });
7601
7876
  };
7602
7877
  const _tmpl$$c = /* @__PURE__ */ template$1(`<svg width="16" height="15" viewBox="0 0 16 15" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.1839 12.7069C9.6405 13.6507 9.36881 14.1226 9.05907 14.348C8.42775 14.8074 7.57228 14.8074 6.94096 14.348C6.63122 14.1226 6.35952 13.6507 5.81613 12.7069L1.52066 5.24638C0.768635 3.94024 0.392625 3.28717 0.337617 2.75894C0.225505 1.68236 0.818944 0.655911 1.80788 0.215893C2.29309 0 3.04667 0 4.55383 0H11.4462C12.9534 0 13.7069 0 14.1922 0.215893C15.1811 0.655911 15.7745 1.68236 15.6624 2.75894C15.6074 3.28717 15.2314 3.94024 14.4794 5.24638L10.1839 12.7069ZM7.10002 11.3412L2.56139 3.48002C2.31995 3.06185 2.19924 2.85276 2.18146 2.68365C2.14523 2.33896 2.33507 2.01015 2.65169 1.86919C2.80703 1.80002 3.04847 1.80002 3.53133 1.80002H3.53134L7.10002 1.80002V11.3412ZM8.90001 11.3412L13.4387 3.48002C13.6801 3.06185 13.8008 2.85276 13.8186 2.68365C13.8548 2.33896 13.665 2.01015 13.3484 1.86919C13.193 1.80002 12.9516 1.80002 12.4687 1.80002L8.90001 1.80002V11.3412Z"></path></svg>`);
7603
7878
  const TonIcon = (props) => {
7604
7879
  const theme = useTheme();
7605
- const fill = () => props.fill || theme.colors.font.primary;
7880
+ const fill = () => props.fill || theme.colors.icon.primary;
7606
7881
  return (() => {
7607
7882
  const _el$ = _tmpl$$c.cloneNode(true), _el$2 = _el$.firstChild;
7608
7883
  createRenderEffect(() => setAttribute(_el$2, "fill", fill()));
@@ -7611,7 +7886,8 @@ const TonIcon = (props) => {
7611
7886
  };
7612
7887
  const _tmpl$$b = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="11"></circle><path d="M7.5 13L10 15.5L16.5 9" stroke="white" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);
7613
7888
  const SuccessIcon = (props) => {
7614
- const fill = () => props.fill || "#29CC6A";
7889
+ const theme = useTheme();
7890
+ const fill = () => props.fill || theme.colors.icon.success;
7615
7891
  return (() => {
7616
7892
  const _el$ = _tmpl$$b.cloneNode(true), _el$2 = _el$.firstChild;
7617
7893
  createRenderEffect((_p$) => {
@@ -7629,7 +7905,7 @@ const SuccessIcon = (props) => {
7629
7905
  const _tmpl$$a = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="11"></circle><path fill-rule="evenodd" clip-rule="evenodd" d="M7.86358 9.13637C7.51211 8.7849 7.51211 8.21505 7.86358 7.86358C8.21505 7.51211 8.7849 7.51211 9.13637 7.86358L12 10.7272L14.8636 7.86358C15.2151 7.51211 15.7849 7.51211 16.1364 7.86358C16.4878 8.21505 16.4878 8.7849 16.1364 9.13637L13.2728 12L16.1364 14.8636C16.4878 15.2151 16.4878 15.7849 16.1364 16.1364C15.7849 16.4878 15.2151 16.4878 14.8636 16.1364L12 13.2728L9.13637 16.1364C8.7849 16.4878 8.21505 16.4878 7.86358 16.1364C7.51211 15.7849 7.51211 15.2151 7.86358 14.8636L10.7272 12L7.86358 9.13637Z" fill="white"></path></svg>`);
7630
7906
  const ErrorIcon = (props) => {
7631
7907
  const theme = useTheme();
7632
- const fill = () => props.fill || theme.colors.font.third;
7908
+ const fill = () => props.fill || theme.colors.icon.secondary;
7633
7909
  return (() => {
7634
7910
  const _el$ = _tmpl$$a.cloneNode(true), _el$2 = _el$.firstChild;
7635
7911
  createRenderEffect((_p$) => {
@@ -7647,7 +7923,7 @@ const ErrorIcon = (props) => {
7647
7923
  const _tmpl$$9 = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.00002 18.9282C11.8264 21.1373 16.7191 19.8263 18.9282 16C21.1374 12.1736 19.8264 7.28092 16 5.07178C12.1737 2.86264 7.28096 4.17364 5.07182 7.99998" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);
7648
7924
  const LoaderIcon = (props) => {
7649
7925
  const theme = useTheme();
7650
- const fill = () => props.fill || theme.colors.font.third;
7926
+ const fill = () => props.fill || theme.colors.icon.tertiary;
7651
7927
  const rotateAnimation = h`
7652
7928
  0% {
7653
7929
  transform: rotate(0deg);
@@ -7677,7 +7953,7 @@ const TonConnectUiContext = createContext();
7677
7953
  const _tmpl$$8 = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M7.76228 2.09998H7.79998H10.2001H10.2378H10.2378H10.2378C11.0459 2.09997 11.7067 2.09996 12.2438 2.14384C12.7997 2.18926 13.3017 2.28614 13.7706 2.52505C14.5045 2.89896 15.1011 3.49558 15.475 4.22941C15.7139 4.6983 15.8108 5.20038 15.8562 5.75629C15.9001 6.29337 15.9001 6.95422 15.9001 7.76227V7.79998V8.1H16.2H16.2377C17.0457 8.09999 17.7066 8.09998 18.2437 8.14386C18.7996 8.18928 19.3017 8.28616 19.7705 8.52507C20.5044 8.89898 21.101 9.4956 21.4749 10.2294C21.7138 10.6983 21.8107 11.2004 21.8561 11.7563C21.9 12.2934 21.9 12.9542 21.9 13.7623V13.8V16.2V16.2377C21.9 17.0458 21.9 17.7066 21.8561 18.2437C21.8107 18.7996 21.7138 19.3017 21.4749 19.7706C21.101 20.5044 20.5044 21.101 19.7705 21.4749C19.3017 21.7138 18.7996 21.8107 18.2437 21.8561C17.7066 21.9 17.0458 21.9 16.2378 21.9H16.2377H16.2H13.8H13.7623H13.7622C12.9542 21.9 12.2934 21.9 11.7563 21.8561C11.2004 21.8107 10.6983 21.7138 10.2294 21.4749C9.49561 21.101 8.89898 20.5044 8.52507 19.7706C8.28616 19.3017 8.18928 18.7996 8.14386 18.2437C8.09998 17.7066 8.09999 17.0458 8.1 16.2377V16.2V15.9H7.79998H7.76227H7.76218C6.95417 15.9 6.29335 15.9 5.75629 15.8561C5.20038 15.8107 4.6983 15.7138 4.22941 15.4749C3.49558 15.101 2.89896 14.5044 2.52505 13.7705C2.28614 13.3017 2.18926 12.7996 2.14384 12.2437C2.09996 11.7066 2.09997 11.0458 2.09998 10.2377V10.2377V10.2377V10.2V7.79998V7.76228V7.76225V7.76224C2.09997 6.9542 2.09996 6.29336 2.14384 5.75629C2.18926 5.20038 2.28614 4.6983 2.52505 4.22941C2.89896 3.49558 3.49558 2.89896 4.22941 2.52505C4.6983 2.28614 5.20038 2.18926 5.75629 2.14384C6.29336 2.09996 6.95419 2.09997 7.76222 2.09998H7.76224H7.76228ZM8.1 14.1V13.8V13.7623C8.09999 12.9542 8.09998 12.2934 8.14386 11.7563C8.18928 11.2004 8.28616 10.6983 8.52507 10.2294C8.89898 9.4956 9.49561 8.89898 10.2294 8.52507C10.6983 8.28616 11.2004 8.18928 11.7563 8.14386C12.2934 8.09998 12.9542 8.09999 13.7623 8.1H13.8H14.1001V7.79998C14.1001 6.94505 14.0994 6.35798 14.0622 5.90287C14.0259 5.45827 13.9593 5.21944 13.8712 5.0466C13.6699 4.65146 13.3486 4.3302 12.9535 4.12886C12.7806 4.04079 12.5418 3.97419 12.0972 3.93786C11.6421 3.90068 11.055 3.89998 10.2001 3.89998H7.79998C6.94505 3.89998 6.35798 3.90068 5.90287 3.93786C5.45827 3.97419 5.21944 4.04079 5.0466 4.12886C4.65146 4.3302 4.3302 4.65146 4.12886 5.0466C4.04079 5.21944 3.97419 5.45827 3.93786 5.90287C3.90068 6.35798 3.89998 6.94505 3.89998 7.79998V10.2C3.89998 11.0549 3.90068 11.642 3.93786 12.0971C3.97419 12.5417 4.04079 12.7805 4.12886 12.9534C4.3302 13.3485 4.65146 13.6698 5.0466 13.8711C5.21944 13.9592 5.45827 14.0258 5.90287 14.0621C6.35798 14.0993 6.94505 14.1 7.79998 14.1H8.1ZM11.0466 10.1289C11.2195 10.0408 11.4583 9.97421 11.9029 9.93788C12.358 9.9007 12.9451 9.9 13.8 9.9H16.2C17.0549 9.9 17.642 9.9007 18.0971 9.93788C18.5417 9.97421 18.7805 10.0408 18.9534 10.1289C19.3485 10.3302 19.6698 10.6515 19.8711 11.0466C19.9592 11.2195 20.0258 11.4583 20.0621 11.9029C20.0993 12.358 20.1 12.9451 20.1 13.8V16.2C20.1 17.0549 20.0993 17.642 20.0621 18.0971C20.0258 18.5417 19.9592 18.7805 19.8711 18.9534C19.6698 19.3485 19.3485 19.6698 18.9534 19.8711C18.7805 19.9592 18.5417 20.0258 18.0971 20.0621C17.642 20.0993 17.0549 20.1 16.2 20.1H13.8C12.9451 20.1 12.358 20.0993 11.9029 20.0621C11.4583 20.0258 11.2195 19.9592 11.0466 19.8711C10.6515 19.6698 10.3302 19.3485 10.1289 18.9534C10.0408 18.7805 9.97421 18.5417 9.93788 18.0971C9.9007 17.642 9.9 17.0549 9.9 16.2V13.8C9.9 12.9451 9.9007 12.358 9.93788 11.9029C9.97421 11.4583 10.0408 11.2195 10.1289 11.0466C10.3302 10.6515 10.6515 10.3302 11.0466 10.1289Z"></path></svg>`);
7678
7954
  const CopyIcon = (props) => {
7679
7955
  const theme = useTheme();
7680
- const fill = () => props.fill || theme.colors.font.primary;
7956
+ const fill = () => props.fill || theme.colors.icon.primary;
7681
7957
  return (() => {
7682
7958
  const _el$ = _tmpl$$8.cloneNode(true), _el$2 = _el$.firstChild;
7683
7959
  createRenderEffect(() => setAttribute(_el$2, "fill", fill()));
@@ -7687,7 +7963,7 @@ const CopyIcon = (props) => {
7687
7963
  const _tmpl$$7 = /* @__PURE__ */ template$1(`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.0001 4.00003H8.80012C7.11996 4.00003 6.27989 4.00003 5.63815 4.32701C5.07366 4.61463 4.61472 5.07357 4.3271 5.63806C4.00012 6.27979 4.00012 7.11987 4.00012 8.80003V15.2C4.00012 16.8802 4.00012 17.7203 4.3271 18.362C4.61472 18.9265 5.07366 19.3854 5.63815 19.6731C6.27989 20 7.11996 20 8.80012 20H12.0001" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path><path d="M9 12H21M21 12L17 8M21 12L17 16" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"></path></svg>`);
7688
7964
  const DisconnectIcon = (props) => {
7689
7965
  const theme = useTheme();
7690
- const fill = () => props.fill || theme.colors.font.primary;
7966
+ const fill = () => props.fill || theme.colors.icon.primary;
7691
7967
  return (() => {
7692
7968
  const _el$ = _tmpl$$7.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
7693
7969
  createRenderEffect((_p$) => {
@@ -7724,17 +8000,27 @@ function fallbackCopyTextToClipboard(text) {
7724
8000
  document.body.removeChild(textArea);
7725
8001
  }
7726
8002
  }
8003
+ const hoverBorders = {
8004
+ m: "8px",
8005
+ s: "4px",
8006
+ none: "0"
8007
+ };
8008
+ const dropdownBorders = {
8009
+ m: "16px",
8010
+ s: "8px",
8011
+ none: "0"
8012
+ };
7727
8013
  const AccountButtonDropdownStyled = styled.div`
7728
8014
  width: 256px;
7729
8015
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
7730
- border-radius: 16px;
8016
+ border-radius: ${(props) => dropdownBorders[props.theme.borderRadius]};
7731
8017
 
7732
- background-color: ${(props) => props.theme.colors.backgroundPrimary}
8018
+ background-color: ${(props) => props.theme.colors.background.primary}
7733
8019
 
7734
- color: ${(props) => props.theme.colors.font.primary}
8020
+ color: ${(props) => props.theme.colors.text.primary}
7735
8021
  `;
7736
8022
  const UlStyled$1 = styled.ul`
7737
- background-color: ${(props) => props.theme.colors.backgroundPrimary};
8023
+ background-color: ${(props) => props.theme.colors.background.primary};
7738
8024
  padding: 8px;
7739
8025
  `;
7740
8026
  const MenuButtonStyled = styled.button`
@@ -7744,15 +8030,15 @@ const MenuButtonStyled = styled.button`
7744
8030
  padding: 12px;
7745
8031
  width: 100%;
7746
8032
 
7747
- background-color: ${(props) => props.theme.colors.backgroundPrimary};
8033
+ background-color: ${(props) => props.theme.colors.background.primary};
7748
8034
  border: none;
7749
- border-radius: 8px;
8035
+ border-radius: ${(props) => hoverBorders[props.theme.borderRadius]};
7750
8036
  cursor: pointer;
7751
8037
 
7752
8038
  transition: background-color, transform 0.1s ease-in-out;
7753
8039
 
7754
8040
  &:hover {
7755
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
8041
+ background-color: ${(props) => props.theme.colors.background.secondary};
7756
8042
  }
7757
8043
 
7758
8044
  &:active {
@@ -7793,6 +8079,9 @@ const AccountButtonDropdown = (props) => {
7793
8079
  get ["class"]() {
7794
8080
  return props.class;
7795
8081
  },
8082
+ get id() {
8083
+ return props.id;
8084
+ },
7796
8085
  get children() {
7797
8086
  return createComponent(UlStyled$1, {
7798
8087
  get children() {
@@ -7843,19 +8132,24 @@ const AccountButtonDropdown = (props) => {
7843
8132
  }
7844
8133
  });
7845
8134
  };
8135
+ const borders$1 = {
8136
+ m: "16px",
8137
+ s: "8px",
8138
+ none: "0"
8139
+ };
7846
8140
  const NotificationStyled = styled.div`
7847
8141
  width: 256px;
7848
8142
  padding: 12px 16px;
7849
8143
  display: flex;
7850
8144
  gap: 9px;
7851
8145
 
7852
- background-color: ${(props) => props.theme.colors.backgroundPrimary};
8146
+ background-color: ${(props) => props.theme.colors.background.primary};
7853
8147
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
7854
- border-radius: 16px;
8148
+ border-radius: ${(props) => borders$1[props.theme.borderRadius]};
7855
8149
  `;
7856
8150
  const TextStyled$2 = styled(Text)`
7857
8151
  margin-top: 4px;
7858
- color: ${(props) => props.theme.colors.font.secondary};
8152
+ color: ${(props) => props.theme.colors.text.secondary};
7859
8153
  `;
7860
8154
  const _tmpl$$5 = /* @__PURE__ */ template$1(`<div></div>`);
7861
8155
  const Notification = (props) => {
@@ -7893,7 +8187,7 @@ const Notification = (props) => {
7893
8187
  }
7894
8188
  }), null);
7895
8189
  return _el$;
7896
- })(), memo(() => props.icon)];
8190
+ })(), createMemo(() => props.icon)];
7897
8191
  }
7898
8192
  });
7899
8193
  };
@@ -7953,7 +8247,7 @@ const SuccessTransactionNotification = (props) => {
7953
8247
  return createComponent(SuccessIconStyled$1, {});
7954
8248
  },
7955
8249
  get ["class"]() {
7956
- return props.class;
8250
+ return cn(props.class, "tc-notification");
7957
8251
  },
7958
8252
  children: "Transaction sent"
7959
8253
  });
@@ -8044,25 +8338,40 @@ const Notifications = (props) => {
8044
8338
  });
8045
8339
  }
8046
8340
  }));
8047
- createRenderEffect(() => className(_el$, props.class));
8341
+ createRenderEffect((_p$) => {
8342
+ const _v$ = props.class, _v$2 = props.id;
8343
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
8344
+ _v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
8345
+ return _p$;
8346
+ }, {
8347
+ _v$: void 0,
8348
+ _v$2: void 0
8349
+ });
8048
8350
  return _el$;
8049
8351
  })();
8050
8352
  };
8051
8353
  const AccountButtonStyled = styled(Button)`
8354
+ background-color: ${(props) => props.theme.colors.connectButton.background};
8355
+ color: ${(props) => props.theme.colors.connectButton.foreground};
8356
+ box-shadow: ${(props) => `0 4px 24px ${rgba(props.theme.colors.constant.black, 0.16)}`};
8357
+
8052
8358
  display: flex;
8053
8359
  align-items: center;
8054
8360
  gap: 9px;
8055
8361
 
8056
- transition: background-color 0.1s ease-in-out;
8362
+ transition: all 0.1s ease-in-out;
8057
8363
 
8058
8364
  &:hover:not(:active) {
8059
8365
  transform: scale(1);
8060
8366
  }
8061
8367
 
8062
8368
  &:hover {
8063
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
8369
+ filter: ${(props) => `brightness(${props.theme.theme === THEME.DARK ? 1.07 : 0.95})`};
8064
8370
  }
8065
8371
  `;
8372
+ const DropdownButtonStyled = styled(AccountButtonStyled)`
8373
+ background-color: ${(props) => props.theme.colors.background.primary};
8374
+ `;
8066
8375
  const DropdownContainerStyled = styled.div`
8067
8376
  display: flex;
8068
8377
  flex-direction: column;
@@ -8153,7 +8462,7 @@ const computePosition$1 = (reference, floating, config) => __async(void 0, null,
8153
8462
  } = config;
8154
8463
  const validMiddleware = middleware.filter(Boolean);
8155
8464
  const rtl = yield platform2.isRTL == null ? void 0 : platform2.isRTL(floating);
8156
- if (process.env.NODE_ENV !== "production") {
8465
+ if ({}.NODE_ENV !== "production") {
8157
8466
  if (platform2 == null) {
8158
8467
  console.error(["Floating UI: `platform` property was not passed to config. If you", "want to use Floating UI on the web, install @floating-ui/dom", "instead of the /core package. Otherwise, you can create your own", "`platform`: https://floating-ui.com/docs/platform"].join(" "));
8159
8468
  }
@@ -8210,7 +8519,7 @@ const computePosition$1 = (reference, floating, config) => __async(void 0, null,
8210
8519
  middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
8211
8520
  [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
8212
8521
  });
8213
- if (process.env.NODE_ENV !== "production") {
8522
+ if ({}.NODE_ENV !== "production") {
8214
8523
  if (resetCount > 50) {
8215
8524
  console.warn(["Floating UI: The middleware lifecycle appears to be running in an", "infinite loop. This is usually caused by a `reset` continually", "being returned without a break condition."].join(" "));
8216
8525
  }
@@ -8822,8 +9131,9 @@ function P(l2, u2, e2) {
8822
9131
  return n2().middlewareData;
8823
9132
  }, update: i2 };
8824
9133
  }
8825
- const _tmpl$$3 = /* @__PURE__ */ template$1(`<div></div>`);
9134
+ const _tmpl$$3 = /* @__PURE__ */ template$1(`<div id="tc-dropdown-container"></div>`);
8826
9135
  const AccountButton = () => {
9136
+ const theme = useTheme();
8827
9137
  const connector = useContext(ConnectorContext);
8828
9138
  const tonConnectUI2 = useContext(TonConnectUiContext);
8829
9139
  const [isOpened, setIsOpened] = createSignal(false);
@@ -8873,14 +9183,21 @@ const AccountButton = () => {
8873
9183
  },
8874
9184
  get children() {
8875
9185
  return createComponent(AccountButtonStyled, {
8876
- appearance: "flat",
8877
9186
  onClick: () => tonConnectUI2.connectWallet(),
9187
+ id: "tc-connect-button",
8878
9188
  get children() {
8879
- return [createComponent(TonIcon, {}), createComponent(Text, {
9189
+ return [createComponent(TonIcon, {
9190
+ get fill() {
9191
+ return theme.colors.connectButton.foreground;
9192
+ }
9193
+ }), createComponent(Text, {
8880
9194
  translationKey: "button.connectWallet",
8881
9195
  fontSize: "15px",
8882
9196
  letterSpacing: "-0.24px",
8883
9197
  fontWeight: "590",
9198
+ get color() {
9199
+ return theme.colors.connectButton.foreground;
9200
+ },
8884
9201
  children: "Connect wallet"
8885
9202
  })];
8886
9203
  }
@@ -8893,10 +9210,10 @@ const AccountButton = () => {
8893
9210
  get children() {
8894
9211
  return createComponent(DropdownContainerStyled, {
8895
9212
  get children() {
8896
- return [createComponent(AccountButtonStyled, {
8897
- appearance: "flat",
9213
+ return [createComponent(DropdownButtonStyled, {
8898
9214
  onClick: () => setIsOpened((v) => !v),
8899
9215
  ref: setAnchor,
9216
+ id: "tc-dropdown-button",
8900
9217
  get children() {
8901
9218
  return [createComponent(Text, {
8902
9219
  fontSize: "15px",
@@ -8952,13 +9269,16 @@ const AccountButton = () => {
8952
9269
  ref(r$) {
8953
9270
  const _ref$ = dropDownRef;
8954
9271
  typeof _ref$ === "function" ? _ref$(r$) : dropDownRef = r$;
8955
- }
9272
+ },
9273
+ id: "tc-dropdown"
8956
9274
  });
8957
9275
  }
8958
9276
  });
8959
9277
  }
8960
9278
  }), null);
8961
- insert(_el$, createComponent(NotificationsStyled, {}), null);
9279
+ insert(_el$, createComponent(NotificationsStyled, {
9280
+ id: "tc-notifications"
9281
+ }), null);
8962
9282
  createRenderEffect((_p$) => {
8963
9283
  var _a, _b;
8964
9284
  const _v$ = position.strategy, _v$2 = `${(_a = position.y) != null ? _a : 0}px`, _v$3 = `${(_b = position.x) != null ? _b : 0}px`;
@@ -8996,14 +9316,14 @@ const QrCodeStyled = styled.div`
8996
9316
  }
8997
9317
 
8998
9318
  path {
8999
- fill: ${(props) => props.theme.colors.font.primary};
9319
+ fill: ${(props) => props.theme.colors.text.primary};
9000
9320
  }
9001
9321
  `;
9002
9322
  const ImageBackground = styled.div`
9003
9323
  position: absolute;
9004
9324
  width: 52px;
9005
9325
  height: 52px;
9006
- background: ${(props) => props.theme.colors.backgroundSecondary};
9326
+ background: ${(props) => props.theme.colors.background.secondary};
9007
9327
  padding: 7px;
9008
9328
  top: 112px;
9009
9329
  left: 112px;
@@ -10696,6 +11016,11 @@ const Translation = (props) => {
10696
11016
  const [t2] = useI18n();
10697
11017
  return t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString());
10698
11018
  };
11019
+ const borders = {
11020
+ m: "16px",
11021
+ s: "8px",
11022
+ none: "0"
11023
+ };
10699
11024
  const QrCodeModalStyled = styled.div`
10700
11025
  padding: 0 24px;
10701
11026
  `;
@@ -10706,8 +11031,8 @@ const StyledIconButton = styled(IconButton)`
10706
11031
  `;
10707
11032
  const QRBackgroundStyled = styled.div`
10708
11033
  margin-bottom: 16px;
10709
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
10710
- border-radius: 16px;
11034
+ background-color: ${(props) => props.theme.colors.background.secondary};
11035
+ border-radius: ${(props) => borders[props.theme.borderRadius]};
10711
11036
  display: flex;
10712
11037
  align-items: center;
10713
11038
  justify-content: center;
@@ -10724,6 +11049,7 @@ const ActionButtonStyled = styled(Button)`
10724
11049
  line-height: 20px;
10725
11050
  letter-spacing: -0.32px;
10726
11051
  width: 100%;
11052
+ border-radius: ${(props) => borders[props.theme.borderRadius]};
10727
11053
  `;
10728
11054
  const GetWalletStyled = styled.div`
10729
11055
  display: flex;
@@ -10731,7 +11057,7 @@ const GetWalletStyled = styled.div`
10731
11057
  align-items: center;
10732
11058
  `;
10733
11059
  const TextStyled$1 = styled(Text)`
10734
- color: ${(props) => props.theme.colors.font.secondary};
11060
+ color: ${(props) => props.theme.colors.text.secondary};
10735
11061
  font-size: 16px;
10736
11062
  `;
10737
11063
  function openLink(href, target = "_self") {
@@ -10758,6 +11084,9 @@ const QrCodeModal = (props) => {
10758
11084
  bridgeUrl: props.wallet.bridgeUrl
10759
11085
  });
10760
11086
  return createComponent(QrCodeModalStyled, {
11087
+ get id() {
11088
+ return props.id;
11089
+ },
10761
11090
  get children() {
10762
11091
  return [createComponent(StyledIconButton, {
10763
11092
  icon: "arrow",
@@ -10770,7 +11099,7 @@ const QrCodeModal = (props) => {
10770
11099
  };
10771
11100
  },
10772
11101
  get children() {
10773
- return ["Connect with ", memo(() => props.wallet.name)];
11102
+ return ["Connect with ", createMemo(() => props.wallet.name)];
10774
11103
  }
10775
11104
  }), createComponent(H2, {
10776
11105
  translationKey: "walletModal.qrCodeModal.scan",
@@ -10780,7 +11109,7 @@ const QrCodeModal = (props) => {
10780
11109
  };
10781
11110
  },
10782
11111
  get children() {
10783
- return ["Scan QR code with your phone’s or ", memo(() => props.wallet.name), "’s camera."];
11112
+ return ["Scan QR code with your phone’s or ", createMemo(() => props.wallet.name), "’s camera."];
10784
11113
  }
10785
11114
  }), createComponent(QRBackgroundStyled, {
10786
11115
  get children() {
@@ -10794,7 +11123,6 @@ const QrCodeModal = (props) => {
10794
11123
  }), createComponent(ButtonsContainerStyled, {
10795
11124
  get children() {
10796
11125
  return [createComponent(ActionButtonStyled, {
10797
- appearance: "secondary",
10798
11126
  onClick: () => openLink(universalLink),
10799
11127
  get children() {
10800
11128
  return createComponent(Translation, {
@@ -10805,7 +11133,7 @@ const QrCodeModal = (props) => {
10805
11133
  };
10806
11134
  },
10807
11135
  get children() {
10808
- return ["Open ", memo(() => props.wallet.name)];
11136
+ return ["Open ", createMemo(() => props.wallet.name)];
10809
11137
  }
10810
11138
  });
10811
11139
  }
@@ -10815,7 +11143,6 @@ const QrCodeModal = (props) => {
10815
11143
  },
10816
11144
  get children() {
10817
11145
  return createComponent(ActionButtonStyled, {
10818
- appearance: "secondary",
10819
11146
  onClick: () => connector.connect({
10820
11147
  jsBridgeKey: props.wallet.jsBridgeKey
10821
11148
  }),
@@ -10839,10 +11166,9 @@ const QrCodeModal = (props) => {
10839
11166
  };
10840
11167
  },
10841
11168
  get children() {
10842
- return ["Don't have ", memo(() => props.wallet.name), "?"];
11169
+ return ["Don't have ", createMemo(() => props.wallet.name), "?"];
10843
11170
  }
10844
11171
  }), createComponent(Button, {
10845
- appearance: "secondary",
10846
11172
  onClick: () => openLinkBlank(props.wallet.aboutUrl),
10847
11173
  get children() {
10848
11174
  return createComponent(Translation, {
@@ -10960,6 +11286,9 @@ const _tmpl$ = /* @__PURE__ */ template$1(`<li></li>`);
10960
11286
  const SelectWalletModal = (props) => {
10961
11287
  const learnMoreUrl = "https://ton.org/wallets";
10962
11288
  return createComponent(SelectWalletModalStyled, {
11289
+ get id() {
11290
+ return props.id;
11291
+ },
10963
11292
  get children() {
10964
11293
  return [createComponent(H1, {
10965
11294
  translationKey: "walletModal.selectWalletModal.connectWallet",
@@ -10989,7 +11318,6 @@ const SelectWalletModal = (props) => {
10989
11318
  });
10990
11319
  }
10991
11320
  }), createComponent(ButtonStyled$1, {
10992
- appearance: "secondary",
10993
11321
  onClick: () => openLinkBlank(learnMoreUrl),
10994
11322
  get children() {
10995
11323
  return createComponent(Translation, {
@@ -11001,12 +11329,6 @@ const SelectWalletModal = (props) => {
11001
11329
  }
11002
11330
  });
11003
11331
  };
11004
- const ModalWrapper = styled.div`
11005
- color: ${(props) => {
11006
- var _a;
11007
- return ((_a = props.theme) == null ? void 0 : _a.accentColor) || "blue";
11008
- }};
11009
- `;
11010
11332
  const StyledModal = styled(Modal)`
11011
11333
  padding-left: 0;
11012
11334
  padding-right: 0;
@@ -11039,8 +11361,52 @@ const LoaderContainerStyled = styled.div`
11039
11361
  `;
11040
11362
  const [appState, setAppState] = createStore({
11041
11363
  buttonRootId: null,
11042
- language: "en"
11364
+ language: "en",
11365
+ walletsList: {}
11043
11366
  });
11367
+ function uiWalletToWalletInfo(uiWallet) {
11368
+ if ("jsBridgeKey" in uiWallet) {
11369
+ return __spreadProps(__spreadValues({}, uiWallet), {
11370
+ injected: TonConnect.isWalletInjected(uiWallet.jsBridgeKey),
11371
+ embedded: TonConnect.isInsideWalletBrowser(uiWallet.jsBridgeKey)
11372
+ });
11373
+ }
11374
+ return uiWallet;
11375
+ }
11376
+ function applyWalletsListConfiguration(walletsList, configuration) {
11377
+ var _a;
11378
+ if (!configuration) {
11379
+ return walletsList;
11380
+ }
11381
+ if ("wallets" in configuration) {
11382
+ return configuration.wallets.map((wallet) => {
11383
+ if (typeof wallet === "string") {
11384
+ const walletInfo = walletsList.find((item) => item.name === wallet);
11385
+ if (!walletInfo) {
11386
+ console.error(
11387
+ `Wallet with name === '${wallet}' wasn't found in the wallets list. Check '${wallet}' correctness. Available wallets names: ${walletsList.map((i2) => "'" + i2.name + "'").join(", ")}`
11388
+ );
11389
+ return null;
11390
+ }
11391
+ return walletInfo;
11392
+ }
11393
+ return uiWalletToWalletInfo(wallet);
11394
+ }).filter((i2) => !!i2);
11395
+ }
11396
+ const filteredWalletsList = ((_a = configuration.excludeWallets) == null ? void 0 : _a.length) ? walletsList.filter(
11397
+ (wallet) => {
11398
+ var _a2;
11399
+ return (_a2 = configuration.excludeWallets) == null ? void 0 : _a2.every((item) => item !== wallet.name);
11400
+ }
11401
+ ) : walletsList;
11402
+ if (!configuration.includeWallets) {
11403
+ return filteredWalletsList;
11404
+ }
11405
+ if (configuration.includeWalletsOrder === "start") {
11406
+ return configuration.includeWallets.map(uiWalletToWalletInfo).concat(walletsList);
11407
+ }
11408
+ return walletsList.concat(configuration.includeWallets.map(uiWalletToWalletInfo));
11409
+ }
11044
11410
  const WalletsModal = () => {
11045
11411
  const {
11046
11412
  locale
@@ -11048,8 +11414,14 @@ const WalletsModal = () => {
11048
11414
  createEffect(() => locale(appState.language));
11049
11415
  const connector = useContext(ConnectorContext);
11050
11416
  const tonConnectUI2 = useContext(TonConnectUiContext);
11051
- const [walletsList] = createResource(() => tonConnectUI2.getWallets());
11417
+ const [fetchedWalletsList] = createResource(() => tonConnectUI2.getWallets());
11052
11418
  const [selectedWalletInfo, setSelectedWalletInfo] = createSignal(null);
11419
+ const walletsList = createMemo(() => {
11420
+ if (fetchedWalletsList.state !== "ready") {
11421
+ return null;
11422
+ }
11423
+ return applyWalletsListConfiguration(fetchedWalletsList(), appState.walletsList);
11424
+ });
11053
11425
  const onClose = () => {
11054
11426
  setWalletsModalOpen(false);
11055
11427
  setSelectedWalletInfo(null);
@@ -11062,7 +11434,11 @@ const WalletsModal = () => {
11062
11434
  if (isWalletInfoInjected(walletInfo) && walletInfo.injected) {
11063
11435
  return onSelectIfInjected(walletInfo);
11064
11436
  }
11065
- setSelectedWalletInfo(walletInfo);
11437
+ if ("bridgeUrl" in walletInfo) {
11438
+ setSelectedWalletInfo(walletInfo);
11439
+ return;
11440
+ }
11441
+ openLink(walletInfo.aboutUrl, "_blank");
11066
11442
  };
11067
11443
  const onSelectIfMobile = (walletInfo) => {
11068
11444
  const universalLink = connector.connect({
@@ -11082,66 +11458,63 @@ const WalletsModal = () => {
11082
11458
  }
11083
11459
  });
11084
11460
  onCleanup(unsubscribe);
11085
- return createComponent(ModalWrapper, {
11461
+ return createComponent(StyledModal, {
11462
+ get opened() {
11463
+ return walletsModalOpen();
11464
+ },
11465
+ onClose,
11466
+ id: "tc-wallets-modal-container",
11086
11467
  get children() {
11087
- return createComponent(StyledModal, {
11088
- get opened() {
11089
- return walletsModalOpen();
11468
+ return [createComponent(Show, {
11469
+ get when() {
11470
+ return !walletsList();
11471
+ },
11472
+ get children() {
11473
+ return [createComponent(H1Styled$1, {
11474
+ translationKey: "walletModal.loading",
11475
+ children: "Wallets list is loading"
11476
+ }), createComponent(LoaderContainerStyled, {
11477
+ get children() {
11478
+ return createComponent(LoaderIconStyled$1, {});
11479
+ }
11480
+ })];
11481
+ }
11482
+ }), createComponent(Show, {
11483
+ get when() {
11484
+ return walletsList();
11090
11485
  },
11091
- onClose,
11092
11486
  get children() {
11093
11487
  return [createComponent(Show, {
11094
11488
  get when() {
11095
- return walletsList.state !== "ready";
11489
+ return !selectedWalletInfo();
11096
11490
  },
11491
+ keyed: false,
11097
11492
  get children() {
11098
- return [createComponent(H1Styled$1, {
11099
- translationKey: "walletModal.loading",
11100
- children: "Wallets list is loading"
11101
- }), createComponent(LoaderContainerStyled, {
11102
- get children() {
11103
- return createComponent(LoaderIconStyled$1, {
11104
- fill: "#7A899970"
11105
- });
11106
- }
11107
- })];
11493
+ return createComponent(SelectWalletModal, {
11494
+ get walletsList() {
11495
+ return walletsList();
11496
+ },
11497
+ onSelect,
11498
+ id: "tc-wallets-modal"
11499
+ });
11108
11500
  }
11109
11501
  }), createComponent(Show, {
11110
11502
  get when() {
11111
- return walletsList.state === "ready";
11503
+ return selectedWalletInfo();
11112
11504
  },
11505
+ keyed: false,
11113
11506
  get children() {
11114
- return [createComponent(Show, {
11115
- get when() {
11116
- return !selectedWalletInfo();
11117
- },
11118
- keyed: false,
11119
- get children() {
11120
- return createComponent(SelectWalletModal, {
11121
- get walletsList() {
11122
- return walletsList();
11123
- },
11124
- onSelect
11125
- });
11126
- }
11127
- }), createComponent(Show, {
11128
- get when() {
11507
+ return createComponent(QrCodeModal, {
11508
+ get wallet() {
11129
11509
  return selectedWalletInfo();
11130
11510
  },
11131
- keyed: false,
11132
- get children() {
11133
- return createComponent(QrCodeModal, {
11134
- get wallet() {
11135
- return selectedWalletInfo();
11136
- },
11137
- onBackClick: () => setSelectedWalletInfo(null)
11138
- });
11139
- }
11140
- })];
11511
+ onBackClick: () => setSelectedWalletInfo(null),
11512
+ id: "tc-qr-modal"
11513
+ });
11141
11514
  }
11142
11515
  })];
11143
11516
  }
11144
- });
11517
+ })];
11145
11518
  }
11146
11519
  });
11147
11520
  };
@@ -11162,15 +11535,18 @@ const TextStyled = styled(Text)`
11162
11535
  text-align: center;
11163
11536
  max-width: 250px;
11164
11537
 
11165
- color: ${(props) => props.theme.colors.font.secondary};
11538
+ color: ${(props) => props.theme.colors.text.secondary};
11166
11539
  `;
11167
11540
  const ButtonStyled = styled(Button)`
11168
11541
  margin-top: 32px;
11169
11542
  `;
11170
11543
  const ActionModal = (props) => {
11171
11544
  return createComponent(ActionModalStyled, {
11545
+ get id() {
11546
+ return props.id;
11547
+ },
11172
11548
  get children() {
11173
- return [memo(() => props.icon), createComponent(H1Styled, {
11549
+ return [createMemo(() => props.icon), createComponent(H1Styled, {
11174
11550
  get translationKey() {
11175
11551
  return props.headerTranslationKey;
11176
11552
  }
@@ -11184,7 +11560,6 @@ const ActionModal = (props) => {
11184
11560
  },
11185
11561
  get children() {
11186
11562
  return createComponent(ButtonStyled, {
11187
- appearance: "secondary",
11188
11563
  onClick: () => props.onClose(),
11189
11564
  get children() {
11190
11565
  return createComponent(Translation, {
@@ -11207,12 +11582,13 @@ const ConfirmTransactionModal = (props) => {
11207
11582
  headerTranslationKey: "actionModal.confirmTransaction.header",
11208
11583
  textTranslationKey: "actionModal.confirmTransaction.text",
11209
11584
  get icon() {
11210
- return createComponent(LoaderIconStyled, {
11211
- fill: "#7A899970"
11212
- });
11585
+ return createComponent(LoaderIconStyled, {});
11213
11586
  },
11214
11587
  onClose: () => props.onClose(),
11215
- showButton: false
11588
+ showButton: false,
11589
+ get id() {
11590
+ return props.id;
11591
+ }
11216
11592
  });
11217
11593
  };
11218
11594
  const ErrorIconStyled = styled(ErrorIcon)`
@@ -11226,7 +11602,10 @@ const TransactionCanceledModal = (props) => {
11226
11602
  get icon() {
11227
11603
  return createComponent(ErrorIconStyled, {});
11228
11604
  },
11229
- onClose: () => props.onClose()
11605
+ onClose: () => props.onClose(),
11606
+ get id() {
11607
+ return props.id;
11608
+ }
11230
11609
  });
11231
11610
  };
11232
11611
  const SuccessIconStyled = styled(SuccessIcon)`
@@ -11240,16 +11619,20 @@ const TransactionSentModal = (props) => {
11240
11619
  get icon() {
11241
11620
  return createComponent(SuccessIconStyled, {});
11242
11621
  },
11243
- onClose: () => props.onClose()
11622
+ onClose: () => props.onClose(),
11623
+ get id() {
11624
+ return props.id;
11625
+ }
11244
11626
  });
11245
11627
  };
11246
11628
  const ActionsModal = () => {
11247
11629
  return createComponent(Modal, {
11248
11630
  get opened() {
11249
11631
  var _a;
11250
- return memo(() => action() !== null, true)() && ((_a = action()) == null ? void 0 : _a.openModal) === true;
11632
+ return createMemo(() => action() !== null)() && ((_a = action()) == null ? void 0 : _a.openModal) === true;
11251
11633
  },
11252
11634
  onClose: () => setAction(null),
11635
+ id: "tc-actions-modal-container",
11253
11636
  get children() {
11254
11637
  return createComponent(Switch, {
11255
11638
  get children() {
@@ -11259,7 +11642,8 @@ const ActionsModal = () => {
11259
11642
  },
11260
11643
  get children() {
11261
11644
  return createComponent(TransactionSentModal, {
11262
- onClose: () => setAction(null)
11645
+ onClose: () => setAction(null),
11646
+ id: "tc-transaction-sent-modal"
11263
11647
  });
11264
11648
  }
11265
11649
  }), createComponent(Match, {
@@ -11268,7 +11652,8 @@ const ActionsModal = () => {
11268
11652
  },
11269
11653
  get children() {
11270
11654
  return createComponent(TransactionCanceledModal, {
11271
- onClose: () => setAction(null)
11655
+ onClose: () => setAction(null),
11656
+ id: "tc-transaction-canceled-modal"
11272
11657
  });
11273
11658
  }
11274
11659
  }), createComponent(Match, {
@@ -11277,7 +11662,8 @@ const ActionsModal = () => {
11277
11662
  },
11278
11663
  get children() {
11279
11664
  return createComponent(ConfirmTransactionModal, {
11280
- onClose: () => setAction(null)
11665
+ onClose: () => setAction(null),
11666
+ id: "tc-confirm-modal"
11281
11667
  });
11282
11668
  }
11283
11669
  })];
@@ -11369,146 +11755,20 @@ class WalletInfoStorage {
11369
11755
  this.localStorage.removeItem(this.storageKey);
11370
11756
  }
11371
11757
  }
11372
- var isMergeableObject = function isMergeableObject2(value) {
11373
- return isNonNullObject(value) && !isSpecial(value);
11374
- };
11375
- function isNonNullObject(value) {
11376
- return !!value && typeof value === "object";
11377
- }
11378
- function isSpecial(value) {
11379
- var stringValue = Object.prototype.toString.call(value);
11380
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
11381
- }
11382
- var canUseSymbol = typeof Symbol === "function" && Symbol.for;
11383
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
11384
- function isReactElement(value) {
11385
- return value.$$typeof === REACT_ELEMENT_TYPE;
11386
- }
11387
- function emptyTarget(val) {
11388
- return Array.isArray(val) ? [] : {};
11389
- }
11390
- function cloneUnlessOtherwiseSpecified(value, options) {
11391
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
11392
- }
11393
- function defaultArrayMerge(target, source, options) {
11394
- return target.concat(source).map(function(element) {
11395
- return cloneUnlessOtherwiseSpecified(element, options);
11396
- });
11397
- }
11398
- function getMergeFunction(key, options) {
11399
- if (!options.customMerge) {
11400
- return deepmerge;
11401
- }
11402
- var customMerge = options.customMerge(key);
11403
- return typeof customMerge === "function" ? customMerge : deepmerge;
11404
- }
11405
- function getEnumerableOwnPropertySymbols(target) {
11406
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
11407
- return target.propertyIsEnumerable(symbol);
11408
- }) : [];
11409
- }
11410
- function getKeys(target) {
11411
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
11412
- }
11413
- function propertyIsOnObject(object, property) {
11414
- try {
11415
- return property in object;
11416
- } catch (_) {
11417
- return false;
11418
- }
11419
- }
11420
- function propertyIsUnsafe(target, key) {
11421
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
11422
- }
11423
- function mergeObject(target, source, options) {
11424
- var destination = {};
11425
- if (options.isMergeableObject(target)) {
11426
- getKeys(target).forEach(function(key) {
11427
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
11428
- });
11429
- }
11430
- getKeys(source).forEach(function(key) {
11431
- if (propertyIsUnsafe(target, key)) {
11432
- return;
11433
- }
11434
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
11435
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
11436
- } else {
11437
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
11438
- }
11439
- });
11440
- return destination;
11441
- }
11442
- function deepmerge(target, source, options) {
11443
- options = options || {};
11444
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
11445
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
11446
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
11447
- var sourceIsArray = Array.isArray(source);
11448
- var targetIsArray = Array.isArray(target);
11449
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
11450
- if (!sourceAndTargetTypesMatch) {
11451
- return cloneUnlessOtherwiseSpecified(source, options);
11452
- } else if (sourceIsArray) {
11453
- return options.arrayMerge(target, source, options);
11454
- } else {
11455
- return mergeObject(target, source, options);
11456
- }
11457
- }
11458
- deepmerge.all = function deepmergeAll(array, options) {
11459
- if (!Array.isArray(array)) {
11460
- throw new Error("first argument should be an array");
11461
- }
11462
- return array.reduce(function(prev, next) {
11463
- return deepmerge(prev, next, options);
11464
- }, {});
11465
- };
11466
- var deepmerge_1 = deepmerge;
11467
- var cjs = deepmerge_1;
11468
- /*!
11469
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
11470
- *
11471
- * Copyright (c) 2014-2017, Jon Schlinkert.
11472
- * Released under the MIT License.
11473
- */
11474
- function isObject(o2) {
11475
- return Object.prototype.toString.call(o2) === "[object Object]";
11476
- }
11477
- function isPlainObject(o2) {
11478
- var ctor, prot;
11479
- if (isObject(o2) === false)
11480
- return false;
11481
- ctor = o2.constructor;
11482
- if (ctor === void 0)
11483
- return true;
11484
- prot = ctor.prototype;
11485
- if (isObject(prot) === false)
11486
- return false;
11487
- if (prot.hasOwnProperty("isPrototypeOf") === false) {
11488
- return false;
11489
- }
11490
- return true;
11491
- }
11492
- function mergeOptions(options, defaultOptions) {
11493
- if (!options) {
11494
- return defaultOptions;
11495
- }
11496
- const overwriteMerge = (_, sourceArray, __) => sourceArray;
11497
- return cjs(defaultOptions, options, {
11498
- arrayMerge: overwriteMerge,
11499
- isMergeableObject: isPlainObject
11500
- });
11501
- }
11502
11758
  class TonConnectUI {
11503
11759
  constructor(options) {
11504
11760
  __publicField(this, "walletInfoStorage", new WalletInfoStorage());
11505
11761
  __publicField(this, "connector");
11506
11762
  __publicField(this, "_walletInfo", null);
11507
11763
  __publicField(this, "systemThemeChangeUnsubscribe", null);
11764
+ __publicField(this, "actionsConfiguration");
11508
11765
  if (options && "connector" in options && options.connector) {
11509
11766
  this.connector = options.connector;
11510
11767
  } else if (options && "manifestUrl" in options && options.manifestUrl) {
11511
- this.connector = new TonConnect({ manifestUrl: options.manifestUrl });
11768
+ this.connector = new TonConnect({
11769
+ manifestUrl: options.manifestUrl,
11770
+ walletsListSource: options.walletsListSource
11771
+ });
11512
11772
  } else {
11513
11773
  throw new TonConnectUIError(
11514
11774
  "You have to specify a `manifestUrl` or a `connector` in the options."
@@ -11518,9 +11778,13 @@ class TonConnectUI {
11518
11778
  const rootId = this.normalizeWidgetRoot(options == null ? void 0 : options.widgetRootId);
11519
11779
  this.subscribeToWalletChange();
11520
11780
  if ((options == null ? void 0 : options.restoreConnection) !== false) {
11521
- this.connector.restoreConnection();
11781
+ this.connector.restoreConnection().then(() => {
11782
+ if (!this.connector.connected) {
11783
+ this.walletInfoStorage.removeWalletInfo();
11784
+ }
11785
+ });
11522
11786
  }
11523
- this.uiOptions = options || {};
11787
+ this.uiOptions = mergeOptions(options, { uiPreferences: { theme: "SYSTEM" } });
11524
11788
  setAppState({ connector: this.connector });
11525
11789
  widgetController.renderApp(rootId, this);
11526
11790
  }
@@ -11540,28 +11804,30 @@ class TonConnectUI {
11540
11804
  return this._walletInfo;
11541
11805
  }
11542
11806
  set uiOptions(options) {
11543
- var _a;
11807
+ var _a, _b, _c, _d, _e;
11544
11808
  this.checkButtonRootExist(options.buttonRootId);
11545
- if (options.theme === "SYSTEM") {
11546
- setTheme(getSystemTheme());
11547
- if (!this.systemThemeChangeUnsubscribe) {
11548
- this.systemThemeChangeUnsubscribe = subscribeToThemeChange(
11549
- (theme) => setTheme(theme)
11550
- );
11809
+ this.actionsConfiguration = options.actionsConfiguration;
11810
+ if ((_a = options.uiPreferences) == null ? void 0 : _a.theme) {
11811
+ if (((_b = options.uiPreferences) == null ? void 0 : _b.theme) !== "SYSTEM") {
11812
+ (_c = this.systemThemeChangeUnsubscribe) == null ? void 0 : _c.call(this);
11813
+ setTheme(options.uiPreferences.theme, options.uiPreferences.colorsSet);
11814
+ } else {
11815
+ setTheme(getSystemTheme(), options.uiPreferences.colorsSet);
11816
+ if (!this.systemThemeChangeUnsubscribe) {
11817
+ this.systemThemeChangeUnsubscribe = subscribeToThemeChange(setTheme);
11818
+ }
11551
11819
  }
11552
11820
  } else {
11553
- if (options.theme) {
11554
- (_a = this.systemThemeChangeUnsubscribe) == null ? void 0 : _a.call(this);
11555
- setTheme(options.theme);
11821
+ if ((_d = options.uiPreferences) == null ? void 0 : _d.colorsSet) {
11822
+ setColors(options.uiPreferences.colorsSet);
11556
11823
  }
11557
11824
  }
11825
+ if ((_e = options.uiPreferences) == null ? void 0 : _e.borderRadius) {
11826
+ setBorderRadius(options.uiPreferences.borderRadius);
11827
+ }
11558
11828
  setAppState((state) => {
11559
11829
  const merged = mergeOptions(
11560
- {
11561
- language: options.language,
11562
- buttonConfiguration: options.buttonConfiguration,
11563
- widgetConfiguration: options.widgetConfiguration
11564
- },
11830
+ __spreadValues(__spreadValues({}, options.language && { language: options.language }), !!options.walletsList && { walletsList: options.walletsList }),
11565
11831
  unwrap(state)
11566
11832
  );
11567
11833
  if (options.buttonRootId !== void 0) {
@@ -11622,25 +11888,24 @@ class TonConnectUI {
11622
11888
  if (!isDevice("desktop") && "universalLink" in this.walletInfo) {
11623
11889
  openLink(this.walletInfo.universalLink);
11624
11890
  }
11625
- const notification = (options == null ? void 0 : options.notifications) || ["before", "success", "error"];
11626
- const modals = (options == null ? void 0 : options.modals) || ["before"];
11891
+ const { notifications: notifications2, modals } = this.getModalsAndNotificationsConfiguration(options);
11627
11892
  widgetController.setAction({
11628
11893
  name: "confirm-transaction",
11629
- showNotification: notification.includes("before"),
11894
+ showNotification: notifications2.includes("before"),
11630
11895
  openModal: modals.includes("before")
11631
11896
  });
11632
11897
  try {
11633
11898
  const result = yield this.connector.sendTransaction(tx);
11634
11899
  widgetController.setAction({
11635
11900
  name: "transaction-sent",
11636
- showNotification: notification.includes("success"),
11901
+ showNotification: notifications2.includes("success"),
11637
11902
  openModal: modals.includes("success")
11638
11903
  });
11639
11904
  return result;
11640
11905
  } catch (e2) {
11641
11906
  widgetController.setAction({
11642
11907
  name: "transaction-canceled",
11643
- showNotification: notification.includes("error"),
11908
+ showNotification: notifications2.includes("error"),
11644
11909
  openModal: modals.includes("error")
11645
11910
  });
11646
11911
  if (e2 instanceof TonConnectError$1) {
@@ -11649,8 +11914,6 @@ class TonConnectUI {
11649
11914
  console.error(e2);
11650
11915
  throw new TonConnectUIError("Unhandled error:" + e2);
11651
11916
  }
11652
- } finally {
11653
- widgetController.clearAction();
11654
11917
  }
11655
11918
  });
11656
11919
  }
@@ -11689,6 +11952,44 @@ class TonConnectUI {
11689
11952
  throw new TonConnectUIError(`${buttonRootId2} element not found in the document.`);
11690
11953
  }
11691
11954
  }
11955
+ getModalsAndNotificationsConfiguration(options) {
11956
+ var _a, _b, _c;
11957
+ const allActions = [
11958
+ "before",
11959
+ "success",
11960
+ "error"
11961
+ ];
11962
+ let notifications2 = allActions;
11963
+ if (((_a = this.actionsConfiguration) == null ? void 0 : _a.notifications) && ((_b = this.actionsConfiguration) == null ? void 0 : _b.notifications) !== "all") {
11964
+ notifications2 = this.actionsConfiguration.notifications;
11965
+ }
11966
+ if (options == null ? void 0 : options.notifications) {
11967
+ if (options.notifications === "all") {
11968
+ notifications2 = allActions;
11969
+ } else {
11970
+ notifications2 = options.notifications;
11971
+ }
11972
+ }
11973
+ let modals = ["before"];
11974
+ if ((_c = this.actionsConfiguration) == null ? void 0 : _c.modals) {
11975
+ if (this.actionsConfiguration.modals === "all") {
11976
+ modals = allActions;
11977
+ } else {
11978
+ modals = this.actionsConfiguration.modals;
11979
+ }
11980
+ }
11981
+ if (options == null ? void 0 : options.modals) {
11982
+ if (options.modals === "all") {
11983
+ modals = allActions;
11984
+ } else {
11985
+ modals = options.modals;
11986
+ }
11987
+ }
11988
+ return {
11989
+ notifications: notifications2,
11990
+ modals
11991
+ };
11992
+ }
11692
11993
  }
11693
11994
  const TonConnectUIContext = createContext$1(null);
11694
11995
  let tonConnectUI = null;
@@ -11703,7 +12004,7 @@ const TonConnectUIProvider = (_a) => {
11703
12004
  }
11704
12005
  return /* @__PURE__ */ jsx(TonConnectUIContext.Provider, { value: tonConnectUI, children: children2 });
11705
12006
  };
11706
- const TonConnectUIProvider$1 = memo$1(TonConnectUIProvider);
12007
+ const TonConnectUIProvider$1 = memo(TonConnectUIProvider);
11707
12008
  class TonConnectUIReactError extends TonConnectUIError {
11708
12009
  constructor(...args) {
11709
12010
  super(...args);
@@ -11738,7 +12039,7 @@ const TonConnectButton = ({ className: className2, style: style2 }) => {
11738
12039
  }, []);
11739
12040
  return /* @__PURE__ */ jsx("div", { id: buttonRootId, className: className2, style: style2 });
11740
12041
  };
11741
- const TonConnectButton$1 = memo$1(TonConnectButton);
12042
+ const TonConnectButton$1 = memo(TonConnectButton);
11742
12043
  function useTonWallet() {
11743
12044
  const [tonConnectUI2] = useTonConnectUI();
11744
12045
  const [wallet, setWallet] = useState(