@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.umd.js CHANGED
@@ -4221,7 +4221,8 @@ var __objRest = (source, exclude) => {
4221
4221
  });
4222
4222
  };
4223
4223
  class InjectedProvider {
4224
- constructor(injectedWalletKey) {
4224
+ constructor(storage, injectedWalletKey) {
4225
+ this.injectedWalletKey = injectedWalletKey;
4225
4226
  this.type = "injected";
4226
4227
  this.unsubscribeCallback = null;
4227
4228
  this.listenSubscriptions = false;
@@ -4230,13 +4231,14 @@ var __objRest = (source, exclude) => {
4230
4231
  if (!InjectedProvider.isWindowContainsWallet(window2, injectedWalletKey)) {
4231
4232
  throw new WalletNotInjectedError();
4232
4233
  }
4234
+ this.connectionStorage = new BridgeConnectionStorage(storage);
4233
4235
  this.injectedWallet = window2[injectedWalletKey].tonconnect;
4234
4236
  }
4235
4237
  static fromStorage(storage) {
4236
4238
  return __awaiter$3(this, void 0, void 0, function* () {
4237
4239
  const bridgeConnectionStorage = new BridgeConnectionStorage(storage);
4238
4240
  const connection = yield bridgeConnectionStorage.getInjectedConnection();
4239
- return new InjectedProvider(connection.jsBridgeKey);
4241
+ return new InjectedProvider(storage, connection.jsBridgeKey);
4240
4242
  });
4241
4243
  }
4242
4244
  static isWalletInjected(injectedWalletKey) {
@@ -4251,23 +4253,8 @@ var __objRest = (source, exclude) => {
4251
4253
  static isWindowContainsWallet(window2, injectedWalletKey) {
4252
4254
  return !!window2 && injectedWalletKey in window2 && typeof window2[injectedWalletKey] === "object" && "tonconnect" in window2[injectedWalletKey];
4253
4255
  }
4254
- connect(message, auto = false) {
4255
- this.injectedWallet.connect(PROTOCOL_VERSION, message, auto).then((connectEvent) => {
4256
- if (connectEvent.event === "connect") {
4257
- this.makeSubscriptions();
4258
- this.listenSubscriptions = true;
4259
- }
4260
- this.listeners.forEach((listener) => listener(connectEvent));
4261
- }).catch((e2) => {
4262
- const connectEventError = {
4263
- event: "connect_error",
4264
- payload: {
4265
- code: 0,
4266
- message: e2 === null || e2 === void 0 ? void 0 : e2.toString()
4267
- }
4268
- };
4269
- this.listeners.forEach((listener) => listener(connectEventError));
4270
- });
4256
+ connect(message) {
4257
+ this._connect(PROTOCOL_VERSION, message);
4271
4258
  }
4272
4259
  restoreConnection() {
4273
4260
  return __awaiter$3(this, void 0, void 0, function* () {
@@ -4275,10 +4262,12 @@ var __objRest = (source, exclude) => {
4275
4262
  const connectEvent = yield this.injectedWallet.restoreConnection();
4276
4263
  if (connectEvent.event === "connect") {
4277
4264
  this.makeSubscriptions();
4278
- this.listenSubscriptions = true;
4279
4265
  this.listeners.forEach((listener) => listener(connectEvent));
4266
+ } else {
4267
+ yield this.connectionStorage.removeConnection();
4280
4268
  }
4281
4269
  } catch (e2) {
4270
+ yield this.connectionStorage.removeConnection();
4282
4271
  console.error(e2);
4283
4272
  }
4284
4273
  });
@@ -4292,7 +4281,7 @@ var __objRest = (source, exclude) => {
4292
4281
  disconnect() {
4293
4282
  this.closeAllListeners();
4294
4283
  this.injectedWallet.disconnect();
4295
- return Promise.resolve();
4284
+ return this.connectionStorage.removeConnection();
4296
4285
  }
4297
4286
  closeAllListeners() {
4298
4287
  var _a;
@@ -4309,7 +4298,30 @@ var __objRest = (source, exclude) => {
4309
4298
  return this.injectedWallet.send(Object.assign(Object.assign({}, request), { id: "0" }));
4310
4299
  });
4311
4300
  }
4301
+ _connect(protocolVersion, message) {
4302
+ return __awaiter$3(this, void 0, void 0, function* () {
4303
+ try {
4304
+ const connectEvent = yield this.injectedWallet.connect(protocolVersion, message);
4305
+ if (connectEvent.event === "connect") {
4306
+ yield this.updateSession();
4307
+ this.makeSubscriptions();
4308
+ }
4309
+ this.listeners.forEach((listener) => listener(connectEvent));
4310
+ } catch (e2) {
4311
+ console.debug(e2);
4312
+ const connectEventError = {
4313
+ event: "connect_error",
4314
+ payload: {
4315
+ code: 0,
4316
+ message: e2 === null || e2 === void 0 ? void 0 : e2.toString()
4317
+ }
4318
+ };
4319
+ this.listeners.forEach((listener) => listener(connectEventError));
4320
+ }
4321
+ });
4322
+ }
4312
4323
  makeSubscriptions() {
4324
+ this.listenSubscriptions = true;
4313
4325
  this.unsubscribeCallback = this.injectedWallet.listen((e2) => {
4314
4326
  if (this.listenSubscriptions) {
4315
4327
  this.listeners.forEach((listener) => listener(e2));
@@ -4319,6 +4331,12 @@ var __objRest = (source, exclude) => {
4319
4331
  }
4320
4332
  });
4321
4333
  }
4334
+ updateSession() {
4335
+ return this.connectionStorage.storeConnection({
4336
+ type: "injected",
4337
+ jsBridgeKey: this.injectedWalletKey
4338
+ });
4339
+ }
4322
4340
  }
4323
4341
  InjectedProvider.window = getWindow$1();
4324
4342
  var __awaiter$2 = globalThis && globalThis.__awaiter || function(thisArg, _arguments, P2, generator) {
@@ -4403,9 +4421,12 @@ var __objRest = (source, exclude) => {
4403
4421
  });
4404
4422
  };
4405
4423
  class WalletsListManager {
4406
- constructor() {
4424
+ constructor(walletsListSource) {
4407
4425
  this.walletsListCache = null;
4408
4426
  this.walletsListSource = "https://raw.githubusercontent.com/ton-connect/wallets-list/main/wallets.json";
4427
+ if (walletsListSource) {
4428
+ this.walletsListSource = walletsListSource;
4429
+ }
4409
4430
  }
4410
4431
  getWallets() {
4411
4432
  return __awaiter$1(this, void 0, void 0, function* () {
@@ -4419,11 +4440,11 @@ var __objRest = (source, exclude) => {
4419
4440
  getEmbeddedWallet() {
4420
4441
  return __awaiter$1(this, void 0, void 0, function* () {
4421
4442
  const walletsList = yield this.getWallets();
4422
- const injectedWallets = walletsList.filter(isWalletInfoInjected);
4423
- if (injectedWallets.length !== 1) {
4443
+ const embeddedWallets = walletsList.filter((item) => isWalletInfoInjected(item) && item.embedded);
4444
+ if (embeddedWallets.length !== 1) {
4424
4445
  return null;
4425
4446
  }
4426
- return injectedWallets[0].embedded ? injectedWallets[0] : null;
4447
+ return embeddedWallets[0];
4427
4448
  });
4428
4449
  }
4429
4450
  fetchWalletsList() {
@@ -4546,6 +4567,7 @@ var __objRest = (source, exclude) => {
4546
4567
  manifestUrl: (options === null || options === void 0 ? void 0 : options.manifestUrl) || getWebPageManifest(),
4547
4568
  storage: (options === null || options === void 0 ? void 0 : options.storage) || new DefaultStorage()
4548
4569
  };
4570
+ this.walletsList = new WalletsListManager(options === null || options === void 0 ? void 0 : options.walletsListSource);
4549
4571
  if (!this.dappSettings.manifestUrl) {
4550
4572
  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");
4551
4573
  }
@@ -4640,7 +4662,7 @@ var __objRest = (source, exclude) => {
4640
4662
  createProvider(wallet) {
4641
4663
  let provider;
4642
4664
  if (isWalletConnectionSourceJS(wallet)) {
4643
- provider = new InjectedProvider(wallet.jsBridgeKey);
4665
+ provider = new InjectedProvider(this.dappSettings.storage, wallet.jsBridgeKey);
4644
4666
  } else {
4645
4667
  provider = new BridgeProvider(this.dappSettings.storage, wallet);
4646
4668
  }
@@ -4723,6 +4745,8 @@ var __objRest = (source, exclude) => {
4723
4745
  }
4724
4746
  }
4725
4747
  TonConnect.walletsList = new WalletsListManager();
4748
+ TonConnect.isWalletInjected = (walletJSKey) => InjectedProvider.isWalletInjected(walletJSKey);
4749
+ TonConnect.isInsideWalletBrowser = (walletJSKey) => InjectedProvider.isInsideWalletBrowser(walletJSKey);
4726
4750
  function toUserFriendlyAddress$1(hexAddress) {
4727
4751
  const { wc, hex } = parseHexAddress$1(hexAddress);
4728
4752
  const bounceableTag = 17;
@@ -4831,7 +4855,7 @@ var __objRest = (source, exclude) => {
4831
4855
  let Effects = null;
4832
4856
  let ExecCount = 0;
4833
4857
  function createRoot(fn, detachedOwner) {
4834
- const listener = Listener, owner = Owner, unowned = fn.length === 0, root = unowned && true ? UNOWNED : {
4858
+ const listener = Listener, owner = Owner, unowned = fn.length === 0, root = unowned ? UNOWNED : {
4835
4859
  owned: null,
4836
4860
  cleanups: null,
4837
4861
  context: null,
@@ -4927,8 +4951,8 @@ var __objRest = (source, exclude) => {
4927
4951
  runUpdates(() => {
4928
4952
  if (!err)
4929
4953
  setValue(() => v);
4930
- setError(err);
4931
4954
  setState(err ? "errored" : "ready");
4955
+ setError(err);
4932
4956
  for (const c2 of contexts.keys())
4933
4957
  c2.decrement();
4934
4958
  contexts.clear();
@@ -4967,7 +4991,7 @@ var __objRest = (source, exclude) => {
4967
4991
  refetching
4968
4992
  }));
4969
4993
  if (typeof p2 !== "object" || !(p2 && "then" in p2)) {
4970
- loadEnd(pr, p2);
4994
+ loadEnd(pr, p2, void 0, lookup2);
4971
4995
  return p2;
4972
4996
  }
4973
4997
  pr = p2;
@@ -4977,7 +5001,7 @@ var __objRest = (source, exclude) => {
4977
5001
  setState(resolved ? "refreshing" : "pending");
4978
5002
  trigger();
4979
5003
  }, false);
4980
- return p2.then((v) => loadEnd(p2, v, void 0, lookup2), (e2) => loadEnd(p2, void 0, castError(e2)));
5004
+ return p2.then((v) => loadEnd(p2, v, void 0, lookup2), (e2) => loadEnd(p2, void 0, castError(e2), lookup2));
4981
5005
  }
4982
5006
  Object.defineProperties(read, {
4983
5007
  state: {
@@ -5016,11 +5040,13 @@ var __objRest = (source, exclude) => {
5016
5040
  return runUpdates(fn, false);
5017
5041
  }
5018
5042
  function untrack(fn) {
5019
- let result, listener = Listener;
5043
+ const listener = Listener;
5020
5044
  Listener = null;
5021
- result = fn();
5022
- Listener = listener;
5023
- return result;
5045
+ try {
5046
+ return fn();
5047
+ } finally {
5048
+ Listener = listener;
5049
+ }
5024
5050
  }
5025
5051
  function on(deps, fn, options) {
5026
5052
  const isArray = Array.isArray(deps);
@@ -5058,7 +5084,7 @@ var __objRest = (source, exclude) => {
5058
5084
  function getListener() {
5059
5085
  return Listener;
5060
5086
  }
5061
- function createContext(defaultValue) {
5087
+ function createContext(defaultValue, options) {
5062
5088
  const id = Symbol("context");
5063
5089
  return {
5064
5090
  id,
@@ -5072,12 +5098,12 @@ var __objRest = (source, exclude) => {
5072
5098
  }
5073
5099
  function children(fn) {
5074
5100
  const children2 = createMemo(fn);
5075
- const memo2 = createMemo(() => resolveChildren(children2()));
5076
- memo2.toArray = () => {
5077
- const c2 = memo2();
5101
+ const memo = createMemo(() => resolveChildren(children2()));
5102
+ memo.toArray = () => {
5103
+ const c2 = memo();
5078
5104
  return Array.isArray(c2) ? c2 : c2 != null ? [c2] : [];
5079
5105
  };
5080
- return memo2;
5106
+ return memo;
5081
5107
  }
5082
5108
  let SuspenseContext;
5083
5109
  function readSignal() {
@@ -5356,7 +5382,7 @@ var __objRest = (source, exclude) => {
5356
5382
  }
5357
5383
  return children2;
5358
5384
  }
5359
- function createProvider(id) {
5385
+ function createProvider(id, options) {
5360
5386
  return function provider(props) {
5361
5387
  let res;
5362
5388
  createRenderEffect(() => res = untrack(() => {
@@ -5364,7 +5390,7 @@ var __objRest = (source, exclude) => {
5364
5390
  [id]: props.value
5365
5391
  };
5366
5392
  return children(() => props.children);
5367
- }));
5393
+ }), void 0);
5368
5394
  return res;
5369
5395
  };
5370
5396
  }
@@ -5476,6 +5502,8 @@ var __objRest = (source, exclude) => {
5476
5502
  return _.get(property);
5477
5503
  },
5478
5504
  has(_, property) {
5505
+ if (property === $PROXY)
5506
+ return true;
5479
5507
  return _.has(property);
5480
5508
  },
5481
5509
  set: trueFn,
@@ -5496,68 +5524,116 @@ var __objRest = (source, exclude) => {
5496
5524
  }
5497
5525
  };
5498
5526
  function resolveSource(s2) {
5499
- return (s2 = typeof s2 === "function" ? s2() : s2) == null ? {} : s2;
5527
+ return !(s2 = typeof s2 === "function" ? s2() : s2) ? {} : s2;
5500
5528
  }
5501
5529
  function mergeProps(...sources) {
5502
- return new Proxy({
5503
- get(property) {
5504
- for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5505
- const v = resolveSource(sources[i2])[property];
5506
- if (v !== void 0)
5507
- return v;
5508
- }
5509
- },
5510
- has(property) {
5511
- for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5512
- if (property in resolveSource(sources[i2]))
5513
- return true;
5530
+ let proxy = false;
5531
+ for (let i2 = 0; i2 < sources.length; i2++) {
5532
+ const s2 = sources[i2];
5533
+ proxy = proxy || !!s2 && $PROXY in s2;
5534
+ sources[i2] = typeof s2 === "function" ? (proxy = true, createMemo(s2)) : s2;
5535
+ }
5536
+ if (proxy) {
5537
+ return new Proxy({
5538
+ get(property) {
5539
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5540
+ const v = resolveSource(sources[i2])[property];
5541
+ if (v !== void 0)
5542
+ return v;
5543
+ }
5544
+ },
5545
+ has(property) {
5546
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5547
+ if (property in resolveSource(sources[i2]))
5548
+ return true;
5549
+ }
5550
+ return false;
5551
+ },
5552
+ keys() {
5553
+ const keys = [];
5554
+ for (let i2 = 0; i2 < sources.length; i2++)
5555
+ keys.push(...Object.keys(resolveSource(sources[i2])));
5556
+ return [...new Set(keys)];
5557
+ }
5558
+ }, propTraps);
5559
+ }
5560
+ const target = {};
5561
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5562
+ if (sources[i2]) {
5563
+ const descriptors = Object.getOwnPropertyDescriptors(sources[i2]);
5564
+ for (const key in descriptors) {
5565
+ if (key in target)
5566
+ continue;
5567
+ Object.defineProperty(target, key, {
5568
+ enumerable: true,
5569
+ get() {
5570
+ for (let i3 = sources.length - 1; i3 >= 0; i3--) {
5571
+ const v = (sources[i3] || {})[key];
5572
+ if (v !== void 0)
5573
+ return v;
5574
+ }
5575
+ }
5576
+ });
5514
5577
  }
5515
- return false;
5516
- },
5517
- keys() {
5518
- const keys = [];
5519
- for (let i2 = 0; i2 < sources.length; i2++)
5520
- keys.push(...Object.keys(resolveSource(sources[i2])));
5521
- return [...new Set(keys)];
5522
5578
  }
5523
- }, propTraps);
5579
+ }
5580
+ return target;
5524
5581
  }
5525
5582
  function splitProps(props, ...keys) {
5526
5583
  const blocked = new Set(keys.flat());
5584
+ if ($PROXY in props) {
5585
+ const res = keys.map((k) => {
5586
+ return new Proxy({
5587
+ get(property) {
5588
+ return k.includes(property) ? props[property] : void 0;
5589
+ },
5590
+ has(property) {
5591
+ return k.includes(property) && property in props;
5592
+ },
5593
+ keys() {
5594
+ return k.filter((property) => property in props);
5595
+ }
5596
+ }, propTraps);
5597
+ });
5598
+ res.push(new Proxy({
5599
+ get(property) {
5600
+ return blocked.has(property) ? void 0 : props[property];
5601
+ },
5602
+ has(property) {
5603
+ return blocked.has(property) ? false : property in props;
5604
+ },
5605
+ keys() {
5606
+ return Object.keys(props).filter((k) => !blocked.has(k));
5607
+ }
5608
+ }, propTraps));
5609
+ return res;
5610
+ }
5527
5611
  const descriptors = Object.getOwnPropertyDescriptors(props);
5528
- const res = keys.map((k) => {
5612
+ keys.push(Object.keys(descriptors).filter((k) => !blocked.has(k)));
5613
+ return keys.map((k) => {
5529
5614
  const clone = {};
5530
5615
  for (let i2 = 0; i2 < k.length; i2++) {
5531
5616
  const key = k[i2];
5617
+ if (!(key in props))
5618
+ continue;
5532
5619
  Object.defineProperty(clone, key, descriptors[key] ? descriptors[key] : {
5533
5620
  get() {
5534
5621
  return props[key];
5535
5622
  },
5536
5623
  set() {
5537
5624
  return true;
5538
- }
5625
+ },
5626
+ enumerable: true
5539
5627
  });
5540
5628
  }
5541
5629
  return clone;
5542
5630
  });
5543
- res.push(new Proxy({
5544
- get(property) {
5545
- return blocked.has(property) ? void 0 : props[property];
5546
- },
5547
- has(property) {
5548
- return blocked.has(property) ? false : property in props;
5549
- },
5550
- keys() {
5551
- return Object.keys(props).filter((k) => !blocked.has(k));
5552
- }
5553
- }, propTraps));
5554
- return res;
5555
5631
  }
5556
5632
  function For(props) {
5557
5633
  const fallback = "fallback" in props && {
5558
5634
  fallback: () => props.fallback
5559
5635
  };
5560
- return createMemo(mapArray(() => props.each, props.children, fallback ? fallback : void 0));
5636
+ return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
5561
5637
  }
5562
5638
  function Show(props) {
5563
5639
  let strictEqual = false;
@@ -5574,11 +5650,12 @@ var __objRest = (source, exclude) => {
5574
5650
  return fn ? untrack(() => child(c2)) : child;
5575
5651
  }
5576
5652
  return props.fallback;
5577
- });
5653
+ }, void 0, void 0);
5578
5654
  }
5579
5655
  function Switch(props) {
5580
5656
  let strictEqual = false;
5581
5657
  let keyed = false;
5658
+ const equals = (a2, b) => a2[0] === b[0] && (strictEqual ? a2[1] === b[1] : !a2[1] === !b[1]) && a2[2] === b[2];
5582
5659
  const conditions = children(() => props.children), evalConditions = createMemo(() => {
5583
5660
  let conds = conditions();
5584
5661
  if (!Array.isArray(conds))
@@ -5592,7 +5669,7 @@ var __objRest = (source, exclude) => {
5592
5669
  }
5593
5670
  return [-1];
5594
5671
  }, void 0, {
5595
- equals: (a2, b) => a2[0] === b[0] && (strictEqual ? a2[1] === b[1] : !a2[1] === !b[1]) && a2[2] === b[2]
5672
+ equals
5596
5673
  });
5597
5674
  return createMemo(() => {
5598
5675
  const [index, when, cond] = evalConditions();
@@ -5602,7 +5679,7 @@ var __objRest = (source, exclude) => {
5602
5679
  const fn = typeof c2 === "function" && c2.length > 0;
5603
5680
  strictEqual = keyed || fn;
5604
5681
  return fn ? untrack(() => c2(when)) : c2;
5605
- });
5682
+ }, void 0, void 0);
5606
5683
  }
5607
5684
  function Match(props) {
5608
5685
  return props;
@@ -5610,18 +5687,18 @@ var __objRest = (source, exclude) => {
5610
5687
  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"];
5611
5688
  const Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
5612
5689
  const ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
5613
- const Aliases = {
5690
+ const Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
5614
5691
  className: "class",
5615
5692
  htmlFor: "for"
5616
- };
5617
- const PropAliases = {
5693
+ });
5694
+ const PropAliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
5618
5695
  class: "className",
5619
5696
  formnovalidate: "formNoValidate",
5620
5697
  ismap: "isMap",
5621
5698
  nomodule: "noModule",
5622
5699
  playsinline: "playsInline",
5623
5700
  readonly: "readOnly"
5624
- };
5701
+ });
5625
5702
  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"]);
5626
5703
  const SVGElements = /* @__PURE__ */ new Set([
5627
5704
  "altGlyph",
@@ -5705,11 +5782,6 @@ var __objRest = (source, exclude) => {
5705
5782
  xlink: "http://www.w3.org/1999/xlink",
5706
5783
  xml: "http://www.w3.org/XML/1998/namespace"
5707
5784
  };
5708
- function memo(fn, equals) {
5709
- return createMemo(fn, void 0, !equals ? {
5710
- equals
5711
- } : void 0);
5712
- }
5713
5785
  function reconcileArrays(parentNode, a2, b) {
5714
5786
  let bLength = b.length, aEnd = a2.length, bEnd = bLength, aStart = 0, bStart = 0, after = a2[aEnd - 1].nextSibling, map = null;
5715
5787
  while (aStart < aEnd || bStart < bEnd) {
@@ -5767,12 +5839,12 @@ var __objRest = (source, exclude) => {
5767
5839
  }
5768
5840
  }
5769
5841
  const $$EVENTS = "_$DX_DELEGATE";
5770
- function render(code, element, init) {
5842
+ function render(code, element, init, options = {}) {
5771
5843
  let disposer;
5772
5844
  createRoot((dispose2) => {
5773
5845
  disposer = dispose2;
5774
5846
  element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
5775
- });
5847
+ }, options.owner);
5776
5848
  return () => {
5777
5849
  disposer();
5778
5850
  element.textContent = "";
@@ -5869,11 +5941,14 @@ var __objRest = (source, exclude) => {
5869
5941
  }
5870
5942
  return prev;
5871
5943
  }
5872
- function spread(node, accessor, isSVG, skipChildren) {
5873
- if (typeof accessor === "function") {
5874
- createRenderEffect((current) => spreadExpression(node, accessor(), current, isSVG, skipChildren));
5875
- } else
5876
- spreadExpression(node, accessor, void 0, isSVG, skipChildren);
5944
+ function spread(node, props = {}, isSVG, skipChildren) {
5945
+ const prevProps = {};
5946
+ if (!skipChildren) {
5947
+ createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
5948
+ }
5949
+ createRenderEffect(() => props.ref && props.ref(node));
5950
+ createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
5951
+ return prevProps;
5877
5952
  }
5878
5953
  function use(fn, element, arg) {
5879
5954
  return untrack(() => fn(element, arg));
@@ -5931,9 +6006,8 @@ var __objRest = (source, exclude) => {
5931
6006
  if (value === prev)
5932
6007
  return prev;
5933
6008
  if (prop === "ref") {
5934
- if (!skipRef) {
6009
+ if (!skipRef)
5935
6010
  value(node);
5936
- }
5937
6011
  } else if (prop.slice(0, 3) === "on:") {
5938
6012
  const e2 = prop.slice(3);
5939
6013
  prev && node.removeEventListener(e2, prev);
@@ -5988,7 +6062,7 @@ var __objRest = (source, exclude) => {
5988
6062
  sharedConfig.done = true;
5989
6063
  document.querySelectorAll("[id^=pl-]").forEach((elem) => elem.remove());
5990
6064
  }
5991
- while (node !== null) {
6065
+ while (node) {
5992
6066
  const handler = node[key];
5993
6067
  if (handler && !node.disabled) {
5994
6068
  const data = node[`${key}Data`];
@@ -5996,17 +6070,8 @@ var __objRest = (source, exclude) => {
5996
6070
  if (e2.cancelBubble)
5997
6071
  return;
5998
6072
  }
5999
- node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
6000
- }
6001
- }
6002
- function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
6003
- props || (props = {});
6004
- if (!skipChildren) {
6005
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
6073
+ node = node._$host || node.parentNode || node.host;
6006
6074
  }
6007
- createRenderEffect(() => props.ref && props.ref(node));
6008
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
6009
- return prevProps;
6010
6075
  }
6011
6076
  function insertExpression(parent, value, current, marker, unwrapArray) {
6012
6077
  if (sharedConfig.context && !current)
@@ -6121,7 +6186,7 @@ var __objRest = (source, exclude) => {
6121
6186
  }
6122
6187
  return dynamic;
6123
6188
  }
6124
- function appendNodes(parent, array, marker) {
6189
+ function appendNodes(parent, array, marker = null) {
6125
6190
  for (let i2 = 0, len = array.length; i2 < len; i2++)
6126
6191
  parent.insertBefore(array[i2], marker);
6127
6192
  }
@@ -6180,10 +6245,11 @@ var __objRest = (source, exclude) => {
6180
6245
  const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
6181
6246
  mode: "open"
6182
6247
  }) : container;
6183
- Object.defineProperty(container, "host", {
6248
+ Object.defineProperty(container, "_$host", {
6184
6249
  get() {
6185
6250
  return marker.parentNode;
6186
- }
6251
+ },
6252
+ configurable: true
6187
6253
  });
6188
6254
  insert(renderRoot, renderPortal());
6189
6255
  mount.appendChild(container);
@@ -6486,9 +6552,9 @@ var __objRest = (source, exclude) => {
6486
6552
  for (let i2 = 0, l2 = keys.length; i2 < l2; i2++) {
6487
6553
  const prop = keys[i2];
6488
6554
  if (desc[prop].get) {
6489
- const get = desc[prop].get.bind(p2);
6490
6555
  Object.defineProperty(value, prop, {
6491
- get
6556
+ enumerable: desc[prop].enumerable,
6557
+ get: desc[prop].get.bind(p2)
6492
6558
  });
6493
6559
  }
6494
6560
  }
@@ -6544,7 +6610,7 @@ var __objRest = (source, exclude) => {
6544
6610
  function getDataNode(nodes, property, value) {
6545
6611
  return nodes[property] || (nodes[property] = createDataNode(value));
6546
6612
  }
6547
- function proxyDescriptor(target, property) {
6613
+ function proxyDescriptor$1(target, property) {
6548
6614
  const desc = Reflect.getOwnPropertyDescriptor(target, property);
6549
6615
  if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME)
6550
6616
  return desc;
@@ -6596,8 +6662,7 @@ var __objRest = (source, exclude) => {
6596
6662
  has(target, property) {
6597
6663
  if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === "__proto__")
6598
6664
  return true;
6599
- const tracked = getDataNodes(target)[property];
6600
- tracked && tracked();
6665
+ this.get(target, property, target);
6601
6666
  return property in target;
6602
6667
  },
6603
6668
  set() {
@@ -6607,16 +6672,15 @@ var __objRest = (source, exclude) => {
6607
6672
  return true;
6608
6673
  },
6609
6674
  ownKeys,
6610
- getOwnPropertyDescriptor: proxyDescriptor
6675
+ getOwnPropertyDescriptor: proxyDescriptor$1
6611
6676
  };
6612
6677
  function setProperty(state, property, value, deleting = false) {
6613
6678
  if (!deleting && state[property] === value)
6614
6679
  return;
6615
- const prev = state[property];
6616
- const len = state.length;
6617
- if (value === void 0) {
6680
+ const prev = state[property], len = state.length;
6681
+ if (value === void 0)
6618
6682
  delete state[property];
6619
- } else
6683
+ else
6620
6684
  state[property] = value;
6621
6685
  let nodes = getDataNodes(state), node;
6622
6686
  if (node = getDataNode(nodes, property, prev))
@@ -6712,59 +6776,235 @@ var __objRest = (source, exclude) => {
6712
6776
  THEME2["LIGHT"] = "LIGHT";
6713
6777
  return THEME2;
6714
6778
  })(THEME || {});
6715
- function hexToRgb(hex) {
6716
- if (hex[0] === "#") {
6717
- hex = hex.slice(1);
6718
- }
6719
- const bigint = parseInt(hex, 16);
6720
- const r = bigint >> 16 & 255;
6721
- const g = bigint >> 8 & 255;
6722
- const b = bigint & 255;
6723
- return [r, g, b].join(",");
6724
- }
6725
- const generateLightColors = (accentColor) => ({
6726
- primary: accentColor,
6727
- secondary: `rgba(${hexToRgb(accentColor)}, 0.16)`,
6728
- backgroundPrimary: "#FFFFFF",
6729
- backgroundSecondary: "#EFF1F3",
6730
- font: {
6731
- accent: accentColor,
6779
+ const defaultLightColorsSet = {
6780
+ constant: {
6781
+ black: "#000000",
6782
+ white: "#FFFFFF"
6783
+ },
6784
+ connectButton: {
6785
+ background: "#31A6F5",
6786
+ foreground: "#FFFFFF"
6787
+ },
6788
+ accent: "#31A6F5",
6789
+ icon: {
6790
+ primary: "#0F0F0F",
6791
+ secondary: "#7A8999",
6792
+ tertiary: "#C1CAD2",
6793
+ success: "#29CC6A"
6794
+ },
6795
+ background: {
6796
+ primary: "#FFFFFF",
6797
+ secondary: "#F1F3F5"
6798
+ },
6799
+ text: {
6732
6800
  primary: "#0F0F0F",
6733
6801
  secondary: "#7A8999",
6734
- third: "#7A8999"
6802
+ subhead: "#6A7785"
6735
6803
  }
6736
- });
6737
- const generateDarkColors = (accentColor) => ({
6738
- primary: accentColor,
6739
- secondary: accentColor,
6740
- backgroundPrimary: "#121214",
6741
- backgroundSecondary: "#18181A",
6742
- font: {
6743
- accent: "#E5E5EA",
6804
+ };
6805
+ const defaultDarkColorsSet = {
6806
+ constant: {
6807
+ black: "#000000",
6808
+ white: "#FFFFFF"
6809
+ },
6810
+ connectButton: {
6811
+ background: "#31A6F5",
6812
+ foreground: "#FFFFFF"
6813
+ },
6814
+ accent: "#E5E5EA",
6815
+ icon: {
6816
+ primary: "#E5E5EA",
6817
+ secondary: "#909099",
6818
+ tertiary: "#434347",
6819
+ success: "#29CC6A"
6820
+ },
6821
+ background: {
6822
+ primary: "#121214",
6823
+ secondary: "#18181A"
6824
+ },
6825
+ text: {
6744
6826
  primary: "#E5E5EA",
6745
6827
  secondary: "#7D7D85",
6746
- third: "#909099"
6828
+ subhead: "#8C8C93"
6747
6829
  }
6748
- });
6749
- const defaultLightColors = generateLightColors("#31A6F5");
6750
- const defaultDarkColors = generateDarkColors("#262629");
6830
+ };
6831
+ var isMergeableObject = function isMergeableObject2(value) {
6832
+ return isNonNullObject(value) && !isSpecial(value);
6833
+ };
6834
+ function isNonNullObject(value) {
6835
+ return !!value && typeof value === "object";
6836
+ }
6837
+ function isSpecial(value) {
6838
+ var stringValue = Object.prototype.toString.call(value);
6839
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
6840
+ }
6841
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
6842
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
6843
+ function isReactElement(value) {
6844
+ return value.$$typeof === REACT_ELEMENT_TYPE;
6845
+ }
6846
+ function emptyTarget(val) {
6847
+ return Array.isArray(val) ? [] : {};
6848
+ }
6849
+ function cloneUnlessOtherwiseSpecified(value, options) {
6850
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
6851
+ }
6852
+ function defaultArrayMerge(target, source, options) {
6853
+ return target.concat(source).map(function(element) {
6854
+ return cloneUnlessOtherwiseSpecified(element, options);
6855
+ });
6856
+ }
6857
+ function getMergeFunction(key, options) {
6858
+ if (!options.customMerge) {
6859
+ return deepmerge;
6860
+ }
6861
+ var customMerge = options.customMerge(key);
6862
+ return typeof customMerge === "function" ? customMerge : deepmerge;
6863
+ }
6864
+ function getEnumerableOwnPropertySymbols(target) {
6865
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
6866
+ return target.propertyIsEnumerable(symbol);
6867
+ }) : [];
6868
+ }
6869
+ function getKeys(target) {
6870
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
6871
+ }
6872
+ function propertyIsOnObject(object, property) {
6873
+ try {
6874
+ return property in object;
6875
+ } catch (_) {
6876
+ return false;
6877
+ }
6878
+ }
6879
+ function propertyIsUnsafe(target, key) {
6880
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
6881
+ }
6882
+ function mergeObject(target, source, options) {
6883
+ var destination = {};
6884
+ if (options.isMergeableObject(target)) {
6885
+ getKeys(target).forEach(function(key) {
6886
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
6887
+ });
6888
+ }
6889
+ getKeys(source).forEach(function(key) {
6890
+ if (propertyIsUnsafe(target, key)) {
6891
+ return;
6892
+ }
6893
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
6894
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
6895
+ } else {
6896
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
6897
+ }
6898
+ });
6899
+ return destination;
6900
+ }
6901
+ function deepmerge(target, source, options) {
6902
+ options = options || {};
6903
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
6904
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
6905
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
6906
+ var sourceIsArray = Array.isArray(source);
6907
+ var targetIsArray = Array.isArray(target);
6908
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
6909
+ if (!sourceAndTargetTypesMatch) {
6910
+ return cloneUnlessOtherwiseSpecified(source, options);
6911
+ } else if (sourceIsArray) {
6912
+ return options.arrayMerge(target, source, options);
6913
+ } else {
6914
+ return mergeObject(target, source, options);
6915
+ }
6916
+ }
6917
+ deepmerge.all = function deepmergeAll(array, options) {
6918
+ if (!Array.isArray(array)) {
6919
+ throw new Error("first argument should be an array");
6920
+ }
6921
+ return array.reduce(function(prev, next) {
6922
+ return deepmerge(prev, next, options);
6923
+ }, {});
6924
+ };
6925
+ var deepmerge_1 = deepmerge;
6926
+ var cjs = deepmerge_1;
6927
+ /*!
6928
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
6929
+ *
6930
+ * Copyright (c) 2014-2017, Jon Schlinkert.
6931
+ * Released under the MIT License.
6932
+ */
6933
+ function isObject(o2) {
6934
+ return Object.prototype.toString.call(o2) === "[object Object]";
6935
+ }
6936
+ function isPlainObject(o2) {
6937
+ var ctor, prot;
6938
+ if (isObject(o2) === false)
6939
+ return false;
6940
+ ctor = o2.constructor;
6941
+ if (ctor === void 0)
6942
+ return true;
6943
+ prot = ctor.prototype;
6944
+ if (isObject(prot) === false)
6945
+ return false;
6946
+ if (prot.hasOwnProperty("isPrototypeOf") === false) {
6947
+ return false;
6948
+ }
6949
+ return true;
6950
+ }
6951
+ function mergeOptions(options, defaultOptions) {
6952
+ if (!options) {
6953
+ return defaultOptions;
6954
+ }
6955
+ const overwriteMerge = (_, sourceArray, __) => sourceArray;
6956
+ return cjs(defaultOptions, options, {
6957
+ arrayMerge: overwriteMerge,
6958
+ isMergeableObject: isPlainObject
6959
+ });
6960
+ }
6751
6961
  const [themeState, setThemeState] = createStore({
6752
6962
  theme: THEME.LIGHT,
6753
- accentColor: defaultLightColors.primary,
6754
- colors: defaultLightColors
6963
+ colors: defaultLightColorsSet,
6964
+ borderRadius: "m"
6755
6965
  });
6756
- function setTheme(theme) {
6757
- if (theme === THEME.LIGHT) {
6758
- setThemeState({
6759
- theme,
6760
- colors: defaultLightColors
6761
- });
6762
- } else {
6763
- setThemeState({
6764
- theme,
6765
- colors: defaultDarkColors
6766
- });
6966
+ const themeColorsMappingDefault = {
6967
+ [THEME.LIGHT]: defaultLightColorsSet,
6968
+ [THEME.DARK]: defaultDarkColorsSet
6969
+ };
6970
+ const themeCustomColors = {
6971
+ [THEME.LIGHT]: void 0,
6972
+ [THEME.DARK]: void 0
6973
+ };
6974
+ function setTheme(theme, colorsSet) {
6975
+ if (colorsSet) {
6976
+ themeCustomColors[THEME.DARK] = mergeOptions(
6977
+ colorsSet[THEME.DARK],
6978
+ themeCustomColors[THEME.DARK]
6979
+ );
6980
+ themeCustomColors[THEME.LIGHT] = mergeOptions(
6981
+ colorsSet[THEME.LIGHT],
6982
+ themeCustomColors[THEME.LIGHT]
6983
+ );
6767
6984
  }
6985
+ setThemeState({
6986
+ theme,
6987
+ colors: mergeOptions(themeCustomColors[theme], themeColorsMappingDefault[theme])
6988
+ });
6989
+ }
6990
+ function setBorderRadius(borderRadius) {
6991
+ setThemeState({ borderRadius });
6992
+ }
6993
+ function setColors(colorsSet) {
6994
+ themeCustomColors[THEME.DARK] = mergeOptions(
6995
+ colorsSet[THEME.DARK],
6996
+ themeCustomColors[THEME.DARK]
6997
+ );
6998
+ themeCustomColors[THEME.LIGHT] = mergeOptions(
6999
+ colorsSet[THEME.LIGHT],
7000
+ themeCustomColors[THEME.LIGHT]
7001
+ );
7002
+ setThemeState((state) => ({
7003
+ colors: mergeOptions(
7004
+ themeCustomColors[state.theme],
7005
+ themeColorsMappingDefault[state.theme]
7006
+ )
7007
+ }));
6768
7008
  }
6769
7009
  const GlobalStyles = () => {
6770
7010
  document.body.addEventListener("mousedown", () => document.body.classList.add("using-mouse"));
@@ -6796,28 +7036,47 @@ var __objRest = (source, exclude) => {
6796
7036
  li {
6797
7037
  list-style: none;
6798
7038
  }
6799
- button {
6800
- outline: none;
7039
+ button {
7040
+ outline: none;
7041
+ }
7042
+ `;
7043
+ return createComponent(Styles, {});
7044
+ };
7045
+ function hexToRgb(hex) {
7046
+ if (hex[0] === "#") {
7047
+ hex = hex.slice(1);
7048
+ }
7049
+ const bigint = parseInt(hex, 16);
7050
+ const r = bigint >> 16 & 255;
7051
+ const g = bigint >> 8 & 255;
7052
+ const b = bigint & 255;
7053
+ return [r, g, b].join(",");
7054
+ }
7055
+ function rgba(color, opacity) {
7056
+ if (color[0] === "#") {
7057
+ color = hexToRgb(color);
6801
7058
  }
6802
- `;
6803
- return createComponent(Styles, {});
7059
+ return `rgba(${color}, ${opacity})`;
7060
+ }
7061
+ const borders$3 = {
7062
+ m: "16px",
7063
+ s: "8px",
7064
+ none: "0"
6804
7065
  };
6805
7066
  const ButtonStyled$2 = styled.button`
6806
- background-color: ${(props) => props.appearance === "flat" ? props.theme.colors.backgroundPrimary : props.theme.colors[props.appearance]};
6807
- color: ${(props) => props.appearance === "primary" ? "white" : props.appearance === "flat" ? props.theme.colors.font.primary : props.theme.colors.font.accent};
7067
+ background-color: ${(props) => rgba(props.theme.colors.accent, 0.12)};
7068
+ color: ${(props) => props.theme.colors.accent};
6808
7069
 
6809
- box-shadow: ${(props) => props.appearance === "flat" ? "0 4px 24px rgba(0, 0, 0, 0.16);" : "unset;"}
6810
-
6811
7070
  padding: 9px 16px;
6812
7071
  border: none;
6813
- border-radius: 16px;
7072
+ border-radius: ${(props) => borders$3[props.theme.borderRadius]};
6814
7073
  cursor: pointer;
6815
7074
 
6816
7075
  font-size: 14px;
6817
7076
  font-weight: 590;
6818
7077
  line-height: 18px;
6819
7078
  letter-spacing: -0.154px;
6820
-
7079
+
6821
7080
  transition: transform 0.1s ease-in-out;
6822
7081
 
6823
7082
  &:hover {
@@ -6829,13 +7088,12 @@ var __objRest = (source, exclude) => {
6829
7088
  }
6830
7089
  `;
6831
7090
  const Button = (props) => {
6832
- const appearance = () => props.appearance || "primary";
6833
7091
  return createComponent(ButtonStyled$2, {
6834
7092
  get ["class"]() {
6835
7093
  return props.class;
6836
7094
  },
6837
- get appearance() {
6838
- return appearance();
7095
+ get id() {
7096
+ return props.id;
6839
7097
  },
6840
7098
  onClick: () => props.onClick(),
6841
7099
  ref(r$) {
@@ -7243,7 +7501,7 @@ var __objRest = (source, exclude) => {
7243
7501
  };
7244
7502
  const ArrowIcon = (props) => {
7245
7503
  const theme = useTheme();
7246
- const fill = () => props.fill || theme.colors.font.third;
7504
+ const fill = () => props.fill || theme.colors.icon.secondary;
7247
7505
  const direction = () => props.direction || "left";
7248
7506
  const Svg = styled("svg")`
7249
7507
  transform: rotate(${(props2) => rotationDegrees[props2.svgDirection]}deg);
@@ -7268,7 +7526,7 @@ var __objRest = (source, exclude) => {
7268
7526
  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>`);
7269
7527
  const CloseIcon = (props) => {
7270
7528
  const theme = useTheme();
7271
- const fill = () => props.fill || theme.colors.font.third;
7529
+ const fill = () => props.fill || theme.colors.icon.secondary;
7272
7530
  return (() => {
7273
7531
  const _el$ = _tmpl$$e.cloneNode(true), _el$2 = _el$.firstChild;
7274
7532
  createRenderEffect(() => setAttribute(_el$2, "stroke", fill()));
@@ -7283,7 +7541,7 @@ var __objRest = (source, exclude) => {
7283
7541
  width: 32px;
7284
7542
  height: 32px;
7285
7543
  border-radius: 50%;
7286
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
7544
+ background-color: ${(props) => props.theme.colors.background.secondary};
7287
7545
  border: none;
7288
7546
  cursor: pointer;
7289
7547
 
@@ -7368,14 +7626,12 @@ var __objRest = (source, exclude) => {
7368
7626
  const ModalWrapperClass = u`
7369
7627
  position: relative;
7370
7628
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 16px 64px rgba(0, 0, 0, 0.16);
7371
- border-radius: 24px;
7372
7629
  min-height: 100px;
7373
7630
  width: 440px;
7374
7631
  padding: 44px 56px 24px;
7375
7632
 
7376
7633
  ${media("mobile")} {
7377
7634
  width: 100%;
7378
- border-radius: 24px 24px 0 0;
7379
7635
  }
7380
7636
  `;
7381
7637
  const CloseButtonStyled = styled(IconButton)`
@@ -7386,6 +7642,11 @@ var __objRest = (source, exclude) => {
7386
7642
  const _tmpl$$d = /* @__PURE__ */ template$1(`<div></div>`);
7387
7643
  const clickOutside = clickOutside$1;
7388
7644
  const keyPressed = escPressed;
7645
+ const borders$2 = {
7646
+ m: "24px",
7647
+ s: "16px",
7648
+ none: "0"
7649
+ };
7389
7650
  const Modal = (props) => {
7390
7651
  const theme = useTheme();
7391
7652
  return createComponent(Transition, {
@@ -7446,9 +7707,23 @@ var __objRest = (source, exclude) => {
7446
7707
  onClick: () => props.onClose()
7447
7708
  }), null);
7448
7709
  insert(_el$, () => props.children, null);
7449
- createRenderEffect(() => className(_el$, cn(ModalWrapperClass, props.class, u`
7450
- background-color: ${theme.colors.backgroundPrimary};
7451
- `)));
7710
+ createRenderEffect((_p$) => {
7711
+ const _v$ = props.id, _v$2 = cn(ModalWrapperClass, props.class, u`
7712
+ background-color: ${theme.colors.background.primary};
7713
+ border-radius: ${borders$2[theme.borderRadius]};
7714
+
7715
+ ${media("mobile")} {
7716
+ border-radius: ${borders$2[theme.borderRadius]}
7717
+ ${borders$2[theme.borderRadius]} 0 0;
7718
+ }
7719
+ `);
7720
+ _v$ !== _p$._v$ && setAttribute(_el$, "id", _p$._v$ = _v$);
7721
+ _v$2 !== _p$._v$2 && className(_el$, _p$._v$2 = _v$2);
7722
+ return _p$;
7723
+ }, {
7724
+ _v$: void 0,
7725
+ _v$2: void 0
7726
+ });
7452
7727
  return _el$;
7453
7728
  }
7454
7729
  });
@@ -7493,7 +7768,7 @@ var __objRest = (source, exclude) => {
7493
7768
  text-align: center;
7494
7769
  letter-spacing: 0.072px;
7495
7770
 
7496
- color: ${(props) => props.theme.colors.font.primary};
7771
+ color: ${(props) => props.theme.colors.text.primary};
7497
7772
 
7498
7773
  margin-top: 0;
7499
7774
  margin-bottom: 6px;
@@ -7506,7 +7781,7 @@ var __objRest = (source, exclude) => {
7506
7781
  },
7507
7782
  get children() {
7508
7783
  var _a;
7509
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7784
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7510
7785
  }
7511
7786
  });
7512
7787
  };
@@ -7519,7 +7794,7 @@ var __objRest = (source, exclude) => {
7519
7794
  text-align: center;
7520
7795
  letter-spacing: -0.32px;
7521
7796
 
7522
- color: ${(props) => props.theme.colors.font.secondary};
7797
+ color: ${(props) => props.theme.colors.text.secondary};
7523
7798
 
7524
7799
  margin-top: 0;
7525
7800
  margin-bottom: 32px;
@@ -7532,7 +7807,7 @@ var __objRest = (source, exclude) => {
7532
7807
  },
7533
7808
  get children() {
7534
7809
  var _a;
7535
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7810
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7536
7811
  }
7537
7812
  });
7538
7813
  };
@@ -7544,17 +7819,17 @@ var __objRest = (source, exclude) => {
7544
7819
 
7545
7820
  letter-spacing: -0.24px;
7546
7821
 
7547
- color: ${(props) => props.theme.colors.font.primary};
7822
+ color: ${(props) => props.theme.colors.text.primary};
7548
7823
 
7549
7824
  margin-top: 0;
7550
- margin-bottom: 0px;
7825
+ margin-bottom: 0;
7551
7826
  `;
7552
7827
  const H3 = (props) => {
7553
7828
  const [t2] = useI18n();
7554
7829
  return createComponent(H3Styled, {
7555
7830
  get children() {
7556
7831
  var _a;
7557
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7832
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7558
7833
  }
7559
7834
  });
7560
7835
  };
@@ -7570,7 +7845,7 @@ var __objRest = (source, exclude) => {
7570
7845
  const Text = (inputs) => {
7571
7846
  const theme = useTheme();
7572
7847
  const [t2] = useI18n();
7573
- const color = () => inputs.color || theme.colors.font.primary;
7848
+ const color = () => inputs.color || theme.colors.text.primary;
7574
7849
  const props = mergeProps({
7575
7850
  fontSize: "14px",
7576
7851
  fontWeight: "510",
@@ -7598,14 +7873,14 @@ var __objRest = (source, exclude) => {
7598
7873
  },
7599
7874
  get children() {
7600
7875
  var _a;
7601
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7876
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7602
7877
  }
7603
7878
  });
7604
7879
  };
7605
7880
  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>`);
7606
7881
  const TonIcon = (props) => {
7607
7882
  const theme = useTheme();
7608
- const fill = () => props.fill || theme.colors.font.primary;
7883
+ const fill = () => props.fill || theme.colors.icon.primary;
7609
7884
  return (() => {
7610
7885
  const _el$ = _tmpl$$c.cloneNode(true), _el$2 = _el$.firstChild;
7611
7886
  createRenderEffect(() => setAttribute(_el$2, "fill", fill()));
@@ -7614,7 +7889,8 @@ var __objRest = (source, exclude) => {
7614
7889
  };
7615
7890
  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>`);
7616
7891
  const SuccessIcon = (props) => {
7617
- const fill = () => props.fill || "#29CC6A";
7892
+ const theme = useTheme();
7893
+ const fill = () => props.fill || theme.colors.icon.success;
7618
7894
  return (() => {
7619
7895
  const _el$ = _tmpl$$b.cloneNode(true), _el$2 = _el$.firstChild;
7620
7896
  createRenderEffect((_p$) => {
@@ -7632,7 +7908,7 @@ var __objRest = (source, exclude) => {
7632
7908
  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>`);
7633
7909
  const ErrorIcon = (props) => {
7634
7910
  const theme = useTheme();
7635
- const fill = () => props.fill || theme.colors.font.third;
7911
+ const fill = () => props.fill || theme.colors.icon.secondary;
7636
7912
  return (() => {
7637
7913
  const _el$ = _tmpl$$a.cloneNode(true), _el$2 = _el$.firstChild;
7638
7914
  createRenderEffect((_p$) => {
@@ -7650,7 +7926,7 @@ var __objRest = (source, exclude) => {
7650
7926
  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>`);
7651
7927
  const LoaderIcon = (props) => {
7652
7928
  const theme = useTheme();
7653
- const fill = () => props.fill || theme.colors.font.third;
7929
+ const fill = () => props.fill || theme.colors.icon.tertiary;
7654
7930
  const rotateAnimation = h`
7655
7931
  0% {
7656
7932
  transform: rotate(0deg);
@@ -7680,7 +7956,7 @@ var __objRest = (source, exclude) => {
7680
7956
  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>`);
7681
7957
  const CopyIcon = (props) => {
7682
7958
  const theme = useTheme();
7683
- const fill = () => props.fill || theme.colors.font.primary;
7959
+ const fill = () => props.fill || theme.colors.icon.primary;
7684
7960
  return (() => {
7685
7961
  const _el$ = _tmpl$$8.cloneNode(true), _el$2 = _el$.firstChild;
7686
7962
  createRenderEffect(() => setAttribute(_el$2, "fill", fill()));
@@ -7690,7 +7966,7 @@ var __objRest = (source, exclude) => {
7690
7966
  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>`);
7691
7967
  const DisconnectIcon = (props) => {
7692
7968
  const theme = useTheme();
7693
- const fill = () => props.fill || theme.colors.font.primary;
7969
+ const fill = () => props.fill || theme.colors.icon.primary;
7694
7970
  return (() => {
7695
7971
  const _el$ = _tmpl$$7.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
7696
7972
  createRenderEffect((_p$) => {
@@ -7727,17 +8003,27 @@ var __objRest = (source, exclude) => {
7727
8003
  document.body.removeChild(textArea);
7728
8004
  }
7729
8005
  }
8006
+ const hoverBorders = {
8007
+ m: "8px",
8008
+ s: "4px",
8009
+ none: "0"
8010
+ };
8011
+ const dropdownBorders = {
8012
+ m: "16px",
8013
+ s: "8px",
8014
+ none: "0"
8015
+ };
7730
8016
  const AccountButtonDropdownStyled = styled.div`
7731
8017
  width: 256px;
7732
8018
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
7733
- border-radius: 16px;
8019
+ border-radius: ${(props) => dropdownBorders[props.theme.borderRadius]};
7734
8020
 
7735
- background-color: ${(props) => props.theme.colors.backgroundPrimary}
8021
+ background-color: ${(props) => props.theme.colors.background.primary}
7736
8022
 
7737
- color: ${(props) => props.theme.colors.font.primary}
8023
+ color: ${(props) => props.theme.colors.text.primary}
7738
8024
  `;
7739
8025
  const UlStyled$1 = styled.ul`
7740
- background-color: ${(props) => props.theme.colors.backgroundPrimary};
8026
+ background-color: ${(props) => props.theme.colors.background.primary};
7741
8027
  padding: 8px;
7742
8028
  `;
7743
8029
  const MenuButtonStyled = styled.button`
@@ -7747,15 +8033,15 @@ var __objRest = (source, exclude) => {
7747
8033
  padding: 12px;
7748
8034
  width: 100%;
7749
8035
 
7750
- background-color: ${(props) => props.theme.colors.backgroundPrimary};
8036
+ background-color: ${(props) => props.theme.colors.background.primary};
7751
8037
  border: none;
7752
- border-radius: 8px;
8038
+ border-radius: ${(props) => hoverBorders[props.theme.borderRadius]};
7753
8039
  cursor: pointer;
7754
8040
 
7755
8041
  transition: background-color, transform 0.1s ease-in-out;
7756
8042
 
7757
8043
  &:hover {
7758
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
8044
+ background-color: ${(props) => props.theme.colors.background.secondary};
7759
8045
  }
7760
8046
 
7761
8047
  &:active {
@@ -7796,6 +8082,9 @@ var __objRest = (source, exclude) => {
7796
8082
  get ["class"]() {
7797
8083
  return props.class;
7798
8084
  },
8085
+ get id() {
8086
+ return props.id;
8087
+ },
7799
8088
  get children() {
7800
8089
  return createComponent(UlStyled$1, {
7801
8090
  get children() {
@@ -7846,19 +8135,24 @@ var __objRest = (source, exclude) => {
7846
8135
  }
7847
8136
  });
7848
8137
  };
8138
+ const borders$1 = {
8139
+ m: "16px",
8140
+ s: "8px",
8141
+ none: "0"
8142
+ };
7849
8143
  const NotificationStyled = styled.div`
7850
8144
  width: 256px;
7851
8145
  padding: 12px 16px;
7852
8146
  display: flex;
7853
8147
  gap: 9px;
7854
8148
 
7855
- background-color: ${(props) => props.theme.colors.backgroundPrimary};
8149
+ background-color: ${(props) => props.theme.colors.background.primary};
7856
8150
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
7857
- border-radius: 16px;
8151
+ border-radius: ${(props) => borders$1[props.theme.borderRadius]};
7858
8152
  `;
7859
8153
  const TextStyled$2 = styled(Text)`
7860
8154
  margin-top: 4px;
7861
- color: ${(props) => props.theme.colors.font.secondary};
8155
+ color: ${(props) => props.theme.colors.text.secondary};
7862
8156
  `;
7863
8157
  const _tmpl$$5 = /* @__PURE__ */ template$1(`<div></div>`);
7864
8158
  const Notification = (props) => {
@@ -7896,7 +8190,7 @@ var __objRest = (source, exclude) => {
7896
8190
  }
7897
8191
  }), null);
7898
8192
  return _el$;
7899
- })(), memo(() => props.icon)];
8193
+ })(), createMemo(() => props.icon)];
7900
8194
  }
7901
8195
  });
7902
8196
  };
@@ -7956,7 +8250,7 @@ var __objRest = (source, exclude) => {
7956
8250
  return createComponent(SuccessIconStyled$1, {});
7957
8251
  },
7958
8252
  get ["class"]() {
7959
- return props.class;
8253
+ return cn(props.class, "tc-notification");
7960
8254
  },
7961
8255
  children: "Transaction sent"
7962
8256
  });
@@ -8047,24 +8341,39 @@ var __objRest = (source, exclude) => {
8047
8341
  });
8048
8342
  }
8049
8343
  }));
8050
- createRenderEffect(() => className(_el$, props.class));
8344
+ createRenderEffect((_p$) => {
8345
+ const _v$ = props.class, _v$2 = props.id;
8346
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
8347
+ _v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
8348
+ return _p$;
8349
+ }, {
8350
+ _v$: void 0,
8351
+ _v$2: void 0
8352
+ });
8051
8353
  return _el$;
8052
8354
  })();
8053
8355
  };
8054
8356
  const AccountButtonStyled = styled(Button)`
8357
+ background-color: ${(props) => props.theme.colors.connectButton.background};
8358
+ color: ${(props) => props.theme.colors.connectButton.foreground};
8359
+ box-shadow: ${(props) => `0 4px 24px ${rgba(props.theme.colors.constant.black, 0.16)}`};
8360
+
8055
8361
  display: flex;
8056
8362
  align-items: center;
8057
8363
  gap: 9px;
8058
8364
 
8059
- transition: background-color 0.1s ease-in-out;
8365
+ transition: all 0.1s ease-in-out;
8060
8366
 
8061
8367
  &:hover:not(:active) {
8062
8368
  transform: scale(1);
8063
8369
  }
8064
8370
 
8065
8371
  &:hover {
8066
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
8372
+ filter: ${(props) => `brightness(${props.theme.theme === THEME.DARK ? 1.07 : 0.95})`};
8067
8373
  }
8374
+ `;
8375
+ const DropdownButtonStyled = styled(AccountButtonStyled)`
8376
+ background-color: ${(props) => props.theme.colors.background.primary};
8068
8377
  `;
8069
8378
  const DropdownContainerStyled = styled.div`
8070
8379
  display: flex;
@@ -8156,7 +8465,7 @@ var __objRest = (source, exclude) => {
8156
8465
  } = config;
8157
8466
  const validMiddleware = middleware.filter(Boolean);
8158
8467
  const rtl = yield platform2.isRTL == null ? void 0 : platform2.isRTL(floating);
8159
- if (process.env.NODE_ENV !== "production") {
8468
+ if ({}.NODE_ENV !== "production") {
8160
8469
  if (platform2 == null) {
8161
8470
  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(" "));
8162
8471
  }
@@ -8213,7 +8522,7 @@ var __objRest = (source, exclude) => {
8213
8522
  middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
8214
8523
  [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
8215
8524
  });
8216
- if (process.env.NODE_ENV !== "production") {
8525
+ if ({}.NODE_ENV !== "production") {
8217
8526
  if (resetCount > 50) {
8218
8527
  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(" "));
8219
8528
  }
@@ -8825,8 +9134,9 @@ var __objRest = (source, exclude) => {
8825
9134
  return n2().middlewareData;
8826
9135
  }, update: i2 };
8827
9136
  }
8828
- const _tmpl$$3 = /* @__PURE__ */ template$1(`<div></div>`);
9137
+ const _tmpl$$3 = /* @__PURE__ */ template$1(`<div id="tc-dropdown-container"></div>`);
8829
9138
  const AccountButton = () => {
9139
+ const theme = useTheme();
8830
9140
  const connector = useContext(ConnectorContext);
8831
9141
  const tonConnectUI2 = useContext(TonConnectUiContext);
8832
9142
  const [isOpened, setIsOpened] = createSignal(false);
@@ -8876,14 +9186,21 @@ var __objRest = (source, exclude) => {
8876
9186
  },
8877
9187
  get children() {
8878
9188
  return createComponent(AccountButtonStyled, {
8879
- appearance: "flat",
8880
9189
  onClick: () => tonConnectUI2.connectWallet(),
9190
+ id: "tc-connect-button",
8881
9191
  get children() {
8882
- return [createComponent(TonIcon, {}), createComponent(Text, {
9192
+ return [createComponent(TonIcon, {
9193
+ get fill() {
9194
+ return theme.colors.connectButton.foreground;
9195
+ }
9196
+ }), createComponent(Text, {
8883
9197
  translationKey: "button.connectWallet",
8884
9198
  fontSize: "15px",
8885
9199
  letterSpacing: "-0.24px",
8886
9200
  fontWeight: "590",
9201
+ get color() {
9202
+ return theme.colors.connectButton.foreground;
9203
+ },
8887
9204
  children: "Connect wallet"
8888
9205
  })];
8889
9206
  }
@@ -8896,10 +9213,10 @@ var __objRest = (source, exclude) => {
8896
9213
  get children() {
8897
9214
  return createComponent(DropdownContainerStyled, {
8898
9215
  get children() {
8899
- return [createComponent(AccountButtonStyled, {
8900
- appearance: "flat",
9216
+ return [createComponent(DropdownButtonStyled, {
8901
9217
  onClick: () => setIsOpened((v) => !v),
8902
9218
  ref: setAnchor,
9219
+ id: "tc-dropdown-button",
8903
9220
  get children() {
8904
9221
  return [createComponent(Text, {
8905
9222
  fontSize: "15px",
@@ -8955,13 +9272,16 @@ var __objRest = (source, exclude) => {
8955
9272
  ref(r$) {
8956
9273
  const _ref$ = dropDownRef;
8957
9274
  typeof _ref$ === "function" ? _ref$(r$) : dropDownRef = r$;
8958
- }
9275
+ },
9276
+ id: "tc-dropdown"
8959
9277
  });
8960
9278
  }
8961
9279
  });
8962
9280
  }
8963
9281
  }), null);
8964
- insert(_el$, createComponent(NotificationsStyled, {}), null);
9282
+ insert(_el$, createComponent(NotificationsStyled, {
9283
+ id: "tc-notifications"
9284
+ }), null);
8965
9285
  createRenderEffect((_p$) => {
8966
9286
  var _a, _b;
8967
9287
  const _v$ = position.strategy, _v$2 = `${(_a = position.y) != null ? _a : 0}px`, _v$3 = `${(_b = position.x) != null ? _b : 0}px`;
@@ -8999,14 +9319,14 @@ var __objRest = (source, exclude) => {
8999
9319
  }
9000
9320
 
9001
9321
  path {
9002
- fill: ${(props) => props.theme.colors.font.primary};
9322
+ fill: ${(props) => props.theme.colors.text.primary};
9003
9323
  }
9004
9324
  `;
9005
9325
  const ImageBackground = styled.div`
9006
9326
  position: absolute;
9007
9327
  width: 52px;
9008
9328
  height: 52px;
9009
- background: ${(props) => props.theme.colors.backgroundSecondary};
9329
+ background: ${(props) => props.theme.colors.background.secondary};
9010
9330
  padding: 7px;
9011
9331
  top: 112px;
9012
9332
  left: 112px;
@@ -10699,6 +11019,11 @@ var __objRest = (source, exclude) => {
10699
11019
  const [t2] = useI18n();
10700
11020
  return t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString());
10701
11021
  };
11022
+ const borders = {
11023
+ m: "16px",
11024
+ s: "8px",
11025
+ none: "0"
11026
+ };
10702
11027
  const QrCodeModalStyled = styled.div`
10703
11028
  padding: 0 24px;
10704
11029
  `;
@@ -10709,8 +11034,8 @@ var __objRest = (source, exclude) => {
10709
11034
  `;
10710
11035
  const QRBackgroundStyled = styled.div`
10711
11036
  margin-bottom: 16px;
10712
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
10713
- border-radius: 16px;
11037
+ background-color: ${(props) => props.theme.colors.background.secondary};
11038
+ border-radius: ${(props) => borders[props.theme.borderRadius]};
10714
11039
  display: flex;
10715
11040
  align-items: center;
10716
11041
  justify-content: center;
@@ -10727,6 +11052,7 @@ var __objRest = (source, exclude) => {
10727
11052
  line-height: 20px;
10728
11053
  letter-spacing: -0.32px;
10729
11054
  width: 100%;
11055
+ border-radius: ${(props) => borders[props.theme.borderRadius]};
10730
11056
  `;
10731
11057
  const GetWalletStyled = styled.div`
10732
11058
  display: flex;
@@ -10734,7 +11060,7 @@ var __objRest = (source, exclude) => {
10734
11060
  align-items: center;
10735
11061
  `;
10736
11062
  const TextStyled$1 = styled(Text)`
10737
- color: ${(props) => props.theme.colors.font.secondary};
11063
+ color: ${(props) => props.theme.colors.text.secondary};
10738
11064
  font-size: 16px;
10739
11065
  `;
10740
11066
  function openLink(href, target = "_self") {
@@ -10761,6 +11087,9 @@ var __objRest = (source, exclude) => {
10761
11087
  bridgeUrl: props.wallet.bridgeUrl
10762
11088
  });
10763
11089
  return createComponent(QrCodeModalStyled, {
11090
+ get id() {
11091
+ return props.id;
11092
+ },
10764
11093
  get children() {
10765
11094
  return [createComponent(StyledIconButton, {
10766
11095
  icon: "arrow",
@@ -10773,7 +11102,7 @@ var __objRest = (source, exclude) => {
10773
11102
  };
10774
11103
  },
10775
11104
  get children() {
10776
- return ["Connect with ", memo(() => props.wallet.name)];
11105
+ return ["Connect with ", createMemo(() => props.wallet.name)];
10777
11106
  }
10778
11107
  }), createComponent(H2, {
10779
11108
  translationKey: "walletModal.qrCodeModal.scan",
@@ -10783,7 +11112,7 @@ var __objRest = (source, exclude) => {
10783
11112
  };
10784
11113
  },
10785
11114
  get children() {
10786
- return ["Scan QR code with your phone’s or ", memo(() => props.wallet.name), "’s camera."];
11115
+ return ["Scan QR code with your phone’s or ", createMemo(() => props.wallet.name), "’s camera."];
10787
11116
  }
10788
11117
  }), createComponent(QRBackgroundStyled, {
10789
11118
  get children() {
@@ -10797,7 +11126,6 @@ var __objRest = (source, exclude) => {
10797
11126
  }), createComponent(ButtonsContainerStyled, {
10798
11127
  get children() {
10799
11128
  return [createComponent(ActionButtonStyled, {
10800
- appearance: "secondary",
10801
11129
  onClick: () => openLink(universalLink),
10802
11130
  get children() {
10803
11131
  return createComponent(Translation, {
@@ -10808,7 +11136,7 @@ var __objRest = (source, exclude) => {
10808
11136
  };
10809
11137
  },
10810
11138
  get children() {
10811
- return ["Open ", memo(() => props.wallet.name)];
11139
+ return ["Open ", createMemo(() => props.wallet.name)];
10812
11140
  }
10813
11141
  });
10814
11142
  }
@@ -10818,7 +11146,6 @@ var __objRest = (source, exclude) => {
10818
11146
  },
10819
11147
  get children() {
10820
11148
  return createComponent(ActionButtonStyled, {
10821
- appearance: "secondary",
10822
11149
  onClick: () => connector.connect({
10823
11150
  jsBridgeKey: props.wallet.jsBridgeKey
10824
11151
  }),
@@ -10842,10 +11169,9 @@ var __objRest = (source, exclude) => {
10842
11169
  };
10843
11170
  },
10844
11171
  get children() {
10845
- return ["Don't have ", memo(() => props.wallet.name), "?"];
11172
+ return ["Don't have ", createMemo(() => props.wallet.name), "?"];
10846
11173
  }
10847
11174
  }), createComponent(Button, {
10848
- appearance: "secondary",
10849
11175
  onClick: () => openLinkBlank(props.wallet.aboutUrl),
10850
11176
  get children() {
10851
11177
  return createComponent(Translation, {
@@ -10963,6 +11289,9 @@ var __objRest = (source, exclude) => {
10963
11289
  const SelectWalletModal = (props) => {
10964
11290
  const learnMoreUrl = "https://ton.org/wallets";
10965
11291
  return createComponent(SelectWalletModalStyled, {
11292
+ get id() {
11293
+ return props.id;
11294
+ },
10966
11295
  get children() {
10967
11296
  return [createComponent(H1, {
10968
11297
  translationKey: "walletModal.selectWalletModal.connectWallet",
@@ -10992,7 +11321,6 @@ var __objRest = (source, exclude) => {
10992
11321
  });
10993
11322
  }
10994
11323
  }), createComponent(ButtonStyled$1, {
10995
- appearance: "secondary",
10996
11324
  onClick: () => openLinkBlank(learnMoreUrl),
10997
11325
  get children() {
10998
11326
  return createComponent(Translation, {
@@ -11004,12 +11332,6 @@ var __objRest = (source, exclude) => {
11004
11332
  }
11005
11333
  });
11006
11334
  };
11007
- const ModalWrapper = styled.div`
11008
- color: ${(props) => {
11009
- var _a;
11010
- return ((_a = props.theme) == null ? void 0 : _a.accentColor) || "blue";
11011
- }};
11012
- `;
11013
11335
  const StyledModal = styled(Modal)`
11014
11336
  padding-left: 0;
11015
11337
  padding-right: 0;
@@ -11042,8 +11364,52 @@ var __objRest = (source, exclude) => {
11042
11364
  `;
11043
11365
  const [appState, setAppState] = createStore({
11044
11366
  buttonRootId: null,
11045
- language: "en"
11367
+ language: "en",
11368
+ walletsList: {}
11046
11369
  });
11370
+ function uiWalletToWalletInfo(uiWallet) {
11371
+ if ("jsBridgeKey" in uiWallet) {
11372
+ return __spreadProps(__spreadValues({}, uiWallet), {
11373
+ injected: TonConnect.isWalletInjected(uiWallet.jsBridgeKey),
11374
+ embedded: TonConnect.isInsideWalletBrowser(uiWallet.jsBridgeKey)
11375
+ });
11376
+ }
11377
+ return uiWallet;
11378
+ }
11379
+ function applyWalletsListConfiguration(walletsList, configuration) {
11380
+ var _a;
11381
+ if (!configuration) {
11382
+ return walletsList;
11383
+ }
11384
+ if ("wallets" in configuration) {
11385
+ return configuration.wallets.map((wallet) => {
11386
+ if (typeof wallet === "string") {
11387
+ const walletInfo = walletsList.find((item) => item.name === wallet);
11388
+ if (!walletInfo) {
11389
+ console.error(
11390
+ `Wallet with name === '${wallet}' wasn't found in the wallets list. Check '${wallet}' correctness. Available wallets names: ${walletsList.map((i2) => "'" + i2.name + "'").join(", ")}`
11391
+ );
11392
+ return null;
11393
+ }
11394
+ return walletInfo;
11395
+ }
11396
+ return uiWalletToWalletInfo(wallet);
11397
+ }).filter((i2) => !!i2);
11398
+ }
11399
+ const filteredWalletsList = ((_a = configuration.excludeWallets) == null ? void 0 : _a.length) ? walletsList.filter(
11400
+ (wallet) => {
11401
+ var _a2;
11402
+ return (_a2 = configuration.excludeWallets) == null ? void 0 : _a2.every((item) => item !== wallet.name);
11403
+ }
11404
+ ) : walletsList;
11405
+ if (!configuration.includeWallets) {
11406
+ return filteredWalletsList;
11407
+ }
11408
+ if (configuration.includeWalletsOrder === "start") {
11409
+ return configuration.includeWallets.map(uiWalletToWalletInfo).concat(walletsList);
11410
+ }
11411
+ return walletsList.concat(configuration.includeWallets.map(uiWalletToWalletInfo));
11412
+ }
11047
11413
  const WalletsModal = () => {
11048
11414
  const {
11049
11415
  locale
@@ -11051,8 +11417,14 @@ var __objRest = (source, exclude) => {
11051
11417
  createEffect(() => locale(appState.language));
11052
11418
  const connector = useContext(ConnectorContext);
11053
11419
  const tonConnectUI2 = useContext(TonConnectUiContext);
11054
- const [walletsList] = createResource(() => tonConnectUI2.getWallets());
11420
+ const [fetchedWalletsList] = createResource(() => tonConnectUI2.getWallets());
11055
11421
  const [selectedWalletInfo, setSelectedWalletInfo] = createSignal(null);
11422
+ const walletsList = createMemo(() => {
11423
+ if (fetchedWalletsList.state !== "ready") {
11424
+ return null;
11425
+ }
11426
+ return applyWalletsListConfiguration(fetchedWalletsList(), appState.walletsList);
11427
+ });
11056
11428
  const onClose = () => {
11057
11429
  setWalletsModalOpen(false);
11058
11430
  setSelectedWalletInfo(null);
@@ -11065,7 +11437,11 @@ var __objRest = (source, exclude) => {
11065
11437
  if (isWalletInfoInjected(walletInfo) && walletInfo.injected) {
11066
11438
  return onSelectIfInjected(walletInfo);
11067
11439
  }
11068
- setSelectedWalletInfo(walletInfo);
11440
+ if ("bridgeUrl" in walletInfo) {
11441
+ setSelectedWalletInfo(walletInfo);
11442
+ return;
11443
+ }
11444
+ openLink(walletInfo.aboutUrl, "_blank");
11069
11445
  };
11070
11446
  const onSelectIfMobile = (walletInfo) => {
11071
11447
  const universalLink = connector.connect({
@@ -11085,66 +11461,63 @@ var __objRest = (source, exclude) => {
11085
11461
  }
11086
11462
  });
11087
11463
  onCleanup(unsubscribe);
11088
- return createComponent(ModalWrapper, {
11464
+ return createComponent(StyledModal, {
11465
+ get opened() {
11466
+ return walletsModalOpen();
11467
+ },
11468
+ onClose,
11469
+ id: "tc-wallets-modal-container",
11089
11470
  get children() {
11090
- return createComponent(StyledModal, {
11091
- get opened() {
11092
- return walletsModalOpen();
11471
+ return [createComponent(Show, {
11472
+ get when() {
11473
+ return !walletsList();
11474
+ },
11475
+ get children() {
11476
+ return [createComponent(H1Styled$1, {
11477
+ translationKey: "walletModal.loading",
11478
+ children: "Wallets list is loading"
11479
+ }), createComponent(LoaderContainerStyled, {
11480
+ get children() {
11481
+ return createComponent(LoaderIconStyled$1, {});
11482
+ }
11483
+ })];
11484
+ }
11485
+ }), createComponent(Show, {
11486
+ get when() {
11487
+ return walletsList();
11093
11488
  },
11094
- onClose,
11095
11489
  get children() {
11096
11490
  return [createComponent(Show, {
11097
11491
  get when() {
11098
- return walletsList.state !== "ready";
11492
+ return !selectedWalletInfo();
11099
11493
  },
11494
+ keyed: false,
11100
11495
  get children() {
11101
- return [createComponent(H1Styled$1, {
11102
- translationKey: "walletModal.loading",
11103
- children: "Wallets list is loading"
11104
- }), createComponent(LoaderContainerStyled, {
11105
- get children() {
11106
- return createComponent(LoaderIconStyled$1, {
11107
- fill: "#7A899970"
11108
- });
11109
- }
11110
- })];
11496
+ return createComponent(SelectWalletModal, {
11497
+ get walletsList() {
11498
+ return walletsList();
11499
+ },
11500
+ onSelect,
11501
+ id: "tc-wallets-modal"
11502
+ });
11111
11503
  }
11112
11504
  }), createComponent(Show, {
11113
11505
  get when() {
11114
- return walletsList.state === "ready";
11506
+ return selectedWalletInfo();
11115
11507
  },
11508
+ keyed: false,
11116
11509
  get children() {
11117
- return [createComponent(Show, {
11118
- get when() {
11119
- return !selectedWalletInfo();
11120
- },
11121
- keyed: false,
11122
- get children() {
11123
- return createComponent(SelectWalletModal, {
11124
- get walletsList() {
11125
- return walletsList();
11126
- },
11127
- onSelect
11128
- });
11129
- }
11130
- }), createComponent(Show, {
11131
- get when() {
11510
+ return createComponent(QrCodeModal, {
11511
+ get wallet() {
11132
11512
  return selectedWalletInfo();
11133
11513
  },
11134
- keyed: false,
11135
- get children() {
11136
- return createComponent(QrCodeModal, {
11137
- get wallet() {
11138
- return selectedWalletInfo();
11139
- },
11140
- onBackClick: () => setSelectedWalletInfo(null)
11141
- });
11142
- }
11143
- })];
11514
+ onBackClick: () => setSelectedWalletInfo(null),
11515
+ id: "tc-qr-modal"
11516
+ });
11144
11517
  }
11145
11518
  })];
11146
11519
  }
11147
- });
11520
+ })];
11148
11521
  }
11149
11522
  });
11150
11523
  };
@@ -11165,15 +11538,18 @@ var __objRest = (source, exclude) => {
11165
11538
  text-align: center;
11166
11539
  max-width: 250px;
11167
11540
 
11168
- color: ${(props) => props.theme.colors.font.secondary};
11541
+ color: ${(props) => props.theme.colors.text.secondary};
11169
11542
  `;
11170
11543
  const ButtonStyled = styled(Button)`
11171
11544
  margin-top: 32px;
11172
11545
  `;
11173
11546
  const ActionModal = (props) => {
11174
11547
  return createComponent(ActionModalStyled, {
11548
+ get id() {
11549
+ return props.id;
11550
+ },
11175
11551
  get children() {
11176
- return [memo(() => props.icon), createComponent(H1Styled, {
11552
+ return [createMemo(() => props.icon), createComponent(H1Styled, {
11177
11553
  get translationKey() {
11178
11554
  return props.headerTranslationKey;
11179
11555
  }
@@ -11187,7 +11563,6 @@ var __objRest = (source, exclude) => {
11187
11563
  },
11188
11564
  get children() {
11189
11565
  return createComponent(ButtonStyled, {
11190
- appearance: "secondary",
11191
11566
  onClick: () => props.onClose(),
11192
11567
  get children() {
11193
11568
  return createComponent(Translation, {
@@ -11210,12 +11585,13 @@ var __objRest = (source, exclude) => {
11210
11585
  headerTranslationKey: "actionModal.confirmTransaction.header",
11211
11586
  textTranslationKey: "actionModal.confirmTransaction.text",
11212
11587
  get icon() {
11213
- return createComponent(LoaderIconStyled, {
11214
- fill: "#7A899970"
11215
- });
11588
+ return createComponent(LoaderIconStyled, {});
11216
11589
  },
11217
11590
  onClose: () => props.onClose(),
11218
- showButton: false
11591
+ showButton: false,
11592
+ get id() {
11593
+ return props.id;
11594
+ }
11219
11595
  });
11220
11596
  };
11221
11597
  const ErrorIconStyled = styled(ErrorIcon)`
@@ -11229,7 +11605,10 @@ var __objRest = (source, exclude) => {
11229
11605
  get icon() {
11230
11606
  return createComponent(ErrorIconStyled, {});
11231
11607
  },
11232
- onClose: () => props.onClose()
11608
+ onClose: () => props.onClose(),
11609
+ get id() {
11610
+ return props.id;
11611
+ }
11233
11612
  });
11234
11613
  };
11235
11614
  const SuccessIconStyled = styled(SuccessIcon)`
@@ -11243,16 +11622,20 @@ var __objRest = (source, exclude) => {
11243
11622
  get icon() {
11244
11623
  return createComponent(SuccessIconStyled, {});
11245
11624
  },
11246
- onClose: () => props.onClose()
11625
+ onClose: () => props.onClose(),
11626
+ get id() {
11627
+ return props.id;
11628
+ }
11247
11629
  });
11248
11630
  };
11249
11631
  const ActionsModal = () => {
11250
11632
  return createComponent(Modal, {
11251
11633
  get opened() {
11252
11634
  var _a;
11253
- return memo(() => action() !== null, true)() && ((_a = action()) == null ? void 0 : _a.openModal) === true;
11635
+ return createMemo(() => action() !== null)() && ((_a = action()) == null ? void 0 : _a.openModal) === true;
11254
11636
  },
11255
11637
  onClose: () => setAction(null),
11638
+ id: "tc-actions-modal-container",
11256
11639
  get children() {
11257
11640
  return createComponent(Switch, {
11258
11641
  get children() {
@@ -11262,7 +11645,8 @@ var __objRest = (source, exclude) => {
11262
11645
  },
11263
11646
  get children() {
11264
11647
  return createComponent(TransactionSentModal, {
11265
- onClose: () => setAction(null)
11648
+ onClose: () => setAction(null),
11649
+ id: "tc-transaction-sent-modal"
11266
11650
  });
11267
11651
  }
11268
11652
  }), createComponent(Match, {
@@ -11271,7 +11655,8 @@ var __objRest = (source, exclude) => {
11271
11655
  },
11272
11656
  get children() {
11273
11657
  return createComponent(TransactionCanceledModal, {
11274
- onClose: () => setAction(null)
11658
+ onClose: () => setAction(null),
11659
+ id: "tc-transaction-canceled-modal"
11275
11660
  });
11276
11661
  }
11277
11662
  }), createComponent(Match, {
@@ -11280,7 +11665,8 @@ var __objRest = (source, exclude) => {
11280
11665
  },
11281
11666
  get children() {
11282
11667
  return createComponent(ConfirmTransactionModal, {
11283
- onClose: () => setAction(null)
11668
+ onClose: () => setAction(null),
11669
+ id: "tc-confirm-modal"
11284
11670
  });
11285
11671
  }
11286
11672
  })];
@@ -11372,146 +11758,20 @@ var __objRest = (source, exclude) => {
11372
11758
  this.localStorage.removeItem(this.storageKey);
11373
11759
  }
11374
11760
  }
11375
- var isMergeableObject = function isMergeableObject2(value) {
11376
- return isNonNullObject(value) && !isSpecial(value);
11377
- };
11378
- function isNonNullObject(value) {
11379
- return !!value && typeof value === "object";
11380
- }
11381
- function isSpecial(value) {
11382
- var stringValue = Object.prototype.toString.call(value);
11383
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
11384
- }
11385
- var canUseSymbol = typeof Symbol === "function" && Symbol.for;
11386
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
11387
- function isReactElement(value) {
11388
- return value.$$typeof === REACT_ELEMENT_TYPE;
11389
- }
11390
- function emptyTarget(val) {
11391
- return Array.isArray(val) ? [] : {};
11392
- }
11393
- function cloneUnlessOtherwiseSpecified(value, options) {
11394
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
11395
- }
11396
- function defaultArrayMerge(target, source, options) {
11397
- return target.concat(source).map(function(element) {
11398
- return cloneUnlessOtherwiseSpecified(element, options);
11399
- });
11400
- }
11401
- function getMergeFunction(key, options) {
11402
- if (!options.customMerge) {
11403
- return deepmerge;
11404
- }
11405
- var customMerge = options.customMerge(key);
11406
- return typeof customMerge === "function" ? customMerge : deepmerge;
11407
- }
11408
- function getEnumerableOwnPropertySymbols(target) {
11409
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
11410
- return target.propertyIsEnumerable(symbol);
11411
- }) : [];
11412
- }
11413
- function getKeys(target) {
11414
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
11415
- }
11416
- function propertyIsOnObject(object, property) {
11417
- try {
11418
- return property in object;
11419
- } catch (_) {
11420
- return false;
11421
- }
11422
- }
11423
- function propertyIsUnsafe(target, key) {
11424
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
11425
- }
11426
- function mergeObject(target, source, options) {
11427
- var destination = {};
11428
- if (options.isMergeableObject(target)) {
11429
- getKeys(target).forEach(function(key) {
11430
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
11431
- });
11432
- }
11433
- getKeys(source).forEach(function(key) {
11434
- if (propertyIsUnsafe(target, key)) {
11435
- return;
11436
- }
11437
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
11438
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
11439
- } else {
11440
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
11441
- }
11442
- });
11443
- return destination;
11444
- }
11445
- function deepmerge(target, source, options) {
11446
- options = options || {};
11447
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
11448
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
11449
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
11450
- var sourceIsArray = Array.isArray(source);
11451
- var targetIsArray = Array.isArray(target);
11452
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
11453
- if (!sourceAndTargetTypesMatch) {
11454
- return cloneUnlessOtherwiseSpecified(source, options);
11455
- } else if (sourceIsArray) {
11456
- return options.arrayMerge(target, source, options);
11457
- } else {
11458
- return mergeObject(target, source, options);
11459
- }
11460
- }
11461
- deepmerge.all = function deepmergeAll(array, options) {
11462
- if (!Array.isArray(array)) {
11463
- throw new Error("first argument should be an array");
11464
- }
11465
- return array.reduce(function(prev, next) {
11466
- return deepmerge(prev, next, options);
11467
- }, {});
11468
- };
11469
- var deepmerge_1 = deepmerge;
11470
- var cjs = deepmerge_1;
11471
- /*!
11472
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
11473
- *
11474
- * Copyright (c) 2014-2017, Jon Schlinkert.
11475
- * Released under the MIT License.
11476
- */
11477
- function isObject(o2) {
11478
- return Object.prototype.toString.call(o2) === "[object Object]";
11479
- }
11480
- function isPlainObject(o2) {
11481
- var ctor, prot;
11482
- if (isObject(o2) === false)
11483
- return false;
11484
- ctor = o2.constructor;
11485
- if (ctor === void 0)
11486
- return true;
11487
- prot = ctor.prototype;
11488
- if (isObject(prot) === false)
11489
- return false;
11490
- if (prot.hasOwnProperty("isPrototypeOf") === false) {
11491
- return false;
11492
- }
11493
- return true;
11494
- }
11495
- function mergeOptions(options, defaultOptions) {
11496
- if (!options) {
11497
- return defaultOptions;
11498
- }
11499
- const overwriteMerge = (_, sourceArray, __) => sourceArray;
11500
- return cjs(defaultOptions, options, {
11501
- arrayMerge: overwriteMerge,
11502
- isMergeableObject: isPlainObject
11503
- });
11504
- }
11505
11761
  class TonConnectUI {
11506
11762
  constructor(options) {
11507
11763
  __publicField(this, "walletInfoStorage", new WalletInfoStorage());
11508
11764
  __publicField(this, "connector");
11509
11765
  __publicField(this, "_walletInfo", null);
11510
11766
  __publicField(this, "systemThemeChangeUnsubscribe", null);
11767
+ __publicField(this, "actionsConfiguration");
11511
11768
  if (options && "connector" in options && options.connector) {
11512
11769
  this.connector = options.connector;
11513
11770
  } else if (options && "manifestUrl" in options && options.manifestUrl) {
11514
- this.connector = new TonConnect({ manifestUrl: options.manifestUrl });
11771
+ this.connector = new TonConnect({
11772
+ manifestUrl: options.manifestUrl,
11773
+ walletsListSource: options.walletsListSource
11774
+ });
11515
11775
  } else {
11516
11776
  throw new TonConnectUIError(
11517
11777
  "You have to specify a `manifestUrl` or a `connector` in the options."
@@ -11521,9 +11781,13 @@ var __objRest = (source, exclude) => {
11521
11781
  const rootId = this.normalizeWidgetRoot(options == null ? void 0 : options.widgetRootId);
11522
11782
  this.subscribeToWalletChange();
11523
11783
  if ((options == null ? void 0 : options.restoreConnection) !== false) {
11524
- this.connector.restoreConnection();
11784
+ this.connector.restoreConnection().then(() => {
11785
+ if (!this.connector.connected) {
11786
+ this.walletInfoStorage.removeWalletInfo();
11787
+ }
11788
+ });
11525
11789
  }
11526
- this.uiOptions = options || {};
11790
+ this.uiOptions = mergeOptions(options, { uiPreferences: { theme: "SYSTEM" } });
11527
11791
  setAppState({ connector: this.connector });
11528
11792
  widgetController.renderApp(rootId, this);
11529
11793
  }
@@ -11543,28 +11807,30 @@ var __objRest = (source, exclude) => {
11543
11807
  return this._walletInfo;
11544
11808
  }
11545
11809
  set uiOptions(options) {
11546
- var _a;
11810
+ var _a, _b, _c, _d, _e;
11547
11811
  this.checkButtonRootExist(options.buttonRootId);
11548
- if (options.theme === "SYSTEM") {
11549
- setTheme(getSystemTheme());
11550
- if (!this.systemThemeChangeUnsubscribe) {
11551
- this.systemThemeChangeUnsubscribe = subscribeToThemeChange(
11552
- (theme) => setTheme(theme)
11553
- );
11812
+ this.actionsConfiguration = options.actionsConfiguration;
11813
+ if ((_a = options.uiPreferences) == null ? void 0 : _a.theme) {
11814
+ if (((_b = options.uiPreferences) == null ? void 0 : _b.theme) !== "SYSTEM") {
11815
+ (_c = this.systemThemeChangeUnsubscribe) == null ? void 0 : _c.call(this);
11816
+ setTheme(options.uiPreferences.theme, options.uiPreferences.colorsSet);
11817
+ } else {
11818
+ setTheme(getSystemTheme(), options.uiPreferences.colorsSet);
11819
+ if (!this.systemThemeChangeUnsubscribe) {
11820
+ this.systemThemeChangeUnsubscribe = subscribeToThemeChange(setTheme);
11821
+ }
11554
11822
  }
11555
11823
  } else {
11556
- if (options.theme) {
11557
- (_a = this.systemThemeChangeUnsubscribe) == null ? void 0 : _a.call(this);
11558
- setTheme(options.theme);
11824
+ if ((_d = options.uiPreferences) == null ? void 0 : _d.colorsSet) {
11825
+ setColors(options.uiPreferences.colorsSet);
11559
11826
  }
11560
11827
  }
11828
+ if ((_e = options.uiPreferences) == null ? void 0 : _e.borderRadius) {
11829
+ setBorderRadius(options.uiPreferences.borderRadius);
11830
+ }
11561
11831
  setAppState((state) => {
11562
11832
  const merged = mergeOptions(
11563
- {
11564
- language: options.language,
11565
- buttonConfiguration: options.buttonConfiguration,
11566
- widgetConfiguration: options.widgetConfiguration
11567
- },
11833
+ __spreadValues(__spreadValues({}, options.language && { language: options.language }), !!options.walletsList && { walletsList: options.walletsList }),
11568
11834
  unwrap(state)
11569
11835
  );
11570
11836
  if (options.buttonRootId !== void 0) {
@@ -11625,25 +11891,24 @@ var __objRest = (source, exclude) => {
11625
11891
  if (!isDevice("desktop") && "universalLink" in this.walletInfo) {
11626
11892
  openLink(this.walletInfo.universalLink);
11627
11893
  }
11628
- const notification = (options == null ? void 0 : options.notifications) || ["before", "success", "error"];
11629
- const modals = (options == null ? void 0 : options.modals) || ["before"];
11894
+ const { notifications: notifications2, modals } = this.getModalsAndNotificationsConfiguration(options);
11630
11895
  widgetController.setAction({
11631
11896
  name: "confirm-transaction",
11632
- showNotification: notification.includes("before"),
11897
+ showNotification: notifications2.includes("before"),
11633
11898
  openModal: modals.includes("before")
11634
11899
  });
11635
11900
  try {
11636
11901
  const result = yield this.connector.sendTransaction(tx);
11637
11902
  widgetController.setAction({
11638
11903
  name: "transaction-sent",
11639
- showNotification: notification.includes("success"),
11904
+ showNotification: notifications2.includes("success"),
11640
11905
  openModal: modals.includes("success")
11641
11906
  });
11642
11907
  return result;
11643
11908
  } catch (e2) {
11644
11909
  widgetController.setAction({
11645
11910
  name: "transaction-canceled",
11646
- showNotification: notification.includes("error"),
11911
+ showNotification: notifications2.includes("error"),
11647
11912
  openModal: modals.includes("error")
11648
11913
  });
11649
11914
  if (e2 instanceof TonConnectError$1) {
@@ -11652,8 +11917,6 @@ var __objRest = (source, exclude) => {
11652
11917
  console.error(e2);
11653
11918
  throw new TonConnectUIError("Unhandled error:" + e2);
11654
11919
  }
11655
- } finally {
11656
- widgetController.clearAction();
11657
11920
  }
11658
11921
  });
11659
11922
  }
@@ -11692,6 +11955,44 @@ var __objRest = (source, exclude) => {
11692
11955
  throw new TonConnectUIError(`${buttonRootId2} element not found in the document.`);
11693
11956
  }
11694
11957
  }
11958
+ getModalsAndNotificationsConfiguration(options) {
11959
+ var _a, _b, _c;
11960
+ const allActions = [
11961
+ "before",
11962
+ "success",
11963
+ "error"
11964
+ ];
11965
+ let notifications2 = allActions;
11966
+ if (((_a = this.actionsConfiguration) == null ? void 0 : _a.notifications) && ((_b = this.actionsConfiguration) == null ? void 0 : _b.notifications) !== "all") {
11967
+ notifications2 = this.actionsConfiguration.notifications;
11968
+ }
11969
+ if (options == null ? void 0 : options.notifications) {
11970
+ if (options.notifications === "all") {
11971
+ notifications2 = allActions;
11972
+ } else {
11973
+ notifications2 = options.notifications;
11974
+ }
11975
+ }
11976
+ let modals = ["before"];
11977
+ if ((_c = this.actionsConfiguration) == null ? void 0 : _c.modals) {
11978
+ if (this.actionsConfiguration.modals === "all") {
11979
+ modals = allActions;
11980
+ } else {
11981
+ modals = this.actionsConfiguration.modals;
11982
+ }
11983
+ }
11984
+ if (options == null ? void 0 : options.modals) {
11985
+ if (options.modals === "all") {
11986
+ modals = allActions;
11987
+ } else {
11988
+ modals = options.modals;
11989
+ }
11990
+ }
11991
+ return {
11992
+ notifications: notifications2,
11993
+ modals
11994
+ };
11995
+ }
11695
11996
  }
11696
11997
  const TonConnectUIContext = require$$0$2.createContext(null);
11697
11998
  let tonConnectUI = null;