@tonconnect/ui-react 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -26,7 +26,7 @@ var __objRest = (source, exclude) => {
26
26
  }
27
27
  return target;
28
28
  };
29
- import require$$0$2, { createContext as createContext$1, memo as memo$1, useContext as useContext$1, useEffect, useState } from "react";
29
+ import require$$0$2, { createContext as createContext$1, memo, useContext as useContext$1, useEffect, useState } from "react";
30
30
  var commonjsGlobal$1 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
31
31
  function getAugmentedNamespace$1(n2) {
32
32
  var f = n2.default;
@@ -4744,11 +4744,16 @@ class TonConnect {
4744
4744
  TonConnect.walletsList = new WalletsListManager();
4745
4745
  TonConnect.isWalletInjected = (walletJSKey) => InjectedProvider.isWalletInjected(walletJSKey);
4746
4746
  TonConnect.isInsideWalletBrowser = (walletJSKey) => InjectedProvider.isInsideWalletBrowser(walletJSKey);
4747
- function toUserFriendlyAddress$1(hexAddress) {
4747
+ const bounceableTag$1 = 17;
4748
+ const testOnlyTag$1 = 128;
4749
+ function toUserFriendlyAddress$1(hexAddress, testOnly = false) {
4748
4750
  const { wc, hex } = parseHexAddress$1(hexAddress);
4749
- const bounceableTag = 17;
4751
+ let tag = bounceableTag$1;
4752
+ if (testOnly) {
4753
+ tag |= testOnlyTag$1;
4754
+ }
4750
4755
  const addr = new Int8Array(34);
4751
- addr[0] = bounceableTag;
4756
+ addr[0] = tag;
4752
4757
  addr[1] = wc;
4753
4758
  addr.set(hex, 2);
4754
4759
  const addressWithChecksum = new Uint8Array(36);
@@ -4852,7 +4857,7 @@ let Updates = null;
4852
4857
  let Effects = null;
4853
4858
  let ExecCount = 0;
4854
4859
  function createRoot(fn, detachedOwner) {
4855
- const listener = Listener, owner = Owner, unowned = fn.length === 0, root = unowned && true ? UNOWNED : {
4860
+ const listener = Listener, owner = Owner, unowned = fn.length === 0, root = unowned ? UNOWNED : {
4856
4861
  owned: null,
4857
4862
  cleanups: null,
4858
4863
  context: null,
@@ -4948,8 +4953,8 @@ function createResource(pSource, pFetcher, pOptions) {
4948
4953
  runUpdates(() => {
4949
4954
  if (!err)
4950
4955
  setValue(() => v);
4951
- setError(err);
4952
4956
  setState(err ? "errored" : "ready");
4957
+ setError(err);
4953
4958
  for (const c2 of contexts.keys())
4954
4959
  c2.decrement();
4955
4960
  contexts.clear();
@@ -4988,7 +4993,7 @@ function createResource(pSource, pFetcher, pOptions) {
4988
4993
  refetching
4989
4994
  }));
4990
4995
  if (typeof p2 !== "object" || !(p2 && "then" in p2)) {
4991
- loadEnd(pr, p2);
4996
+ loadEnd(pr, p2, void 0, lookup2);
4992
4997
  return p2;
4993
4998
  }
4994
4999
  pr = p2;
@@ -4998,7 +5003,7 @@ function createResource(pSource, pFetcher, pOptions) {
4998
5003
  setState(resolved ? "refreshing" : "pending");
4999
5004
  trigger();
5000
5005
  }, false);
5001
- return p2.then((v) => loadEnd(p2, v, void 0, lookup2), (e2) => loadEnd(p2, void 0, castError(e2)));
5006
+ return p2.then((v) => loadEnd(p2, v, void 0, lookup2), (e2) => loadEnd(p2, void 0, castError(e2), lookup2));
5002
5007
  }
5003
5008
  Object.defineProperties(read, {
5004
5009
  state: {
@@ -5037,11 +5042,13 @@ function batch(fn) {
5037
5042
  return runUpdates(fn, false);
5038
5043
  }
5039
5044
  function untrack(fn) {
5040
- let result, listener = Listener;
5045
+ const listener = Listener;
5041
5046
  Listener = null;
5042
- result = fn();
5043
- Listener = listener;
5044
- return result;
5047
+ try {
5048
+ return fn();
5049
+ } finally {
5050
+ Listener = listener;
5051
+ }
5045
5052
  }
5046
5053
  function on(deps, fn, options) {
5047
5054
  const isArray = Array.isArray(deps);
@@ -5079,7 +5086,7 @@ function onCleanup(fn) {
5079
5086
  function getListener() {
5080
5087
  return Listener;
5081
5088
  }
5082
- function createContext(defaultValue) {
5089
+ function createContext(defaultValue, options) {
5083
5090
  const id = Symbol("context");
5084
5091
  return {
5085
5092
  id,
@@ -5377,7 +5384,7 @@ function resolveChildren(children2) {
5377
5384
  }
5378
5385
  return children2;
5379
5386
  }
5380
- function createProvider(id) {
5387
+ function createProvider(id, options) {
5381
5388
  return function provider(props) {
5382
5389
  let res;
5383
5390
  createRenderEffect(() => res = untrack(() => {
@@ -5385,7 +5392,7 @@ function createProvider(id) {
5385
5392
  [id]: props.value
5386
5393
  };
5387
5394
  return children(() => props.children);
5388
- }));
5395
+ }), void 0);
5389
5396
  return res;
5390
5397
  };
5391
5398
  }
@@ -5497,6 +5504,8 @@ const propTraps = {
5497
5504
  return _.get(property);
5498
5505
  },
5499
5506
  has(_, property) {
5507
+ if (property === $PROXY)
5508
+ return true;
5500
5509
  return _.has(property);
5501
5510
  },
5502
5511
  set: trueFn,
@@ -5517,68 +5526,116 @@ const propTraps = {
5517
5526
  }
5518
5527
  };
5519
5528
  function resolveSource(s2) {
5520
- return (s2 = typeof s2 === "function" ? s2() : s2) == null ? {} : s2;
5529
+ return !(s2 = typeof s2 === "function" ? s2() : s2) ? {} : s2;
5521
5530
  }
5522
5531
  function mergeProps(...sources) {
5523
- return new Proxy({
5524
- get(property) {
5525
- for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5526
- const v = resolveSource(sources[i2])[property];
5527
- if (v !== void 0)
5528
- return v;
5529
- }
5530
- },
5531
- has(property) {
5532
- for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5533
- if (property in resolveSource(sources[i2]))
5534
- return true;
5532
+ let proxy = false;
5533
+ for (let i2 = 0; i2 < sources.length; i2++) {
5534
+ const s2 = sources[i2];
5535
+ proxy = proxy || !!s2 && $PROXY in s2;
5536
+ sources[i2] = typeof s2 === "function" ? (proxy = true, createMemo(s2)) : s2;
5537
+ }
5538
+ if (proxy) {
5539
+ return new Proxy({
5540
+ get(property) {
5541
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5542
+ const v = resolveSource(sources[i2])[property];
5543
+ if (v !== void 0)
5544
+ return v;
5545
+ }
5546
+ },
5547
+ has(property) {
5548
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5549
+ if (property in resolveSource(sources[i2]))
5550
+ return true;
5551
+ }
5552
+ return false;
5553
+ },
5554
+ keys() {
5555
+ const keys = [];
5556
+ for (let i2 = 0; i2 < sources.length; i2++)
5557
+ keys.push(...Object.keys(resolveSource(sources[i2])));
5558
+ return [...new Set(keys)];
5559
+ }
5560
+ }, propTraps);
5561
+ }
5562
+ const target = {};
5563
+ for (let i2 = sources.length - 1; i2 >= 0; i2--) {
5564
+ if (sources[i2]) {
5565
+ const descriptors = Object.getOwnPropertyDescriptors(sources[i2]);
5566
+ for (const key in descriptors) {
5567
+ if (key in target)
5568
+ continue;
5569
+ Object.defineProperty(target, key, {
5570
+ enumerable: true,
5571
+ get() {
5572
+ for (let i3 = sources.length - 1; i3 >= 0; i3--) {
5573
+ const v = (sources[i3] || {})[key];
5574
+ if (v !== void 0)
5575
+ return v;
5576
+ }
5577
+ }
5578
+ });
5535
5579
  }
5536
- return false;
5537
- },
5538
- keys() {
5539
- const keys = [];
5540
- for (let i2 = 0; i2 < sources.length; i2++)
5541
- keys.push(...Object.keys(resolveSource(sources[i2])));
5542
- return [...new Set(keys)];
5543
5580
  }
5544
- }, propTraps);
5581
+ }
5582
+ return target;
5545
5583
  }
5546
5584
  function splitProps(props, ...keys) {
5547
5585
  const blocked = new Set(keys.flat());
5586
+ if ($PROXY in props) {
5587
+ const res = keys.map((k) => {
5588
+ return new Proxy({
5589
+ get(property) {
5590
+ return k.includes(property) ? props[property] : void 0;
5591
+ },
5592
+ has(property) {
5593
+ return k.includes(property) && property in props;
5594
+ },
5595
+ keys() {
5596
+ return k.filter((property) => property in props);
5597
+ }
5598
+ }, propTraps);
5599
+ });
5600
+ res.push(new Proxy({
5601
+ get(property) {
5602
+ return blocked.has(property) ? void 0 : props[property];
5603
+ },
5604
+ has(property) {
5605
+ return blocked.has(property) ? false : property in props;
5606
+ },
5607
+ keys() {
5608
+ return Object.keys(props).filter((k) => !blocked.has(k));
5609
+ }
5610
+ }, propTraps));
5611
+ return res;
5612
+ }
5548
5613
  const descriptors = Object.getOwnPropertyDescriptors(props);
5549
- const res = keys.map((k) => {
5614
+ keys.push(Object.keys(descriptors).filter((k) => !blocked.has(k)));
5615
+ return keys.map((k) => {
5550
5616
  const clone = {};
5551
5617
  for (let i2 = 0; i2 < k.length; i2++) {
5552
5618
  const key = k[i2];
5619
+ if (!(key in props))
5620
+ continue;
5553
5621
  Object.defineProperty(clone, key, descriptors[key] ? descriptors[key] : {
5554
5622
  get() {
5555
5623
  return props[key];
5556
5624
  },
5557
5625
  set() {
5558
5626
  return true;
5559
- }
5627
+ },
5628
+ enumerable: true
5560
5629
  });
5561
5630
  }
5562
5631
  return clone;
5563
5632
  });
5564
- res.push(new Proxy({
5565
- get(property) {
5566
- return blocked.has(property) ? void 0 : props[property];
5567
- },
5568
- has(property) {
5569
- return blocked.has(property) ? false : property in props;
5570
- },
5571
- keys() {
5572
- return Object.keys(props).filter((k) => !blocked.has(k));
5573
- }
5574
- }, propTraps));
5575
- return res;
5576
5633
  }
5577
5634
  function For(props) {
5578
5635
  const fallback = "fallback" in props && {
5579
5636
  fallback: () => props.fallback
5580
5637
  };
5581
- return createMemo(mapArray(() => props.each, props.children, fallback ? fallback : void 0));
5638
+ return createMemo(mapArray(() => props.each, props.children, fallback || void 0));
5582
5639
  }
5583
5640
  function Show(props) {
5584
5641
  let strictEqual = false;
@@ -5595,11 +5652,12 @@ function Show(props) {
5595
5652
  return fn ? untrack(() => child(c2)) : child;
5596
5653
  }
5597
5654
  return props.fallback;
5598
- });
5655
+ }, void 0, void 0);
5599
5656
  }
5600
5657
  function Switch(props) {
5601
5658
  let strictEqual = false;
5602
5659
  let keyed = false;
5660
+ const equals = (a2, b) => a2[0] === b[0] && (strictEqual ? a2[1] === b[1] : !a2[1] === !b[1]) && a2[2] === b[2];
5603
5661
  const conditions = children(() => props.children), evalConditions = createMemo(() => {
5604
5662
  let conds = conditions();
5605
5663
  if (!Array.isArray(conds))
@@ -5613,7 +5671,7 @@ function Switch(props) {
5613
5671
  }
5614
5672
  return [-1];
5615
5673
  }, void 0, {
5616
- equals: (a2, b) => a2[0] === b[0] && (strictEqual ? a2[1] === b[1] : !a2[1] === !b[1]) && a2[2] === b[2]
5674
+ equals
5617
5675
  });
5618
5676
  return createMemo(() => {
5619
5677
  const [index, when, cond] = evalConditions();
@@ -5623,7 +5681,7 @@ function Switch(props) {
5623
5681
  const fn = typeof c2 === "function" && c2.length > 0;
5624
5682
  strictEqual = keyed || fn;
5625
5683
  return fn ? untrack(() => c2(when)) : c2;
5626
- });
5684
+ }, void 0, void 0);
5627
5685
  }
5628
5686
  function Match(props) {
5629
5687
  return props;
@@ -5631,18 +5689,18 @@ function Match(props) {
5631
5689
  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"];
5632
5690
  const Properties = /* @__PURE__ */ new Set(["className", "value", "readOnly", "formNoValidate", "isMap", "noModule", "playsInline", ...booleans]);
5633
5691
  const ChildProperties = /* @__PURE__ */ new Set(["innerHTML", "textContent", "innerText", "children"]);
5634
- const Aliases = {
5692
+ const Aliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
5635
5693
  className: "class",
5636
5694
  htmlFor: "for"
5637
- };
5638
- const PropAliases = {
5695
+ });
5696
+ const PropAliases = /* @__PURE__ */ Object.assign(/* @__PURE__ */ Object.create(null), {
5639
5697
  class: "className",
5640
5698
  formnovalidate: "formNoValidate",
5641
5699
  ismap: "isMap",
5642
5700
  nomodule: "noModule",
5643
5701
  playsinline: "playsInline",
5644
5702
  readonly: "readOnly"
5645
- };
5703
+ });
5646
5704
  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"]);
5647
5705
  const SVGElements = /* @__PURE__ */ new Set([
5648
5706
  "altGlyph",
@@ -5726,11 +5784,6 @@ const SVGNamespace = {
5726
5784
  xlink: "http://www.w3.org/1999/xlink",
5727
5785
  xml: "http://www.w3.org/XML/1998/namespace"
5728
5786
  };
5729
- function memo(fn, equals) {
5730
- return createMemo(fn, void 0, !equals ? {
5731
- equals
5732
- } : void 0);
5733
- }
5734
5787
  function reconcileArrays(parentNode, a2, b) {
5735
5788
  let bLength = b.length, aEnd = a2.length, bEnd = bLength, aStart = 0, bStart = 0, after = a2[aEnd - 1].nextSibling, map = null;
5736
5789
  while (aStart < aEnd || bStart < bEnd) {
@@ -5788,12 +5841,12 @@ function reconcileArrays(parentNode, a2, b) {
5788
5841
  }
5789
5842
  }
5790
5843
  const $$EVENTS = "_$DX_DELEGATE";
5791
- function render(code, element, init) {
5844
+ function render(code, element, init, options = {}) {
5792
5845
  let disposer;
5793
5846
  createRoot((dispose2) => {
5794
5847
  disposer = dispose2;
5795
5848
  element === document ? code() : insert(element, code(), element.firstChild ? null : void 0, init);
5796
- });
5849
+ }, options.owner);
5797
5850
  return () => {
5798
5851
  disposer();
5799
5852
  element.textContent = "";
@@ -5890,11 +5943,14 @@ function style(node, value, prev) {
5890
5943
  }
5891
5944
  return prev;
5892
5945
  }
5893
- function spread(node, accessor, isSVG, skipChildren) {
5894
- if (typeof accessor === "function") {
5895
- createRenderEffect((current) => spreadExpression(node, accessor(), current, isSVG, skipChildren));
5896
- } else
5897
- spreadExpression(node, accessor, void 0, isSVG, skipChildren);
5946
+ function spread(node, props = {}, isSVG, skipChildren) {
5947
+ const prevProps = {};
5948
+ if (!skipChildren) {
5949
+ createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
5950
+ }
5951
+ createRenderEffect(() => props.ref && props.ref(node));
5952
+ createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
5953
+ return prevProps;
5898
5954
  }
5899
5955
  function use(fn, element, arg) {
5900
5956
  return untrack(() => fn(element, arg));
@@ -5952,9 +6008,8 @@ function assignProp(node, prop, value, prev, isSVG, skipRef) {
5952
6008
  if (value === prev)
5953
6009
  return prev;
5954
6010
  if (prop === "ref") {
5955
- if (!skipRef) {
6011
+ if (!skipRef)
5956
6012
  value(node);
5957
- }
5958
6013
  } else if (prop.slice(0, 3) === "on:") {
5959
6014
  const e2 = prop.slice(3);
5960
6015
  prev && node.removeEventListener(e2, prev);
@@ -6009,7 +6064,7 @@ function eventHandler(e2) {
6009
6064
  sharedConfig.done = true;
6010
6065
  document.querySelectorAll("[id^=pl-]").forEach((elem) => elem.remove());
6011
6066
  }
6012
- while (node !== null) {
6067
+ while (node) {
6013
6068
  const handler = node[key];
6014
6069
  if (handler && !node.disabled) {
6015
6070
  const data = node[`${key}Data`];
@@ -6017,17 +6072,8 @@ function eventHandler(e2) {
6017
6072
  if (e2.cancelBubble)
6018
6073
  return;
6019
6074
  }
6020
- node = node.host && node.host !== node && node.host instanceof Node ? node.host : node.parentNode;
6021
- }
6022
- }
6023
- function spreadExpression(node, props, prevProps = {}, isSVG, skipChildren) {
6024
- props || (props = {});
6025
- if (!skipChildren) {
6026
- createRenderEffect(() => prevProps.children = insertExpression(node, props.children, prevProps.children));
6075
+ node = node._$host || node.parentNode || node.host;
6027
6076
  }
6028
- createRenderEffect(() => props.ref && props.ref(node));
6029
- createRenderEffect(() => assign(node, props, isSVG, true, prevProps, true));
6030
- return prevProps;
6031
6077
  }
6032
6078
  function insertExpression(parent, value, current, marker, unwrapArray) {
6033
6079
  if (sharedConfig.context && !current)
@@ -6142,7 +6188,7 @@ function normalizeIncomingArray(normalized, array, current, unwrap2) {
6142
6188
  }
6143
6189
  return dynamic;
6144
6190
  }
6145
- function appendNodes(parent, array, marker) {
6191
+ function appendNodes(parent, array, marker = null) {
6146
6192
  for (let i2 = 0, len = array.length; i2 < len; i2++)
6147
6193
  parent.insertBefore(array[i2], marker);
6148
6194
  }
@@ -6201,10 +6247,11 @@ function Portal(props) {
6201
6247
  const container = createElement(props.isSVG ? "g" : "div", props.isSVG), renderRoot = useShadow && container.attachShadow ? container.attachShadow({
6202
6248
  mode: "open"
6203
6249
  }) : container;
6204
- Object.defineProperty(container, "host", {
6250
+ Object.defineProperty(container, "_$host", {
6205
6251
  get() {
6206
6252
  return marker.parentNode;
6207
- }
6253
+ },
6254
+ configurable: true
6208
6255
  });
6209
6256
  insert(renderRoot, renderPortal());
6210
6257
  mount.appendChild(container);
@@ -6507,9 +6554,9 @@ function wrap$1(value, name) {
6507
6554
  for (let i2 = 0, l2 = keys.length; i2 < l2; i2++) {
6508
6555
  const prop = keys[i2];
6509
6556
  if (desc[prop].get) {
6510
- const get = desc[prop].get.bind(p2);
6511
6557
  Object.defineProperty(value, prop, {
6512
- get
6558
+ enumerable: desc[prop].enumerable,
6559
+ get: desc[prop].get.bind(p2)
6513
6560
  });
6514
6561
  }
6515
6562
  }
@@ -6565,7 +6612,7 @@ function getDataNodes(target) {
6565
6612
  function getDataNode(nodes, property, value) {
6566
6613
  return nodes[property] || (nodes[property] = createDataNode(value));
6567
6614
  }
6568
- function proxyDescriptor(target, property) {
6615
+ function proxyDescriptor$1(target, property) {
6569
6616
  const desc = Reflect.getOwnPropertyDescriptor(target, property);
6570
6617
  if (!desc || desc.get || !desc.configurable || property === $PROXY || property === $NODE || property === $NAME)
6571
6618
  return desc;
@@ -6617,8 +6664,7 @@ const proxyTraps$1 = {
6617
6664
  has(target, property) {
6618
6665
  if (property === $RAW || property === $PROXY || property === $TRACK || property === $NODE || property === "__proto__")
6619
6666
  return true;
6620
- const tracked = getDataNodes(target)[property];
6621
- tracked && tracked();
6667
+ this.get(target, property, target);
6622
6668
  return property in target;
6623
6669
  },
6624
6670
  set() {
@@ -6628,16 +6674,15 @@ const proxyTraps$1 = {
6628
6674
  return true;
6629
6675
  },
6630
6676
  ownKeys,
6631
- getOwnPropertyDescriptor: proxyDescriptor
6677
+ getOwnPropertyDescriptor: proxyDescriptor$1
6632
6678
  };
6633
6679
  function setProperty(state, property, value, deleting = false) {
6634
6680
  if (!deleting && state[property] === value)
6635
6681
  return;
6636
- const prev = state[property];
6637
- const len = state.length;
6638
- if (value === void 0) {
6682
+ const prev = state[property], len = state.length;
6683
+ if (value === void 0)
6639
6684
  delete state[property];
6640
- } else
6685
+ else
6641
6686
  state[property] = value;
6642
6687
  let nodes = getDataNodes(state), node;
6643
6688
  if (node = getDataNode(nodes, property, prev))
@@ -6733,59 +6778,235 @@ var THEME = /* @__PURE__ */ ((THEME2) => {
6733
6778
  THEME2["LIGHT"] = "LIGHT";
6734
6779
  return THEME2;
6735
6780
  })(THEME || {});
6736
- function hexToRgb(hex) {
6737
- if (hex[0] === "#") {
6738
- hex = hex.slice(1);
6739
- }
6740
- const bigint = parseInt(hex, 16);
6741
- const r = bigint >> 16 & 255;
6742
- const g = bigint >> 8 & 255;
6743
- const b = bigint & 255;
6744
- return [r, g, b].join(",");
6745
- }
6746
- const generateLightColors = (accentColor) => ({
6747
- primary: accentColor,
6748
- secondary: `rgba(${hexToRgb(accentColor)}, 0.16)`,
6749
- backgroundPrimary: "#FFFFFF",
6750
- backgroundSecondary: "#EFF1F3",
6751
- font: {
6752
- accent: accentColor,
6781
+ const defaultLightColorsSet = {
6782
+ constant: {
6783
+ black: "#000000",
6784
+ white: "#FFFFFF"
6785
+ },
6786
+ connectButton: {
6787
+ background: "#31A6F5",
6788
+ foreground: "#FFFFFF"
6789
+ },
6790
+ accent: "#31A6F5",
6791
+ icon: {
6792
+ primary: "#0F0F0F",
6793
+ secondary: "#7A8999",
6794
+ tertiary: "#C1CAD2",
6795
+ success: "#29CC6A"
6796
+ },
6797
+ background: {
6798
+ primary: "#FFFFFF",
6799
+ secondary: "#F1F3F5"
6800
+ },
6801
+ text: {
6753
6802
  primary: "#0F0F0F",
6754
6803
  secondary: "#7A8999",
6755
- third: "#7A8999"
6804
+ subhead: "#6A7785"
6756
6805
  }
6757
- });
6758
- const generateDarkColors = (accentColor) => ({
6759
- primary: accentColor,
6760
- secondary: accentColor,
6761
- backgroundPrimary: "#121214",
6762
- backgroundSecondary: "#18181A",
6763
- font: {
6764
- accent: "#E5E5EA",
6806
+ };
6807
+ const defaultDarkColorsSet = {
6808
+ constant: {
6809
+ black: "#000000",
6810
+ white: "#FFFFFF"
6811
+ },
6812
+ connectButton: {
6813
+ background: "#31A6F5",
6814
+ foreground: "#FFFFFF"
6815
+ },
6816
+ accent: "#E5E5EA",
6817
+ icon: {
6818
+ primary: "#E5E5EA",
6819
+ secondary: "#909099",
6820
+ tertiary: "#434347",
6821
+ success: "#29CC6A"
6822
+ },
6823
+ background: {
6824
+ primary: "#121214",
6825
+ secondary: "#18181A"
6826
+ },
6827
+ text: {
6765
6828
  primary: "#E5E5EA",
6766
6829
  secondary: "#7D7D85",
6767
- third: "#909099"
6830
+ subhead: "#8C8C93"
6768
6831
  }
6769
- });
6770
- const defaultLightColors = generateLightColors("#31A6F5");
6771
- const defaultDarkColors = generateDarkColors("#262629");
6832
+ };
6833
+ var isMergeableObject = function isMergeableObject2(value) {
6834
+ return isNonNullObject(value) && !isSpecial(value);
6835
+ };
6836
+ function isNonNullObject(value) {
6837
+ return !!value && typeof value === "object";
6838
+ }
6839
+ function isSpecial(value) {
6840
+ var stringValue = Object.prototype.toString.call(value);
6841
+ return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
6842
+ }
6843
+ var canUseSymbol = typeof Symbol === "function" && Symbol.for;
6844
+ var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
6845
+ function isReactElement(value) {
6846
+ return value.$$typeof === REACT_ELEMENT_TYPE;
6847
+ }
6848
+ function emptyTarget(val) {
6849
+ return Array.isArray(val) ? [] : {};
6850
+ }
6851
+ function cloneUnlessOtherwiseSpecified(value, options) {
6852
+ return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
6853
+ }
6854
+ function defaultArrayMerge(target, source, options) {
6855
+ return target.concat(source).map(function(element) {
6856
+ return cloneUnlessOtherwiseSpecified(element, options);
6857
+ });
6858
+ }
6859
+ function getMergeFunction(key, options) {
6860
+ if (!options.customMerge) {
6861
+ return deepmerge;
6862
+ }
6863
+ var customMerge = options.customMerge(key);
6864
+ return typeof customMerge === "function" ? customMerge : deepmerge;
6865
+ }
6866
+ function getEnumerableOwnPropertySymbols(target) {
6867
+ return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
6868
+ return target.propertyIsEnumerable(symbol);
6869
+ }) : [];
6870
+ }
6871
+ function getKeys(target) {
6872
+ return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
6873
+ }
6874
+ function propertyIsOnObject(object, property) {
6875
+ try {
6876
+ return property in object;
6877
+ } catch (_) {
6878
+ return false;
6879
+ }
6880
+ }
6881
+ function propertyIsUnsafe(target, key) {
6882
+ return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
6883
+ }
6884
+ function mergeObject(target, source, options) {
6885
+ var destination = {};
6886
+ if (options.isMergeableObject(target)) {
6887
+ getKeys(target).forEach(function(key) {
6888
+ destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
6889
+ });
6890
+ }
6891
+ getKeys(source).forEach(function(key) {
6892
+ if (propertyIsUnsafe(target, key)) {
6893
+ return;
6894
+ }
6895
+ if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
6896
+ destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
6897
+ } else {
6898
+ destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
6899
+ }
6900
+ });
6901
+ return destination;
6902
+ }
6903
+ function deepmerge(target, source, options) {
6904
+ options = options || {};
6905
+ options.arrayMerge = options.arrayMerge || defaultArrayMerge;
6906
+ options.isMergeableObject = options.isMergeableObject || isMergeableObject;
6907
+ options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
6908
+ var sourceIsArray = Array.isArray(source);
6909
+ var targetIsArray = Array.isArray(target);
6910
+ var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
6911
+ if (!sourceAndTargetTypesMatch) {
6912
+ return cloneUnlessOtherwiseSpecified(source, options);
6913
+ } else if (sourceIsArray) {
6914
+ return options.arrayMerge(target, source, options);
6915
+ } else {
6916
+ return mergeObject(target, source, options);
6917
+ }
6918
+ }
6919
+ deepmerge.all = function deepmergeAll(array, options) {
6920
+ if (!Array.isArray(array)) {
6921
+ throw new Error("first argument should be an array");
6922
+ }
6923
+ return array.reduce(function(prev, next) {
6924
+ return deepmerge(prev, next, options);
6925
+ }, {});
6926
+ };
6927
+ var deepmerge_1 = deepmerge;
6928
+ var cjs = deepmerge_1;
6929
+ /*!
6930
+ * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
6931
+ *
6932
+ * Copyright (c) 2014-2017, Jon Schlinkert.
6933
+ * Released under the MIT License.
6934
+ */
6935
+ function isObject(o2) {
6936
+ return Object.prototype.toString.call(o2) === "[object Object]";
6937
+ }
6938
+ function isPlainObject(o2) {
6939
+ var ctor, prot;
6940
+ if (isObject(o2) === false)
6941
+ return false;
6942
+ ctor = o2.constructor;
6943
+ if (ctor === void 0)
6944
+ return true;
6945
+ prot = ctor.prototype;
6946
+ if (isObject(prot) === false)
6947
+ return false;
6948
+ if (prot.hasOwnProperty("isPrototypeOf") === false) {
6949
+ return false;
6950
+ }
6951
+ return true;
6952
+ }
6953
+ function mergeOptions(options, defaultOptions) {
6954
+ if (!options) {
6955
+ return defaultOptions;
6956
+ }
6957
+ const overwriteMerge = (_, sourceArray, __) => sourceArray;
6958
+ return cjs(defaultOptions, options, {
6959
+ arrayMerge: overwriteMerge,
6960
+ isMergeableObject: isPlainObject
6961
+ });
6962
+ }
6772
6963
  const [themeState, setThemeState] = createStore({
6773
6964
  theme: THEME.LIGHT,
6774
- accentColor: defaultLightColors.primary,
6775
- colors: defaultLightColors
6965
+ colors: defaultLightColorsSet,
6966
+ borderRadius: "m"
6776
6967
  });
6777
- function setTheme(theme) {
6778
- if (theme === THEME.LIGHT) {
6779
- setThemeState({
6780
- theme,
6781
- colors: defaultLightColors
6782
- });
6783
- } else {
6784
- setThemeState({
6785
- theme,
6786
- colors: defaultDarkColors
6787
- });
6968
+ const themeColorsMappingDefault = {
6969
+ [THEME.LIGHT]: defaultLightColorsSet,
6970
+ [THEME.DARK]: defaultDarkColorsSet
6971
+ };
6972
+ const themeCustomColors = {
6973
+ [THEME.LIGHT]: void 0,
6974
+ [THEME.DARK]: void 0
6975
+ };
6976
+ function setTheme(theme, colorsSet) {
6977
+ if (colorsSet) {
6978
+ themeCustomColors[THEME.DARK] = mergeOptions(
6979
+ colorsSet[THEME.DARK],
6980
+ themeCustomColors[THEME.DARK]
6981
+ );
6982
+ themeCustomColors[THEME.LIGHT] = mergeOptions(
6983
+ colorsSet[THEME.LIGHT],
6984
+ themeCustomColors[THEME.LIGHT]
6985
+ );
6788
6986
  }
6987
+ setThemeState({
6988
+ theme,
6989
+ colors: mergeOptions(themeCustomColors[theme], themeColorsMappingDefault[theme])
6990
+ });
6991
+ }
6992
+ function setBorderRadius(borderRadius) {
6993
+ setThemeState({ borderRadius });
6994
+ }
6995
+ function setColors(colorsSet) {
6996
+ themeCustomColors[THEME.DARK] = mergeOptions(
6997
+ colorsSet[THEME.DARK],
6998
+ themeCustomColors[THEME.DARK]
6999
+ );
7000
+ themeCustomColors[THEME.LIGHT] = mergeOptions(
7001
+ colorsSet[THEME.LIGHT],
7002
+ themeCustomColors[THEME.LIGHT]
7003
+ );
7004
+ setThemeState((state) => ({
7005
+ colors: mergeOptions(
7006
+ themeCustomColors[state.theme],
7007
+ themeColorsMappingDefault[state.theme]
7008
+ )
7009
+ }));
6789
7010
  }
6790
7011
  const GlobalStyles = () => {
6791
7012
  document.body.addEventListener("mousedown", () => document.body.classList.add("using-mouse"));
@@ -6823,22 +7044,41 @@ const GlobalStyles = () => {
6823
7044
  `;
6824
7045
  return createComponent(Styles, {});
6825
7046
  };
7047
+ function hexToRgb(hex) {
7048
+ if (hex[0] === "#") {
7049
+ hex = hex.slice(1);
7050
+ }
7051
+ const bigint = parseInt(hex, 16);
7052
+ const r = bigint >> 16 & 255;
7053
+ const g = bigint >> 8 & 255;
7054
+ const b = bigint & 255;
7055
+ return [r, g, b].join(",");
7056
+ }
7057
+ function rgba(color, opacity) {
7058
+ if (color[0] === "#") {
7059
+ color = hexToRgb(color);
7060
+ }
7061
+ return `rgba(${color}, ${opacity})`;
7062
+ }
7063
+ const borders$3 = {
7064
+ m: "16px",
7065
+ s: "8px",
7066
+ none: "0"
7067
+ };
6826
7068
  const ButtonStyled$2 = styled.button`
6827
- background-color: ${(props) => props.appearance === "flat" ? props.theme.colors.backgroundPrimary : props.theme.colors[props.appearance]};
6828
- color: ${(props) => props.appearance === "primary" ? "white" : props.appearance === "flat" ? props.theme.colors.font.primary : props.theme.colors.font.accent};
7069
+ background-color: ${(props) => rgba(props.theme.colors.accent, 0.12)};
7070
+ color: ${(props) => props.theme.colors.accent};
6829
7071
 
6830
- box-shadow: ${(props) => props.appearance === "flat" ? "0 4px 24px rgba(0, 0, 0, 0.16);" : "unset;"}
6831
-
6832
7072
  padding: 9px 16px;
6833
7073
  border: none;
6834
- border-radius: 16px;
7074
+ border-radius: ${(props) => borders$3[props.theme.borderRadius]};
6835
7075
  cursor: pointer;
6836
7076
 
6837
7077
  font-size: 14px;
6838
7078
  font-weight: 590;
6839
7079
  line-height: 18px;
6840
7080
  letter-spacing: -0.154px;
6841
-
7081
+
6842
7082
  transition: transform 0.1s ease-in-out;
6843
7083
 
6844
7084
  &:hover {
@@ -6850,13 +7090,12 @@ const ButtonStyled$2 = styled.button`
6850
7090
  }
6851
7091
  `;
6852
7092
  const Button = (props) => {
6853
- const appearance = () => props.appearance || "primary";
6854
7093
  return createComponent(ButtonStyled$2, {
6855
7094
  get ["class"]() {
6856
7095
  return props.class;
6857
7096
  },
6858
- get appearance() {
6859
- return appearance();
7097
+ get id() {
7098
+ return props.id;
6860
7099
  },
6861
7100
  onClick: () => props.onClick(),
6862
7101
  ref(r$) {
@@ -7264,7 +7503,7 @@ const rotationDegrees = {
7264
7503
  };
7265
7504
  const ArrowIcon = (props) => {
7266
7505
  const theme = useTheme();
7267
- const fill = () => props.fill || theme.colors.font.third;
7506
+ const fill = () => props.fill || theme.colors.icon.secondary;
7268
7507
  const direction = () => props.direction || "left";
7269
7508
  const Svg = styled("svg")`
7270
7509
  transform: rotate(${(props2) => rotationDegrees[props2.svgDirection]}deg);
@@ -7289,7 +7528,7 @@ const ArrowIcon = (props) => {
7289
7528
  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>`);
7290
7529
  const CloseIcon = (props) => {
7291
7530
  const theme = useTheme();
7292
- const fill = () => props.fill || theme.colors.font.third;
7531
+ const fill = () => props.fill || theme.colors.icon.secondary;
7293
7532
  return (() => {
7294
7533
  const _el$ = _tmpl$$e.cloneNode(true), _el$2 = _el$.firstChild;
7295
7534
  createRenderEffect(() => setAttribute(_el$2, "stroke", fill()));
@@ -7304,7 +7543,7 @@ const IconButtonStyled = styled.button`
7304
7543
  width: 32px;
7305
7544
  height: 32px;
7306
7545
  border-radius: 50%;
7307
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
7546
+ background-color: ${(props) => props.theme.colors.background.secondary};
7308
7547
  border: none;
7309
7548
  cursor: pointer;
7310
7549
 
@@ -7389,14 +7628,12 @@ const ModalBackgroundStyled = styled.div`
7389
7628
  const ModalWrapperClass = u`
7390
7629
  position: relative;
7391
7630
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 16px 64px rgba(0, 0, 0, 0.16);
7392
- border-radius: 24px;
7393
7631
  min-height: 100px;
7394
7632
  width: 440px;
7395
7633
  padding: 44px 56px 24px;
7396
7634
 
7397
7635
  ${media("mobile")} {
7398
7636
  width: 100%;
7399
- border-radius: 24px 24px 0 0;
7400
7637
  }
7401
7638
  `;
7402
7639
  const CloseButtonStyled = styled(IconButton)`
@@ -7407,6 +7644,11 @@ const CloseButtonStyled = styled(IconButton)`
7407
7644
  const _tmpl$$d = /* @__PURE__ */ template$1(`<div></div>`);
7408
7645
  const clickOutside = clickOutside$1;
7409
7646
  const keyPressed = escPressed;
7647
+ const borders$2 = {
7648
+ m: "24px",
7649
+ s: "16px",
7650
+ none: "0"
7651
+ };
7410
7652
  const Modal = (props) => {
7411
7653
  const theme = useTheme();
7412
7654
  return createComponent(Transition, {
@@ -7467,9 +7709,23 @@ const Modal = (props) => {
7467
7709
  onClick: () => props.onClose()
7468
7710
  }), null);
7469
7711
  insert(_el$, () => props.children, null);
7470
- createRenderEffect(() => className(_el$, cn(ModalWrapperClass, props.class, u`
7471
- background-color: ${theme.colors.backgroundPrimary};
7472
- `)));
7712
+ createRenderEffect((_p$) => {
7713
+ const _v$ = props.id, _v$2 = cn(ModalWrapperClass, props.class, u`
7714
+ background-color: ${theme.colors.background.primary};
7715
+ border-radius: ${borders$2[theme.borderRadius]};
7716
+
7717
+ ${media("mobile")} {
7718
+ border-radius: ${borders$2[theme.borderRadius]}
7719
+ ${borders$2[theme.borderRadius]} 0 0;
7720
+ }
7721
+ `);
7722
+ _v$ !== _p$._v$ && setAttribute(_el$, "id", _p$._v$ = _v$);
7723
+ _v$2 !== _p$._v$2 && className(_el$, _p$._v$2 = _v$2);
7724
+ return _p$;
7725
+ }, {
7726
+ _v$: void 0,
7727
+ _v$2: void 0
7728
+ });
7473
7729
  return _el$;
7474
7730
  }
7475
7731
  });
@@ -7514,7 +7770,7 @@ const H1Styled$2 = styled.h1`
7514
7770
  text-align: center;
7515
7771
  letter-spacing: 0.072px;
7516
7772
 
7517
- color: ${(props) => props.theme.colors.font.primary};
7773
+ color: ${(props) => props.theme.colors.text.primary};
7518
7774
 
7519
7775
  margin-top: 0;
7520
7776
  margin-bottom: 6px;
@@ -7527,7 +7783,7 @@ const H1 = (props) => {
7527
7783
  },
7528
7784
  get children() {
7529
7785
  var _a;
7530
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7786
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7531
7787
  }
7532
7788
  });
7533
7789
  };
@@ -7540,7 +7796,7 @@ const H2Styled$1 = styled.h2`
7540
7796
  text-align: center;
7541
7797
  letter-spacing: -0.32px;
7542
7798
 
7543
- color: ${(props) => props.theme.colors.font.secondary};
7799
+ color: ${(props) => props.theme.colors.text.secondary};
7544
7800
 
7545
7801
  margin-top: 0;
7546
7802
  margin-bottom: 32px;
@@ -7553,7 +7809,7 @@ const H2 = (props) => {
7553
7809
  },
7554
7810
  get children() {
7555
7811
  var _a;
7556
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7812
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7557
7813
  }
7558
7814
  });
7559
7815
  };
@@ -7565,17 +7821,17 @@ const H3Styled = styled.h3`
7565
7821
 
7566
7822
  letter-spacing: -0.24px;
7567
7823
 
7568
- color: ${(props) => props.theme.colors.font.primary};
7824
+ color: ${(props) => props.theme.colors.text.primary};
7569
7825
 
7570
7826
  margin-top: 0;
7571
- margin-bottom: 0px;
7827
+ margin-bottom: 0;
7572
7828
  `;
7573
7829
  const H3 = (props) => {
7574
7830
  const [t2] = useI18n();
7575
7831
  return createComponent(H3Styled, {
7576
7832
  get children() {
7577
7833
  var _a;
7578
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7834
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7579
7835
  }
7580
7836
  });
7581
7837
  };
@@ -7591,7 +7847,7 @@ const TextStyled$3 = styled.div`
7591
7847
  const Text = (inputs) => {
7592
7848
  const theme = useTheme();
7593
7849
  const [t2] = useI18n();
7594
- const color = () => inputs.color || theme.colors.font.primary;
7850
+ const color = () => inputs.color || theme.colors.text.primary;
7595
7851
  const props = mergeProps({
7596
7852
  fontSize: "14px",
7597
7853
  fontWeight: "510",
@@ -7619,14 +7875,14 @@ const Text = (inputs) => {
7619
7875
  },
7620
7876
  get children() {
7621
7877
  var _a;
7622
- return memo(() => !!props.translationKey, true)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7878
+ return createMemo(() => !!props.translationKey)() ? t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString()) : props.children;
7623
7879
  }
7624
7880
  });
7625
7881
  };
7626
7882
  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>`);
7627
7883
  const TonIcon = (props) => {
7628
7884
  const theme = useTheme();
7629
- const fill = () => props.fill || theme.colors.font.primary;
7885
+ const fill = () => props.fill || theme.colors.icon.primary;
7630
7886
  return (() => {
7631
7887
  const _el$ = _tmpl$$c.cloneNode(true), _el$2 = _el$.firstChild;
7632
7888
  createRenderEffect(() => setAttribute(_el$2, "fill", fill()));
@@ -7635,7 +7891,8 @@ const TonIcon = (props) => {
7635
7891
  };
7636
7892
  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>`);
7637
7893
  const SuccessIcon = (props) => {
7638
- const fill = () => props.fill || "#29CC6A";
7894
+ const theme = useTheme();
7895
+ const fill = () => props.fill || theme.colors.icon.success;
7639
7896
  return (() => {
7640
7897
  const _el$ = _tmpl$$b.cloneNode(true), _el$2 = _el$.firstChild;
7641
7898
  createRenderEffect((_p$) => {
@@ -7653,7 +7910,7 @@ const SuccessIcon = (props) => {
7653
7910
  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>`);
7654
7911
  const ErrorIcon = (props) => {
7655
7912
  const theme = useTheme();
7656
- const fill = () => props.fill || theme.colors.font.third;
7913
+ const fill = () => props.fill || theme.colors.icon.secondary;
7657
7914
  return (() => {
7658
7915
  const _el$ = _tmpl$$a.cloneNode(true), _el$2 = _el$.firstChild;
7659
7916
  createRenderEffect((_p$) => {
@@ -7671,7 +7928,7 @@ const ErrorIcon = (props) => {
7671
7928
  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>`);
7672
7929
  const LoaderIcon = (props) => {
7673
7930
  const theme = useTheme();
7674
- const fill = () => props.fill || theme.colors.font.third;
7931
+ const fill = () => props.fill || theme.colors.icon.tertiary;
7675
7932
  const rotateAnimation = h`
7676
7933
  0% {
7677
7934
  transform: rotate(0deg);
@@ -7701,7 +7958,7 @@ const TonConnectUiContext = createContext();
7701
7958
  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>`);
7702
7959
  const CopyIcon = (props) => {
7703
7960
  const theme = useTheme();
7704
- const fill = () => props.fill || theme.colors.font.primary;
7961
+ const fill = () => props.fill || theme.colors.icon.primary;
7705
7962
  return (() => {
7706
7963
  const _el$ = _tmpl$$8.cloneNode(true), _el$2 = _el$.firstChild;
7707
7964
  createRenderEffect(() => setAttribute(_el$2, "fill", fill()));
@@ -7711,7 +7968,7 @@ const CopyIcon = (props) => {
7711
7968
  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>`);
7712
7969
  const DisconnectIcon = (props) => {
7713
7970
  const theme = useTheme();
7714
- const fill = () => props.fill || theme.colors.font.primary;
7971
+ const fill = () => props.fill || theme.colors.icon.primary;
7715
7972
  return (() => {
7716
7973
  const _el$ = _tmpl$$7.cloneNode(true), _el$2 = _el$.firstChild, _el$3 = _el$2.nextSibling;
7717
7974
  createRenderEffect((_p$) => {
@@ -7748,17 +8005,27 @@ function fallbackCopyTextToClipboard(text) {
7748
8005
  document.body.removeChild(textArea);
7749
8006
  }
7750
8007
  }
8008
+ const hoverBorders = {
8009
+ m: "8px",
8010
+ s: "4px",
8011
+ none: "0"
8012
+ };
8013
+ const dropdownBorders = {
8014
+ m: "16px",
8015
+ s: "8px",
8016
+ none: "0"
8017
+ };
7751
8018
  const AccountButtonDropdownStyled = styled.div`
7752
8019
  width: 256px;
7753
8020
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
7754
- border-radius: 16px;
8021
+ border-radius: ${(props) => dropdownBorders[props.theme.borderRadius]};
7755
8022
 
7756
- background-color: ${(props) => props.theme.colors.backgroundPrimary}
8023
+ background-color: ${(props) => props.theme.colors.background.primary}
7757
8024
 
7758
- color: ${(props) => props.theme.colors.font.primary}
8025
+ color: ${(props) => props.theme.colors.text.primary}
7759
8026
  `;
7760
8027
  const UlStyled$1 = styled.ul`
7761
- background-color: ${(props) => props.theme.colors.backgroundPrimary};
8028
+ background-color: ${(props) => props.theme.colors.background.primary};
7762
8029
  padding: 8px;
7763
8030
  `;
7764
8031
  const MenuButtonStyled = styled.button`
@@ -7768,15 +8035,15 @@ const MenuButtonStyled = styled.button`
7768
8035
  padding: 12px;
7769
8036
  width: 100%;
7770
8037
 
7771
- background-color: ${(props) => props.theme.colors.backgroundPrimary};
8038
+ background-color: ${(props) => props.theme.colors.background.primary};
7772
8039
  border: none;
7773
- border-radius: 8px;
8040
+ border-radius: ${(props) => hoverBorders[props.theme.borderRadius]};
7774
8041
  cursor: pointer;
7775
8042
 
7776
8043
  transition: background-color, transform 0.1s ease-in-out;
7777
8044
 
7778
8045
  &:hover {
7779
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
8046
+ background-color: ${(props) => props.theme.colors.background.secondary};
7780
8047
  }
7781
8048
 
7782
8049
  &:active {
@@ -7800,7 +8067,7 @@ const AccountButtonDropdown = (props) => {
7800
8067
  const connector = useContext(ConnectorContext);
7801
8068
  const [isCopiedShown, setIsCopiedShown] = createSignal(false);
7802
8069
  const onCopy = () => __async(void 0, null, function* () {
7803
- const userFriendlyAddress = toUserFriendlyAddress$1(tonConnectUi.account.address);
8070
+ const userFriendlyAddress = toUserFriendlyAddress$1(tonConnectUi.account.address, tonConnectUi.account.chain === CHAIN$1.TESTNET);
7804
8071
  yield copyToClipboard(userFriendlyAddress);
7805
8072
  setIsCopiedShown(true);
7806
8073
  setTimeout(() => setIsCopiedShown(false), 1e3);
@@ -7817,6 +8084,9 @@ const AccountButtonDropdown = (props) => {
7817
8084
  get ["class"]() {
7818
8085
  return props.class;
7819
8086
  },
8087
+ get id() {
8088
+ return props.id;
8089
+ },
7820
8090
  get children() {
7821
8091
  return createComponent(UlStyled$1, {
7822
8092
  get children() {
@@ -7867,19 +8137,24 @@ const AccountButtonDropdown = (props) => {
7867
8137
  }
7868
8138
  });
7869
8139
  };
8140
+ const borders$1 = {
8141
+ m: "16px",
8142
+ s: "8px",
8143
+ none: "0"
8144
+ };
7870
8145
  const NotificationStyled = styled.div`
7871
8146
  width: 256px;
7872
8147
  padding: 12px 16px;
7873
8148
  display: flex;
7874
8149
  gap: 9px;
7875
8150
 
7876
- background-color: ${(props) => props.theme.colors.backgroundPrimary};
8151
+ background-color: ${(props) => props.theme.colors.background.primary};
7877
8152
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.16);
7878
- border-radius: 16px;
8153
+ border-radius: ${(props) => borders$1[props.theme.borderRadius]};
7879
8154
  `;
7880
8155
  const TextStyled$2 = styled(Text)`
7881
8156
  margin-top: 4px;
7882
- color: ${(props) => props.theme.colors.font.secondary};
8157
+ color: ${(props) => props.theme.colors.text.secondary};
7883
8158
  `;
7884
8159
  const _tmpl$$5 = /* @__PURE__ */ template$1(`<div></div>`);
7885
8160
  const Notification = (props) => {
@@ -7917,7 +8192,7 @@ const Notification = (props) => {
7917
8192
  }
7918
8193
  }), null);
7919
8194
  return _el$;
7920
- })(), memo(() => props.icon)];
8195
+ })(), createMemo(() => props.icon)];
7921
8196
  }
7922
8197
  });
7923
8198
  };
@@ -7977,7 +8252,7 @@ const SuccessTransactionNotification = (props) => {
7977
8252
  return createComponent(SuccessIconStyled$1, {});
7978
8253
  },
7979
8254
  get ["class"]() {
7980
- return props.class;
8255
+ return cn(props.class, "tc-notification");
7981
8256
  },
7982
8257
  children: "Transaction sent"
7983
8258
  });
@@ -8068,25 +8343,40 @@ const Notifications = (props) => {
8068
8343
  });
8069
8344
  }
8070
8345
  }));
8071
- createRenderEffect(() => className(_el$, props.class));
8346
+ createRenderEffect((_p$) => {
8347
+ const _v$ = props.class, _v$2 = props.id;
8348
+ _v$ !== _p$._v$ && className(_el$, _p$._v$ = _v$);
8349
+ _v$2 !== _p$._v$2 && setAttribute(_el$, "id", _p$._v$2 = _v$2);
8350
+ return _p$;
8351
+ }, {
8352
+ _v$: void 0,
8353
+ _v$2: void 0
8354
+ });
8072
8355
  return _el$;
8073
8356
  })();
8074
8357
  };
8075
8358
  const AccountButtonStyled = styled(Button)`
8359
+ background-color: ${(props) => props.theme.colors.connectButton.background};
8360
+ color: ${(props) => props.theme.colors.connectButton.foreground};
8361
+ box-shadow: ${(props) => `0 4px 24px ${rgba(props.theme.colors.constant.black, 0.16)}`};
8362
+
8076
8363
  display: flex;
8077
8364
  align-items: center;
8078
8365
  gap: 9px;
8079
8366
 
8080
- transition: background-color 0.1s ease-in-out;
8367
+ transition: all 0.1s ease-in-out;
8081
8368
 
8082
8369
  &:hover:not(:active) {
8083
8370
  transform: scale(1);
8084
8371
  }
8085
8372
 
8086
8373
  &:hover {
8087
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
8374
+ filter: ${(props) => `brightness(${props.theme.theme === THEME.DARK ? 1.07 : 0.95})`};
8088
8375
  }
8089
8376
  `;
8377
+ const DropdownButtonStyled = styled(AccountButtonStyled)`
8378
+ background-color: ${(props) => props.theme.colors.background.primary};
8379
+ `;
8090
8380
  const DropdownContainerStyled = styled.div`
8091
8381
  display: flex;
8092
8382
  flex-direction: column;
@@ -8177,7 +8467,7 @@ const computePosition$1 = (reference, floating, config) => __async(void 0, null,
8177
8467
  } = config;
8178
8468
  const validMiddleware = middleware.filter(Boolean);
8179
8469
  const rtl = yield platform2.isRTL == null ? void 0 : platform2.isRTL(floating);
8180
- if (process.env.NODE_ENV !== "production") {
8470
+ if ({}.NODE_ENV !== "production") {
8181
8471
  if (platform2 == null) {
8182
8472
  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(" "));
8183
8473
  }
@@ -8234,7 +8524,7 @@ const computePosition$1 = (reference, floating, config) => __async(void 0, null,
8234
8524
  middlewareData = __spreadProps(__spreadValues({}, middlewareData), {
8235
8525
  [name]: __spreadValues(__spreadValues({}, middlewareData[name]), data)
8236
8526
  });
8237
- if (process.env.NODE_ENV !== "production") {
8527
+ if ({}.NODE_ENV !== "production") {
8238
8528
  if (resetCount > 50) {
8239
8529
  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(" "));
8240
8530
  }
@@ -8846,12 +9136,13 @@ function P(l2, u2, e2) {
8846
9136
  return n2().middlewareData;
8847
9137
  }, update: i2 };
8848
9138
  }
8849
- const _tmpl$$3 = /* @__PURE__ */ template$1(`<div></div>`);
9139
+ const _tmpl$$3 = /* @__PURE__ */ template$1(`<div id="tc-dropdown-container"></div>`);
8850
9140
  const AccountButton = () => {
9141
+ const theme = useTheme();
8851
9142
  const connector = useContext(ConnectorContext);
8852
9143
  const tonConnectUI2 = useContext(TonConnectUiContext);
8853
9144
  const [isOpened, setIsOpened] = createSignal(false);
8854
- const [address, setAddress] = createSignal("");
9145
+ const [account, setAccount] = createSignal(null);
8855
9146
  let dropDownRef;
8856
9147
  const [floating, setFloating] = createSignal();
8857
9148
  const [anchor, setAnchor] = createSignal();
@@ -8860,8 +9151,9 @@ const AccountButton = () => {
8860
9151
  placement: "bottom-end"
8861
9152
  });
8862
9153
  const normalizedAddress = () => {
8863
- if (address()) {
8864
- const userFriendlyAddress = toUserFriendlyAddress$1(address());
9154
+ const acc = account();
9155
+ if (acc) {
9156
+ const userFriendlyAddress = toUserFriendlyAddress$1(acc.address, acc.chain === CHAIN$1.TESTNET);
8865
9157
  return userFriendlyAddress.slice(0, 4) + "..." + userFriendlyAddress.slice(-4);
8866
9158
  }
8867
9159
  return "";
@@ -8869,13 +9161,13 @@ const AccountButton = () => {
8869
9161
  const unsubscribe = connector.onStatusChange((wallet) => {
8870
9162
  if (!wallet) {
8871
9163
  setIsOpened(false);
8872
- setAddress("");
9164
+ setAccount(null);
8873
9165
  return;
8874
9166
  }
8875
- setAddress(wallet.account.address);
9167
+ setAccount(wallet.account);
8876
9168
  });
8877
9169
  const onClick = (e2) => {
8878
- if (!address() || !isOpened()) {
9170
+ if (!account() || !isOpened()) {
8879
9171
  return;
8880
9172
  }
8881
9173
  const clickToButton = anchor().contains(e2.target);
@@ -8893,18 +9185,25 @@ const AccountButton = () => {
8893
9185
  });
8894
9186
  return [createComponent(Show, {
8895
9187
  get when() {
8896
- return !address();
9188
+ return !account();
8897
9189
  },
8898
9190
  get children() {
8899
9191
  return createComponent(AccountButtonStyled, {
8900
- appearance: "flat",
8901
9192
  onClick: () => tonConnectUI2.connectWallet(),
9193
+ id: "tc-connect-button",
8902
9194
  get children() {
8903
- return [createComponent(TonIcon, {}), createComponent(Text, {
9195
+ return [createComponent(TonIcon, {
9196
+ get fill() {
9197
+ return theme.colors.connectButton.foreground;
9198
+ }
9199
+ }), createComponent(Text, {
8904
9200
  translationKey: "button.connectWallet",
8905
9201
  fontSize: "15px",
8906
9202
  letterSpacing: "-0.24px",
8907
9203
  fontWeight: "590",
9204
+ get color() {
9205
+ return theme.colors.connectButton.foreground;
9206
+ },
8908
9207
  children: "Connect wallet"
8909
9208
  })];
8910
9209
  }
@@ -8912,15 +9211,15 @@ const AccountButton = () => {
8912
9211
  }
8913
9212
  }), createComponent(Show, {
8914
9213
  get when() {
8915
- return address();
9214
+ return account();
8916
9215
  },
8917
9216
  get children() {
8918
9217
  return createComponent(DropdownContainerStyled, {
8919
9218
  get children() {
8920
- return [createComponent(AccountButtonStyled, {
8921
- appearance: "flat",
9219
+ return [createComponent(DropdownButtonStyled, {
8922
9220
  onClick: () => setIsOpened((v) => !v),
8923
9221
  ref: setAnchor,
9222
+ id: "tc-dropdown-button",
8924
9223
  get children() {
8925
9224
  return [createComponent(Text, {
8926
9225
  fontSize: "15px",
@@ -8976,13 +9275,16 @@ const AccountButton = () => {
8976
9275
  ref(r$) {
8977
9276
  const _ref$ = dropDownRef;
8978
9277
  typeof _ref$ === "function" ? _ref$(r$) : dropDownRef = r$;
8979
- }
9278
+ },
9279
+ id: "tc-dropdown"
8980
9280
  });
8981
9281
  }
8982
9282
  });
8983
9283
  }
8984
9284
  }), null);
8985
- insert(_el$, createComponent(NotificationsStyled, {}), null);
9285
+ insert(_el$, createComponent(NotificationsStyled, {
9286
+ id: "tc-notifications"
9287
+ }), null);
8986
9288
  createRenderEffect((_p$) => {
8987
9289
  var _a, _b;
8988
9290
  const _v$ = position.strategy, _v$2 = `${(_a = position.y) != null ? _a : 0}px`, _v$3 = `${(_b = position.x) != null ? _b : 0}px`;
@@ -9013,6 +9315,11 @@ const QrCodeStyled = styled.div`
9013
9315
  display: flex;
9014
9316
  align-items: center;
9015
9317
  justify-content: center;
9318
+
9319
+ > svg {
9320
+ height: 276px;
9321
+ width: 276px;
9322
+ }
9016
9323
  }
9017
9324
 
9018
9325
  rect {
@@ -9020,14 +9327,14 @@ const QrCodeStyled = styled.div`
9020
9327
  }
9021
9328
 
9022
9329
  path {
9023
- fill: ${(props) => props.theme.colors.font.primary};
9330
+ fill: ${(props) => props.theme.colors.text.primary};
9024
9331
  }
9025
9332
  `;
9026
9333
  const ImageBackground = styled.div`
9027
9334
  position: absolute;
9028
9335
  width: 52px;
9029
9336
  height: 52px;
9030
- background: ${(props) => props.theme.colors.backgroundSecondary};
9337
+ background: ${(props) => props.theme.colors.background.secondary};
9031
9338
  padding: 7px;
9032
9339
  top: 112px;
9033
9340
  left: 112px;
@@ -10720,6 +11027,11 @@ const Translation = (props) => {
10720
11027
  const [t2] = useI18n();
10721
11028
  return t2(props.translationKey, props.translationValues, (_a = props.children) == null ? void 0 : _a.toString());
10722
11029
  };
11030
+ const borders = {
11031
+ m: "16px",
11032
+ s: "8px",
11033
+ none: "0"
11034
+ };
10723
11035
  const QrCodeModalStyled = styled.div`
10724
11036
  padding: 0 24px;
10725
11037
  `;
@@ -10730,8 +11042,8 @@ const StyledIconButton = styled(IconButton)`
10730
11042
  `;
10731
11043
  const QRBackgroundStyled = styled.div`
10732
11044
  margin-bottom: 16px;
10733
- background-color: ${(props) => props.theme.colors.backgroundSecondary};
10734
- border-radius: 16px;
11045
+ background-color: ${(props) => props.theme.colors.background.secondary};
11046
+ border-radius: ${(props) => borders[props.theme.borderRadius]};
10735
11047
  display: flex;
10736
11048
  align-items: center;
10737
11049
  justify-content: center;
@@ -10748,6 +11060,7 @@ const ActionButtonStyled = styled(Button)`
10748
11060
  line-height: 20px;
10749
11061
  letter-spacing: -0.32px;
10750
11062
  width: 100%;
11063
+ border-radius: ${(props) => borders[props.theme.borderRadius]};
10751
11064
  `;
10752
11065
  const GetWalletStyled = styled.div`
10753
11066
  display: flex;
@@ -10755,7 +11068,7 @@ const GetWalletStyled = styled.div`
10755
11068
  align-items: center;
10756
11069
  `;
10757
11070
  const TextStyled$1 = styled(Text)`
10758
- color: ${(props) => props.theme.colors.font.secondary};
11071
+ color: ${(props) => props.theme.colors.text.secondary};
10759
11072
  font-size: 16px;
10760
11073
  `;
10761
11074
  function openLink(href, target = "_self") {
@@ -10780,8 +11093,11 @@ const QrCodeModal = (props) => {
10780
11093
  const universalLink = connector.connect({
10781
11094
  universalLink: props.wallet.universalLink,
10782
11095
  bridgeUrl: props.wallet.bridgeUrl
10783
- });
11096
+ }, props.additionalRequest);
10784
11097
  return createComponent(QrCodeModalStyled, {
11098
+ get id() {
11099
+ return props.id;
11100
+ },
10785
11101
  get children() {
10786
11102
  return [createComponent(StyledIconButton, {
10787
11103
  icon: "arrow",
@@ -10794,7 +11110,7 @@ const QrCodeModal = (props) => {
10794
11110
  };
10795
11111
  },
10796
11112
  get children() {
10797
- return ["Connect with ", memo(() => props.wallet.name)];
11113
+ return ["Connect with ", createMemo(() => props.wallet.name)];
10798
11114
  }
10799
11115
  }), createComponent(H2, {
10800
11116
  translationKey: "walletModal.qrCodeModal.scan",
@@ -10804,7 +11120,7 @@ const QrCodeModal = (props) => {
10804
11120
  };
10805
11121
  },
10806
11122
  get children() {
10807
- return ["Scan QR code with your phone’s or ", memo(() => props.wallet.name), "’s camera."];
11123
+ return ["Scan QR code with your phone’s or ", createMemo(() => props.wallet.name), "’s camera."];
10808
11124
  }
10809
11125
  }), createComponent(QRBackgroundStyled, {
10810
11126
  get children() {
@@ -10818,7 +11134,6 @@ const QrCodeModal = (props) => {
10818
11134
  }), createComponent(ButtonsContainerStyled, {
10819
11135
  get children() {
10820
11136
  return [createComponent(ActionButtonStyled, {
10821
- appearance: "secondary",
10822
11137
  onClick: () => openLink(universalLink),
10823
11138
  get children() {
10824
11139
  return createComponent(Translation, {
@@ -10829,7 +11144,7 @@ const QrCodeModal = (props) => {
10829
11144
  };
10830
11145
  },
10831
11146
  get children() {
10832
- return ["Open ", memo(() => props.wallet.name)];
11147
+ return ["Open ", createMemo(() => props.wallet.name)];
10833
11148
  }
10834
11149
  });
10835
11150
  }
@@ -10839,10 +11154,9 @@ const QrCodeModal = (props) => {
10839
11154
  },
10840
11155
  get children() {
10841
11156
  return createComponent(ActionButtonStyled, {
10842
- appearance: "secondary",
10843
11157
  onClick: () => connector.connect({
10844
11158
  jsBridgeKey: props.wallet.jsBridgeKey
10845
- }),
11159
+ }, props.additionalRequest),
10846
11160
  get children() {
10847
11161
  return createComponent(Translation, {
10848
11162
  translationKey: "walletModal.qrCodeModal.openExtension",
@@ -10863,10 +11177,9 @@ const QrCodeModal = (props) => {
10863
11177
  };
10864
11178
  },
10865
11179
  get children() {
10866
- return ["Don't have ", memo(() => props.wallet.name), "?"];
11180
+ return ["Don't have ", createMemo(() => props.wallet.name), "?"];
10867
11181
  }
10868
11182
  }), createComponent(Button, {
10869
- appearance: "secondary",
10870
11183
  onClick: () => openLinkBlank(props.wallet.aboutUrl),
10871
11184
  get children() {
10872
11185
  return createComponent(Translation, {
@@ -10984,6 +11297,9 @@ const _tmpl$ = /* @__PURE__ */ template$1(`<li></li>`);
10984
11297
  const SelectWalletModal = (props) => {
10985
11298
  const learnMoreUrl = "https://ton.org/wallets";
10986
11299
  return createComponent(SelectWalletModalStyled, {
11300
+ get id() {
11301
+ return props.id;
11302
+ },
10987
11303
  get children() {
10988
11304
  return [createComponent(H1, {
10989
11305
  translationKey: "walletModal.selectWalletModal.connectWallet",
@@ -11013,7 +11329,6 @@ const SelectWalletModal = (props) => {
11013
11329
  });
11014
11330
  }
11015
11331
  }), createComponent(ButtonStyled$1, {
11016
- appearance: "secondary",
11017
11332
  onClick: () => openLinkBlank(learnMoreUrl),
11018
11333
  get children() {
11019
11334
  return createComponent(Translation, {
@@ -11025,12 +11340,6 @@ const SelectWalletModal = (props) => {
11025
11340
  }
11026
11341
  });
11027
11342
  };
11028
- const ModalWrapper = styled.div`
11029
- color: ${(props) => {
11030
- var _a;
11031
- return ((_a = props.theme) == null ? void 0 : _a.accentColor) || "blue";
11032
- }};
11033
- `;
11034
11343
  const StyledModal = styled(Modal)`
11035
11344
  padding-left: 0;
11036
11345
  padding-right: 0;
@@ -11064,21 +11373,8 @@ const LoaderContainerStyled = styled.div`
11064
11373
  const [appState, setAppState] = createStore({
11065
11374
  buttonRootId: null,
11066
11375
  language: "en",
11067
- buttonConfiguration: {},
11068
- widgetConfiguration: {}
11376
+ walletsList: {}
11069
11377
  });
11070
- class TonConnectUIError extends TonConnectError$1 {
11071
- constructor(...args) {
11072
- super(...args);
11073
- Object.setPrototypeOf(this, TonConnectUIError.prototype);
11074
- }
11075
- }
11076
- class WalletNotFoundError extends TonConnectUIError {
11077
- constructor(...args) {
11078
- super(...args);
11079
- Object.setPrototypeOf(this, WalletNotFoundError.prototype);
11080
- }
11081
- }
11082
11378
  function uiWalletToWalletInfo(uiWallet) {
11083
11379
  if ("jsBridgeKey" in uiWallet) {
11084
11380
  return __spreadProps(__spreadValues({}, uiWallet), {
@@ -11098,14 +11394,15 @@ function applyWalletsListConfiguration(walletsList, configuration) {
11098
11394
  if (typeof wallet === "string") {
11099
11395
  const walletInfo = walletsList.find((item) => item.name === wallet);
11100
11396
  if (!walletInfo) {
11101
- throw new WalletNotFoundError(
11102
- `Wallet with name === '${wallet}' wasn't found in the wallets list. Check ${wallet} correctness.`
11397
+ console.error(
11398
+ `Wallet with name === '${wallet}' wasn't found in the wallets list. Check '${wallet}' correctness. Available wallets names: ${walletsList.map((i2) => "'" + i2.name + "'").join(", ")}`
11103
11399
  );
11400
+ return null;
11104
11401
  }
11105
11402
  return walletInfo;
11106
11403
  }
11107
11404
  return uiWalletToWalletInfo(wallet);
11108
- });
11405
+ }).filter((i2) => !!i2);
11109
11406
  }
11110
11407
  const filteredWalletsList = ((_a = configuration.excludeWallets) == null ? void 0 : _a.length) ? walletsList.filter(
11111
11408
  (wallet) => {
@@ -11129,12 +11426,35 @@ const WalletsModal = () => {
11129
11426
  const connector = useContext(ConnectorContext);
11130
11427
  const tonConnectUI2 = useContext(TonConnectUiContext);
11131
11428
  const [fetchedWalletsList] = createResource(() => tonConnectUI2.getWallets());
11429
+ const [fetchedAdditionalRequest, {
11430
+ refetch
11431
+ }] = createResource((_, {
11432
+ refetching
11433
+ }) => {
11434
+ var _a;
11435
+ if (refetching) {
11436
+ return (_a = appState.getConnectParameters) == null ? void 0 : _a.call(appState);
11437
+ }
11438
+ return void 0;
11439
+ });
11440
+ createEffect(on(walletsModalOpen, () => {
11441
+ if (walletsModalOpen() && fetchedAdditionalRequest.state !== "refreshing") {
11442
+ refetch();
11443
+ }
11444
+ }));
11132
11445
  const [selectedWalletInfo, setSelectedWalletInfo] = createSignal(null);
11133
11446
  const walletsList = createMemo(() => {
11134
11447
  if (fetchedWalletsList.state !== "ready") {
11135
11448
  return null;
11136
11449
  }
11137
- return applyWalletsListConfiguration(fetchedWalletsList(), appState.widgetConfiguration.wallets);
11450
+ return applyWalletsListConfiguration(fetchedWalletsList(), appState.walletsList);
11451
+ });
11452
+ const additionalRequestLoading = () => fetchedAdditionalRequest.state !== "ready" && fetchedAdditionalRequest.state !== "errored";
11453
+ const additionalRequest = createMemo(() => {
11454
+ if (fetchedAdditionalRequest.state !== "ready") {
11455
+ return void 0;
11456
+ }
11457
+ return fetchedAdditionalRequest();
11138
11458
  });
11139
11459
  const onClose = () => {
11140
11460
  setWalletsModalOpen(false);
@@ -11158,13 +11478,13 @@ const WalletsModal = () => {
11158
11478
  const universalLink = connector.connect({
11159
11479
  universalLink: walletInfo.universalLink,
11160
11480
  bridgeUrl: walletInfo.bridgeUrl
11161
- });
11481
+ }, additionalRequest());
11162
11482
  openLink(universalLink);
11163
11483
  };
11164
11484
  const onSelectIfInjected = (walletInfo) => {
11165
11485
  connector.connect({
11166
11486
  jsBridgeKey: walletInfo.jsBridgeKey
11167
- });
11487
+ }, additionalRequest());
11168
11488
  };
11169
11489
  const unsubscribe = connector.onStatusChange((wallet) => {
11170
11490
  if (wallet) {
@@ -11172,66 +11492,66 @@ const WalletsModal = () => {
11172
11492
  }
11173
11493
  });
11174
11494
  onCleanup(unsubscribe);
11175
- return createComponent(ModalWrapper, {
11495
+ return createComponent(StyledModal, {
11496
+ get opened() {
11497
+ return walletsModalOpen();
11498
+ },
11499
+ onClose,
11500
+ id: "tc-wallets-modal-container",
11176
11501
  get children() {
11177
- return createComponent(StyledModal, {
11178
- get opened() {
11179
- return walletsModalOpen();
11502
+ return [createComponent(Show, {
11503
+ get when() {
11504
+ return !walletsList() || additionalRequestLoading();
11505
+ },
11506
+ get children() {
11507
+ return [createComponent(H1Styled$1, {
11508
+ translationKey: "walletModal.loading",
11509
+ children: "Wallets list is loading"
11510
+ }), createComponent(LoaderContainerStyled, {
11511
+ get children() {
11512
+ return createComponent(LoaderIconStyled$1, {});
11513
+ }
11514
+ })];
11515
+ }
11516
+ }), createComponent(Show, {
11517
+ get when() {
11518
+ return createMemo(() => !!walletsList())() && !additionalRequestLoading();
11180
11519
  },
11181
- onClose,
11182
11520
  get children() {
11183
11521
  return [createComponent(Show, {
11184
11522
  get when() {
11185
- return !walletsList();
11523
+ return !selectedWalletInfo();
11186
11524
  },
11525
+ keyed: false,
11187
11526
  get children() {
11188
- return [createComponent(H1Styled$1, {
11189
- translationKey: "walletModal.loading",
11190
- children: "Wallets list is loading"
11191
- }), createComponent(LoaderContainerStyled, {
11192
- get children() {
11193
- return createComponent(LoaderIconStyled$1, {
11194
- fill: "#7A899970"
11195
- });
11196
- }
11197
- })];
11527
+ return createComponent(SelectWalletModal, {
11528
+ get walletsList() {
11529
+ return walletsList();
11530
+ },
11531
+ onSelect,
11532
+ id: "tc-wallets-modal"
11533
+ });
11198
11534
  }
11199
11535
  }), createComponent(Show, {
11200
11536
  get when() {
11201
- return walletsList();
11537
+ return selectedWalletInfo();
11202
11538
  },
11539
+ keyed: false,
11203
11540
  get children() {
11204
- return [createComponent(Show, {
11205
- get when() {
11206
- return !selectedWalletInfo();
11541
+ return createComponent(QrCodeModal, {
11542
+ get additionalRequest() {
11543
+ return additionalRequest();
11207
11544
  },
11208
- keyed: false,
11209
- get children() {
11210
- return createComponent(SelectWalletModal, {
11211
- get walletsList() {
11212
- return walletsList();
11213
- },
11214
- onSelect
11215
- });
11216
- }
11217
- }), createComponent(Show, {
11218
- get when() {
11545
+ get wallet() {
11219
11546
  return selectedWalletInfo();
11220
11547
  },
11221
- keyed: false,
11222
- get children() {
11223
- return createComponent(QrCodeModal, {
11224
- get wallet() {
11225
- return selectedWalletInfo();
11226
- },
11227
- onBackClick: () => setSelectedWalletInfo(null)
11228
- });
11229
- }
11230
- })];
11548
+ onBackClick: () => setSelectedWalletInfo(null),
11549
+ id: "tc-qr-modal"
11550
+ });
11231
11551
  }
11232
11552
  })];
11233
11553
  }
11234
- });
11554
+ })];
11235
11555
  }
11236
11556
  });
11237
11557
  };
@@ -11252,15 +11572,18 @@ const TextStyled = styled(Text)`
11252
11572
  text-align: center;
11253
11573
  max-width: 250px;
11254
11574
 
11255
- color: ${(props) => props.theme.colors.font.secondary};
11575
+ color: ${(props) => props.theme.colors.text.secondary};
11256
11576
  `;
11257
11577
  const ButtonStyled = styled(Button)`
11258
11578
  margin-top: 32px;
11259
11579
  `;
11260
11580
  const ActionModal = (props) => {
11261
11581
  return createComponent(ActionModalStyled, {
11582
+ get id() {
11583
+ return props.id;
11584
+ },
11262
11585
  get children() {
11263
- return [memo(() => props.icon), createComponent(H1Styled, {
11586
+ return [createMemo(() => props.icon), createComponent(H1Styled, {
11264
11587
  get translationKey() {
11265
11588
  return props.headerTranslationKey;
11266
11589
  }
@@ -11274,7 +11597,6 @@ const ActionModal = (props) => {
11274
11597
  },
11275
11598
  get children() {
11276
11599
  return createComponent(ButtonStyled, {
11277
- appearance: "secondary",
11278
11600
  onClick: () => props.onClose(),
11279
11601
  get children() {
11280
11602
  return createComponent(Translation, {
@@ -11297,12 +11619,13 @@ const ConfirmTransactionModal = (props) => {
11297
11619
  headerTranslationKey: "actionModal.confirmTransaction.header",
11298
11620
  textTranslationKey: "actionModal.confirmTransaction.text",
11299
11621
  get icon() {
11300
- return createComponent(LoaderIconStyled, {
11301
- fill: "#7A899970"
11302
- });
11622
+ return createComponent(LoaderIconStyled, {});
11303
11623
  },
11304
11624
  onClose: () => props.onClose(),
11305
- showButton: false
11625
+ showButton: false,
11626
+ get id() {
11627
+ return props.id;
11628
+ }
11306
11629
  });
11307
11630
  };
11308
11631
  const ErrorIconStyled = styled(ErrorIcon)`
@@ -11316,7 +11639,10 @@ const TransactionCanceledModal = (props) => {
11316
11639
  get icon() {
11317
11640
  return createComponent(ErrorIconStyled, {});
11318
11641
  },
11319
- onClose: () => props.onClose()
11642
+ onClose: () => props.onClose(),
11643
+ get id() {
11644
+ return props.id;
11645
+ }
11320
11646
  });
11321
11647
  };
11322
11648
  const SuccessIconStyled = styled(SuccessIcon)`
@@ -11330,16 +11656,20 @@ const TransactionSentModal = (props) => {
11330
11656
  get icon() {
11331
11657
  return createComponent(SuccessIconStyled, {});
11332
11658
  },
11333
- onClose: () => props.onClose()
11659
+ onClose: () => props.onClose(),
11660
+ get id() {
11661
+ return props.id;
11662
+ }
11334
11663
  });
11335
11664
  };
11336
11665
  const ActionsModal = () => {
11337
11666
  return createComponent(Modal, {
11338
11667
  get opened() {
11339
11668
  var _a;
11340
- return memo(() => action() !== null, true)() && ((_a = action()) == null ? void 0 : _a.openModal) === true;
11669
+ return createMemo(() => action() !== null)() && ((_a = action()) == null ? void 0 : _a.openModal) === true;
11341
11670
  },
11342
11671
  onClose: () => setAction(null),
11672
+ id: "tc-actions-modal-container",
11343
11673
  get children() {
11344
11674
  return createComponent(Switch, {
11345
11675
  get children() {
@@ -11349,7 +11679,8 @@ const ActionsModal = () => {
11349
11679
  },
11350
11680
  get children() {
11351
11681
  return createComponent(TransactionSentModal, {
11352
- onClose: () => setAction(null)
11682
+ onClose: () => setAction(null),
11683
+ id: "tc-transaction-sent-modal"
11353
11684
  });
11354
11685
  }
11355
11686
  }), createComponent(Match, {
@@ -11358,7 +11689,8 @@ const ActionsModal = () => {
11358
11689
  },
11359
11690
  get children() {
11360
11691
  return createComponent(TransactionCanceledModal, {
11361
- onClose: () => setAction(null)
11692
+ onClose: () => setAction(null),
11693
+ id: "tc-transaction-canceled-modal"
11362
11694
  });
11363
11695
  }
11364
11696
  }), createComponent(Match, {
@@ -11367,7 +11699,8 @@ const ActionsModal = () => {
11367
11699
  },
11368
11700
  get children() {
11369
11701
  return createComponent(ConfirmTransactionModal, {
11370
- onClose: () => setAction(null)
11702
+ onClose: () => setAction(null),
11703
+ id: "tc-confirm-modal"
11371
11704
  });
11372
11705
  }
11373
11706
  })];
@@ -11428,6 +11761,12 @@ const widgetController = {
11428
11761
  tonConnectUI: tonConnectUI2
11429
11762
  }), document.getElementById(root))
11430
11763
  };
11764
+ class TonConnectUIError extends TonConnectError$1 {
11765
+ constructor(...args) {
11766
+ super(...args);
11767
+ Object.setPrototypeOf(this, TonConnectUIError.prototype);
11768
+ }
11769
+ }
11431
11770
  class WalletInfoStorage {
11432
11771
  constructor() {
11433
11772
  __publicField(this, "localStorage");
@@ -11453,142 +11792,13 @@ class WalletInfoStorage {
11453
11792
  this.localStorage.removeItem(this.storageKey);
11454
11793
  }
11455
11794
  }
11456
- var isMergeableObject = function isMergeableObject2(value) {
11457
- return isNonNullObject(value) && !isSpecial(value);
11458
- };
11459
- function isNonNullObject(value) {
11460
- return !!value && typeof value === "object";
11461
- }
11462
- function isSpecial(value) {
11463
- var stringValue = Object.prototype.toString.call(value);
11464
- return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
11465
- }
11466
- var canUseSymbol = typeof Symbol === "function" && Symbol.for;
11467
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
11468
- function isReactElement(value) {
11469
- return value.$$typeof === REACT_ELEMENT_TYPE;
11470
- }
11471
- function emptyTarget(val) {
11472
- return Array.isArray(val) ? [] : {};
11473
- }
11474
- function cloneUnlessOtherwiseSpecified(value, options) {
11475
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
11476
- }
11477
- function defaultArrayMerge(target, source, options) {
11478
- return target.concat(source).map(function(element) {
11479
- return cloneUnlessOtherwiseSpecified(element, options);
11480
- });
11481
- }
11482
- function getMergeFunction(key, options) {
11483
- if (!options.customMerge) {
11484
- return deepmerge;
11485
- }
11486
- var customMerge = options.customMerge(key);
11487
- return typeof customMerge === "function" ? customMerge : deepmerge;
11488
- }
11489
- function getEnumerableOwnPropertySymbols(target) {
11490
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
11491
- return target.propertyIsEnumerable(symbol);
11492
- }) : [];
11493
- }
11494
- function getKeys(target) {
11495
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
11496
- }
11497
- function propertyIsOnObject(object, property) {
11498
- try {
11499
- return property in object;
11500
- } catch (_) {
11501
- return false;
11502
- }
11503
- }
11504
- function propertyIsUnsafe(target, key) {
11505
- return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
11506
- }
11507
- function mergeObject(target, source, options) {
11508
- var destination = {};
11509
- if (options.isMergeableObject(target)) {
11510
- getKeys(target).forEach(function(key) {
11511
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
11512
- });
11513
- }
11514
- getKeys(source).forEach(function(key) {
11515
- if (propertyIsUnsafe(target, key)) {
11516
- return;
11517
- }
11518
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
11519
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
11520
- } else {
11521
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
11522
- }
11523
- });
11524
- return destination;
11525
- }
11526
- function deepmerge(target, source, options) {
11527
- options = options || {};
11528
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
11529
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
11530
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
11531
- var sourceIsArray = Array.isArray(source);
11532
- var targetIsArray = Array.isArray(target);
11533
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
11534
- if (!sourceAndTargetTypesMatch) {
11535
- return cloneUnlessOtherwiseSpecified(source, options);
11536
- } else if (sourceIsArray) {
11537
- return options.arrayMerge(target, source, options);
11538
- } else {
11539
- return mergeObject(target, source, options);
11540
- }
11541
- }
11542
- deepmerge.all = function deepmergeAll(array, options) {
11543
- if (!Array.isArray(array)) {
11544
- throw new Error("first argument should be an array");
11545
- }
11546
- return array.reduce(function(prev, next) {
11547
- return deepmerge(prev, next, options);
11548
- }, {});
11549
- };
11550
- var deepmerge_1 = deepmerge;
11551
- var cjs = deepmerge_1;
11552
- /*!
11553
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
11554
- *
11555
- * Copyright (c) 2014-2017, Jon Schlinkert.
11556
- * Released under the MIT License.
11557
- */
11558
- function isObject(o2) {
11559
- return Object.prototype.toString.call(o2) === "[object Object]";
11560
- }
11561
- function isPlainObject(o2) {
11562
- var ctor, prot;
11563
- if (isObject(o2) === false)
11564
- return false;
11565
- ctor = o2.constructor;
11566
- if (ctor === void 0)
11567
- return true;
11568
- prot = ctor.prototype;
11569
- if (isObject(prot) === false)
11570
- return false;
11571
- if (prot.hasOwnProperty("isPrototypeOf") === false) {
11572
- return false;
11573
- }
11574
- return true;
11575
- }
11576
- function mergeOptions(options, defaultOptions) {
11577
- if (!options) {
11578
- return defaultOptions;
11579
- }
11580
- const overwriteMerge = (_, sourceArray, __) => sourceArray;
11581
- return cjs(defaultOptions, options, {
11582
- arrayMerge: overwriteMerge,
11583
- isMergeableObject: isPlainObject
11584
- });
11585
- }
11586
11795
  class TonConnectUI {
11587
11796
  constructor(options) {
11588
11797
  __publicField(this, "walletInfoStorage", new WalletInfoStorage());
11589
11798
  __publicField(this, "connector");
11590
11799
  __publicField(this, "_walletInfo", null);
11591
11800
  __publicField(this, "systemThemeChangeUnsubscribe", null);
11801
+ __publicField(this, "actionsConfiguration");
11592
11802
  if (options && "connector" in options && options.connector) {
11593
11803
  this.connector = options.connector;
11594
11804
  } else if (options && "manifestUrl" in options && options.manifestUrl) {
@@ -11611,8 +11821,11 @@ class TonConnectUI {
11611
11821
  }
11612
11822
  });
11613
11823
  }
11614
- this.uiOptions = options || {};
11615
- setAppState({ connector: this.connector });
11824
+ this.uiOptions = mergeOptions(options, { uiPreferences: { theme: "SYSTEM" } });
11825
+ setAppState({
11826
+ connector: this.connector,
11827
+ getConnectParameters: options == null ? void 0 : options.getConnectParameters
11828
+ });
11616
11829
  widgetController.renderApp(rootId, this);
11617
11830
  }
11618
11831
  static getWallets() {
@@ -11631,28 +11844,30 @@ class TonConnectUI {
11631
11844
  return this._walletInfo;
11632
11845
  }
11633
11846
  set uiOptions(options) {
11634
- var _a;
11847
+ var _a, _b, _c, _d, _e;
11635
11848
  this.checkButtonRootExist(options.buttonRootId);
11636
- if (options.theme === "SYSTEM") {
11637
- setTheme(getSystemTheme());
11638
- if (!this.systemThemeChangeUnsubscribe) {
11639
- this.systemThemeChangeUnsubscribe = subscribeToThemeChange(
11640
- (theme) => setTheme(theme)
11641
- );
11849
+ this.actionsConfiguration = options.actionsConfiguration;
11850
+ if ((_a = options.uiPreferences) == null ? void 0 : _a.theme) {
11851
+ if (((_b = options.uiPreferences) == null ? void 0 : _b.theme) !== "SYSTEM") {
11852
+ (_c = this.systemThemeChangeUnsubscribe) == null ? void 0 : _c.call(this);
11853
+ setTheme(options.uiPreferences.theme, options.uiPreferences.colorsSet);
11854
+ } else {
11855
+ setTheme(getSystemTheme(), options.uiPreferences.colorsSet);
11856
+ if (!this.systemThemeChangeUnsubscribe) {
11857
+ this.systemThemeChangeUnsubscribe = subscribeToThemeChange(setTheme);
11858
+ }
11642
11859
  }
11643
11860
  } else {
11644
- if (options.theme) {
11645
- (_a = this.systemThemeChangeUnsubscribe) == null ? void 0 : _a.call(this);
11646
- setTheme(options.theme);
11861
+ if ((_d = options.uiPreferences) == null ? void 0 : _d.colorsSet) {
11862
+ setColors(options.uiPreferences.colorsSet);
11647
11863
  }
11648
11864
  }
11865
+ if ((_e = options.uiPreferences) == null ? void 0 : _e.borderRadius) {
11866
+ setBorderRadius(options.uiPreferences.borderRadius);
11867
+ }
11649
11868
  setAppState((state) => {
11650
11869
  const merged = mergeOptions(
11651
- __spreadValues(__spreadValues(__spreadValues({}, options.language && { language: options.language }), options.buttonConfiguration && {
11652
- buttonConfiguration: options.buttonConfiguration
11653
- }), options.widgetConfiguration && {
11654
- widgetConfiguration: options.widgetConfiguration
11655
- }),
11870
+ __spreadValues(__spreadValues({}, options.language && { language: options.language }), !!options.walletsList && { walletsList: options.walletsList }),
11656
11871
  unwrap(state)
11657
11872
  );
11658
11873
  if (options.buttonRootId !== void 0) {
@@ -11713,25 +11928,24 @@ class TonConnectUI {
11713
11928
  if (!isDevice("desktop") && "universalLink" in this.walletInfo) {
11714
11929
  openLink(this.walletInfo.universalLink);
11715
11930
  }
11716
- const notification = (options == null ? void 0 : options.notifications) || ["before", "success", "error"];
11717
- const modals = (options == null ? void 0 : options.modals) || ["before"];
11931
+ const { notifications: notifications2, modals } = this.getModalsAndNotificationsConfiguration(options);
11718
11932
  widgetController.setAction({
11719
11933
  name: "confirm-transaction",
11720
- showNotification: notification.includes("before"),
11934
+ showNotification: notifications2.includes("before"),
11721
11935
  openModal: modals.includes("before")
11722
11936
  });
11723
11937
  try {
11724
11938
  const result = yield this.connector.sendTransaction(tx);
11725
11939
  widgetController.setAction({
11726
11940
  name: "transaction-sent",
11727
- showNotification: notification.includes("success"),
11941
+ showNotification: notifications2.includes("success"),
11728
11942
  openModal: modals.includes("success")
11729
11943
  });
11730
11944
  return result;
11731
11945
  } catch (e2) {
11732
11946
  widgetController.setAction({
11733
11947
  name: "transaction-canceled",
11734
- showNotification: notification.includes("error"),
11948
+ showNotification: notifications2.includes("error"),
11735
11949
  openModal: modals.includes("error")
11736
11950
  });
11737
11951
  if (e2 instanceof TonConnectError$1) {
@@ -11740,8 +11954,6 @@ class TonConnectUI {
11740
11954
  console.error(e2);
11741
11955
  throw new TonConnectUIError("Unhandled error:" + e2);
11742
11956
  }
11743
- } finally {
11744
- widgetController.clearAction();
11745
11957
  }
11746
11958
  });
11747
11959
  }
@@ -11780,6 +11992,44 @@ class TonConnectUI {
11780
11992
  throw new TonConnectUIError(`${buttonRootId2} element not found in the document.`);
11781
11993
  }
11782
11994
  }
11995
+ getModalsAndNotificationsConfiguration(options) {
11996
+ var _a, _b, _c;
11997
+ const allActions = [
11998
+ "before",
11999
+ "success",
12000
+ "error"
12001
+ ];
12002
+ let notifications2 = allActions;
12003
+ if (((_a = this.actionsConfiguration) == null ? void 0 : _a.notifications) && ((_b = this.actionsConfiguration) == null ? void 0 : _b.notifications) !== "all") {
12004
+ notifications2 = this.actionsConfiguration.notifications;
12005
+ }
12006
+ if (options == null ? void 0 : options.notifications) {
12007
+ if (options.notifications === "all") {
12008
+ notifications2 = allActions;
12009
+ } else {
12010
+ notifications2 = options.notifications;
12011
+ }
12012
+ }
12013
+ let modals = ["before"];
12014
+ if ((_c = this.actionsConfiguration) == null ? void 0 : _c.modals) {
12015
+ if (this.actionsConfiguration.modals === "all") {
12016
+ modals = allActions;
12017
+ } else {
12018
+ modals = this.actionsConfiguration.modals;
12019
+ }
12020
+ }
12021
+ if (options == null ? void 0 : options.modals) {
12022
+ if (options.modals === "all") {
12023
+ modals = allActions;
12024
+ } else {
12025
+ modals = options.modals;
12026
+ }
12027
+ }
12028
+ return {
12029
+ notifications: notifications2,
12030
+ modals
12031
+ };
12032
+ }
11783
12033
  }
11784
12034
  const TonConnectUIContext = createContext$1(null);
11785
12035
  let tonConnectUI = null;
@@ -11794,7 +12044,7 @@ const TonConnectUIProvider = (_a) => {
11794
12044
  }
11795
12045
  return /* @__PURE__ */ jsx(TonConnectUIContext.Provider, { value: tonConnectUI, children: children2 });
11796
12046
  };
11797
- const TonConnectUIProvider$1 = memo$1(TonConnectUIProvider);
12047
+ const TonConnectUIProvider$1 = memo(TonConnectUIProvider);
11798
12048
  class TonConnectUIReactError extends TonConnectUIError {
11799
12049
  constructor(...args) {
11800
12050
  super(...args);
@@ -11829,7 +12079,7 @@ const TonConnectButton = ({ className: className2, style: style2 }) => {
11829
12079
  }, []);
11830
12080
  return /* @__PURE__ */ jsx("div", { id: buttonRootId, className: className2, style: style2 });
11831
12081
  };
11832
- const TonConnectButton$1 = memo$1(TonConnectButton);
12082
+ const TonConnectButton$1 = memo(TonConnectButton);
11833
12083
  function useTonWallet() {
11834
12084
  const [tonConnectUI2] = useTonConnectUI();
11835
12085
  const [wallet, setWallet] = useState(
@@ -14612,11 +14862,16 @@ globalThis && globalThis.__rest || function(s2, e2) {
14612
14862
  }
14613
14863
  return t2;
14614
14864
  };
14615
- function toUserFriendlyAddress(hexAddress) {
14865
+ const bounceableTag = 17;
14866
+ const testOnlyTag = 128;
14867
+ function toUserFriendlyAddress(hexAddress, testOnly = false) {
14616
14868
  const { wc, hex } = parseHexAddress(hexAddress);
14617
- const bounceableTag = 17;
14869
+ let tag = bounceableTag;
14870
+ if (testOnly) {
14871
+ tag |= testOnlyTag;
14872
+ }
14618
14873
  const addr = new Int8Array(34);
14619
- addr[0] = bounceableTag;
14874
+ addr[0] = tag;
14620
14875
  addr[1] = wc;
14621
14876
  addr.set(hex, 2);
14622
14877
  const addressWithChecksum = new Uint8Array(36);
@@ -14696,7 +14951,7 @@ function hexToBytes(hex) {
14696
14951
  function useTonAddress(userFriendly = true) {
14697
14952
  const wallet = useTonWallet();
14698
14953
  if (wallet) {
14699
- return userFriendly ? toUserFriendlyAddress(wallet.account.address) : wallet.account.address;
14954
+ return userFriendly ? toUserFriendlyAddress(wallet.account.address, wallet.account.chain === CHAIN.TESTNET) : wallet.account.address;
14700
14955
  } else {
14701
14956
  return "";
14702
14957
  }
@@ -14706,6 +14961,7 @@ export {
14706
14961
  TonConnectButton$1 as TonConnectButton,
14707
14962
  TonConnectProviderNotSetError,
14708
14963
  TonConnectUI,
14964
+ TonConnectUIContext,
14709
14965
  TonConnectUIError,
14710
14966
  TonConnectUIProvider$1 as TonConnectUIProvider,
14711
14967
  TonConnectUIReactError,