@0xsquid/ui 0.15.0 → 0.15.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
- import { useMemo, useState, useEffect, useCallback, useRef } from 'react';
3
+ import { useMemo, useRef, useState, useEffect, useCallback } from 'react';
4
4
 
5
5
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
6
6
 
@@ -2531,24 +2531,6 @@ const twMerge = /*#__PURE__*/createTailwindMerge(getDefaultConfig);
2531
2531
  const cn = (...inputs) => {
2532
2532
  return twMerge(clsx(inputs));
2533
2533
  };
2534
- function debounce(func, delay) {
2535
- let timeoutId;
2536
- const debounced = function (...args) {
2537
- // @ts-expect-error - 'this' implicitly has type 'any' because it does not have a type annotation.
2538
- const context = this;
2539
- const later = () => {
2540
- timeoutId = null;
2541
- func.apply(context, args);
2542
- };
2543
- clearTimeout(timeoutId);
2544
- timeoutId = setTimeout(later, delay);
2545
- };
2546
- debounced.cancel = () => {
2547
- clearTimeout(timeoutId);
2548
- timeoutId = null;
2549
- };
2550
- return debounced;
2551
- }
2552
2534
  const formatTime = (elapsedTime) => {
2553
2535
  const totalSeconds = Math.floor(elapsedTime / 1000);
2554
2536
  const minutes = Math.floor(totalSeconds / 60);
@@ -5798,43 +5780,591 @@ function toFixedPoint(str, e, z) {
5798
5780
 
5799
5781
  var BigNumber = clone();
5800
5782
 
5783
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
5784
+
5785
+ function getDefaultExportFromCjs (x) {
5786
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
5787
+ }
5788
+
5789
+ /**
5790
+ * Checks if `value` is the
5791
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
5792
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
5793
+ *
5794
+ * @static
5795
+ * @memberOf _
5796
+ * @since 0.1.0
5797
+ * @category Lang
5798
+ * @param {*} value The value to check.
5799
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
5800
+ * @example
5801
+ *
5802
+ * _.isObject({});
5803
+ * // => true
5804
+ *
5805
+ * _.isObject([1, 2, 3]);
5806
+ * // => true
5807
+ *
5808
+ * _.isObject(_.noop);
5809
+ * // => true
5810
+ *
5811
+ * _.isObject(null);
5812
+ * // => false
5813
+ */
5814
+
5815
+ function isObject$2(value) {
5816
+ var type = typeof value;
5817
+ return value != null && (type == 'object' || type == 'function');
5818
+ }
5819
+
5820
+ var isObject_1 = isObject$2;
5821
+
5822
+ /** Detect free variable `global` from Node.js. */
5823
+
5824
+ var freeGlobal$1 = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
5825
+
5826
+ var _freeGlobal = freeGlobal$1;
5827
+
5828
+ var freeGlobal = _freeGlobal;
5829
+
5830
+ /** Detect free variable `self`. */
5831
+ var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
5832
+
5833
+ /** Used as a reference to the global object. */
5834
+ var root$2 = freeGlobal || freeSelf || Function('return this')();
5835
+
5836
+ var _root = root$2;
5837
+
5838
+ var root$1 = _root;
5839
+
5840
+ /**
5841
+ * Gets the timestamp of the number of milliseconds that have elapsed since
5842
+ * the Unix epoch (1 January 1970 00:00:00 UTC).
5843
+ *
5844
+ * @static
5845
+ * @memberOf _
5846
+ * @since 2.4.0
5847
+ * @category Date
5848
+ * @returns {number} Returns the timestamp.
5849
+ * @example
5850
+ *
5851
+ * _.defer(function(stamp) {
5852
+ * console.log(_.now() - stamp);
5853
+ * }, _.now());
5854
+ * // => Logs the number of milliseconds it took for the deferred invocation.
5855
+ */
5856
+ var now$1 = function() {
5857
+ return root$1.Date.now();
5858
+ };
5859
+
5860
+ var now_1 = now$1;
5861
+
5862
+ /** Used to match a single whitespace character. */
5863
+
5864
+ var reWhitespace = /\s/;
5865
+
5866
+ /**
5867
+ * Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
5868
+ * character of `string`.
5869
+ *
5870
+ * @private
5871
+ * @param {string} string The string to inspect.
5872
+ * @returns {number} Returns the index of the last non-whitespace character.
5873
+ */
5874
+ function trimmedEndIndex$1(string) {
5875
+ var index = string.length;
5876
+
5877
+ while (index-- && reWhitespace.test(string.charAt(index))) {}
5878
+ return index;
5879
+ }
5880
+
5881
+ var _trimmedEndIndex = trimmedEndIndex$1;
5882
+
5883
+ var trimmedEndIndex = _trimmedEndIndex;
5884
+
5885
+ /** Used to match leading whitespace. */
5886
+ var reTrimStart = /^\s+/;
5887
+
5888
+ /**
5889
+ * The base implementation of `_.trim`.
5890
+ *
5891
+ * @private
5892
+ * @param {string} string The string to trim.
5893
+ * @returns {string} Returns the trimmed string.
5894
+ */
5895
+ function baseTrim$1(string) {
5896
+ return string
5897
+ ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
5898
+ : string;
5899
+ }
5900
+
5901
+ var _baseTrim = baseTrim$1;
5902
+
5903
+ var root = _root;
5904
+
5905
+ /** Built-in value references. */
5906
+ var Symbol$3 = root.Symbol;
5907
+
5908
+ var _Symbol = Symbol$3;
5909
+
5910
+ var Symbol$2 = _Symbol;
5911
+
5912
+ /** Used for built-in method references. */
5913
+ var objectProto$1 = Object.prototype;
5914
+
5915
+ /** Used to check objects for own properties. */
5916
+ var hasOwnProperty = objectProto$1.hasOwnProperty;
5917
+
5918
+ /**
5919
+ * Used to resolve the
5920
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
5921
+ * of values.
5922
+ */
5923
+ var nativeObjectToString$1 = objectProto$1.toString;
5924
+
5925
+ /** Built-in value references. */
5926
+ var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : undefined;
5927
+
5928
+ /**
5929
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
5930
+ *
5931
+ * @private
5932
+ * @param {*} value The value to query.
5933
+ * @returns {string} Returns the raw `toStringTag`.
5934
+ */
5935
+ function getRawTag$1(value) {
5936
+ var isOwn = hasOwnProperty.call(value, symToStringTag$1),
5937
+ tag = value[symToStringTag$1];
5938
+
5939
+ try {
5940
+ value[symToStringTag$1] = undefined;
5941
+ var unmasked = true;
5942
+ } catch (e) {}
5943
+
5944
+ var result = nativeObjectToString$1.call(value);
5945
+ if (unmasked) {
5946
+ if (isOwn) {
5947
+ value[symToStringTag$1] = tag;
5948
+ } else {
5949
+ delete value[symToStringTag$1];
5950
+ }
5951
+ }
5952
+ return result;
5953
+ }
5954
+
5955
+ var _getRawTag = getRawTag$1;
5956
+
5957
+ /** Used for built-in method references. */
5958
+
5959
+ var objectProto = Object.prototype;
5960
+
5961
+ /**
5962
+ * Used to resolve the
5963
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
5964
+ * of values.
5965
+ */
5966
+ var nativeObjectToString = objectProto.toString;
5967
+
5968
+ /**
5969
+ * Converts `value` to a string using `Object.prototype.toString`.
5970
+ *
5971
+ * @private
5972
+ * @param {*} value The value to convert.
5973
+ * @returns {string} Returns the converted string.
5974
+ */
5975
+ function objectToString$1(value) {
5976
+ return nativeObjectToString.call(value);
5977
+ }
5978
+
5979
+ var _objectToString = objectToString$1;
5980
+
5981
+ var Symbol$1 = _Symbol,
5982
+ getRawTag = _getRawTag,
5983
+ objectToString = _objectToString;
5984
+
5985
+ /** `Object#toString` result references. */
5986
+ var nullTag = '[object Null]',
5987
+ undefinedTag = '[object Undefined]';
5988
+
5989
+ /** Built-in value references. */
5990
+ var symToStringTag = Symbol$1 ? Symbol$1.toStringTag : undefined;
5991
+
5992
+ /**
5993
+ * The base implementation of `getTag` without fallbacks for buggy environments.
5994
+ *
5995
+ * @private
5996
+ * @param {*} value The value to query.
5997
+ * @returns {string} Returns the `toStringTag`.
5998
+ */
5999
+ function baseGetTag$1(value) {
6000
+ if (value == null) {
6001
+ return value === undefined ? undefinedTag : nullTag;
6002
+ }
6003
+ return (symToStringTag && symToStringTag in Object(value))
6004
+ ? getRawTag(value)
6005
+ : objectToString(value);
6006
+ }
6007
+
6008
+ var _baseGetTag = baseGetTag$1;
6009
+
6010
+ /**
6011
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
6012
+ * and has a `typeof` result of "object".
6013
+ *
6014
+ * @static
6015
+ * @memberOf _
6016
+ * @since 4.0.0
6017
+ * @category Lang
6018
+ * @param {*} value The value to check.
6019
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
6020
+ * @example
6021
+ *
6022
+ * _.isObjectLike({});
6023
+ * // => true
6024
+ *
6025
+ * _.isObjectLike([1, 2, 3]);
6026
+ * // => true
6027
+ *
6028
+ * _.isObjectLike(_.noop);
6029
+ * // => false
6030
+ *
6031
+ * _.isObjectLike(null);
6032
+ * // => false
6033
+ */
6034
+
6035
+ function isObjectLike$1(value) {
6036
+ return value != null && typeof value == 'object';
6037
+ }
6038
+
6039
+ var isObjectLike_1 = isObjectLike$1;
6040
+
6041
+ var baseGetTag = _baseGetTag,
6042
+ isObjectLike = isObjectLike_1;
6043
+
6044
+ /** `Object#toString` result references. */
6045
+ var symbolTag = '[object Symbol]';
6046
+
6047
+ /**
6048
+ * Checks if `value` is classified as a `Symbol` primitive or object.
6049
+ *
6050
+ * @static
6051
+ * @memberOf _
6052
+ * @since 4.0.0
6053
+ * @category Lang
6054
+ * @param {*} value The value to check.
6055
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
6056
+ * @example
6057
+ *
6058
+ * _.isSymbol(Symbol.iterator);
6059
+ * // => true
6060
+ *
6061
+ * _.isSymbol('abc');
6062
+ * // => false
6063
+ */
6064
+ function isSymbol$1(value) {
6065
+ return typeof value == 'symbol' ||
6066
+ (isObjectLike(value) && baseGetTag(value) == symbolTag);
6067
+ }
6068
+
6069
+ var isSymbol_1 = isSymbol$1;
6070
+
6071
+ var baseTrim = _baseTrim,
6072
+ isObject$1 = isObject_1,
6073
+ isSymbol = isSymbol_1;
6074
+
6075
+ /** Used as references for various `Number` constants. */
6076
+ var NAN = 0 / 0;
6077
+
6078
+ /** Used to detect bad signed hexadecimal string values. */
6079
+ var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
6080
+
6081
+ /** Used to detect binary string values. */
6082
+ var reIsBinary = /^0b[01]+$/i;
6083
+
6084
+ /** Used to detect octal string values. */
6085
+ var reIsOctal = /^0o[0-7]+$/i;
6086
+
6087
+ /** Built-in method references without a dependency on `root`. */
6088
+ var freeParseInt = parseInt;
6089
+
6090
+ /**
6091
+ * Converts `value` to a number.
6092
+ *
6093
+ * @static
6094
+ * @memberOf _
6095
+ * @since 4.0.0
6096
+ * @category Lang
6097
+ * @param {*} value The value to process.
6098
+ * @returns {number} Returns the number.
6099
+ * @example
6100
+ *
6101
+ * _.toNumber(3.2);
6102
+ * // => 3.2
6103
+ *
6104
+ * _.toNumber(Number.MIN_VALUE);
6105
+ * // => 5e-324
6106
+ *
6107
+ * _.toNumber(Infinity);
6108
+ * // => Infinity
6109
+ *
6110
+ * _.toNumber('3.2');
6111
+ * // => 3.2
6112
+ */
6113
+ function toNumber$1(value) {
6114
+ if (typeof value == 'number') {
6115
+ return value;
6116
+ }
6117
+ if (isSymbol(value)) {
6118
+ return NAN;
6119
+ }
6120
+ if (isObject$1(value)) {
6121
+ var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
6122
+ value = isObject$1(other) ? (other + '') : other;
6123
+ }
6124
+ if (typeof value != 'string') {
6125
+ return value === 0 ? value : +value;
6126
+ }
6127
+ value = baseTrim(value);
6128
+ var isBinary = reIsBinary.test(value);
6129
+ return (isBinary || reIsOctal.test(value))
6130
+ ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
6131
+ : (reIsBadHex.test(value) ? NAN : +value);
6132
+ }
6133
+
6134
+ var toNumber_1 = toNumber$1;
6135
+
6136
+ var isObject = isObject_1,
6137
+ now = now_1,
6138
+ toNumber = toNumber_1;
6139
+
6140
+ /** Error message constants. */
6141
+ var FUNC_ERROR_TEXT = 'Expected a function';
6142
+
6143
+ /* Built-in method references for those with the same name as other `lodash` methods. */
6144
+ var nativeMax = Math.max,
6145
+ nativeMin = Math.min;
6146
+
6147
+ /**
6148
+ * Creates a debounced function that delays invoking `func` until after `wait`
6149
+ * milliseconds have elapsed since the last time the debounced function was
6150
+ * invoked. The debounced function comes with a `cancel` method to cancel
6151
+ * delayed `func` invocations and a `flush` method to immediately invoke them.
6152
+ * Provide `options` to indicate whether `func` should be invoked on the
6153
+ * leading and/or trailing edge of the `wait` timeout. The `func` is invoked
6154
+ * with the last arguments provided to the debounced function. Subsequent
6155
+ * calls to the debounced function return the result of the last `func`
6156
+ * invocation.
6157
+ *
6158
+ * **Note:** If `leading` and `trailing` options are `true`, `func` is
6159
+ * invoked on the trailing edge of the timeout only if the debounced function
6160
+ * is invoked more than once during the `wait` timeout.
6161
+ *
6162
+ * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
6163
+ * until to the next tick, similar to `setTimeout` with a timeout of `0`.
6164
+ *
6165
+ * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
6166
+ * for details over the differences between `_.debounce` and `_.throttle`.
6167
+ *
6168
+ * @static
6169
+ * @memberOf _
6170
+ * @since 0.1.0
6171
+ * @category Function
6172
+ * @param {Function} func The function to debounce.
6173
+ * @param {number} [wait=0] The number of milliseconds to delay.
6174
+ * @param {Object} [options={}] The options object.
6175
+ * @param {boolean} [options.leading=false]
6176
+ * Specify invoking on the leading edge of the timeout.
6177
+ * @param {number} [options.maxWait]
6178
+ * The maximum time `func` is allowed to be delayed before it's invoked.
6179
+ * @param {boolean} [options.trailing=true]
6180
+ * Specify invoking on the trailing edge of the timeout.
6181
+ * @returns {Function} Returns the new debounced function.
6182
+ * @example
6183
+ *
6184
+ * // Avoid costly calculations while the window size is in flux.
6185
+ * jQuery(window).on('resize', _.debounce(calculateLayout, 150));
6186
+ *
6187
+ * // Invoke `sendMail` when clicked, debouncing subsequent calls.
6188
+ * jQuery(element).on('click', _.debounce(sendMail, 300, {
6189
+ * 'leading': true,
6190
+ * 'trailing': false
6191
+ * }));
6192
+ *
6193
+ * // Ensure `batchLog` is invoked once after 1 second of debounced calls.
6194
+ * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
6195
+ * var source = new EventSource('/stream');
6196
+ * jQuery(source).on('message', debounced);
6197
+ *
6198
+ * // Cancel the trailing debounced invocation.
6199
+ * jQuery(window).on('popstate', debounced.cancel);
6200
+ */
6201
+ function debounce(func, wait, options) {
6202
+ var lastArgs,
6203
+ lastThis,
6204
+ maxWait,
6205
+ result,
6206
+ timerId,
6207
+ lastCallTime,
6208
+ lastInvokeTime = 0,
6209
+ leading = false,
6210
+ maxing = false,
6211
+ trailing = true;
6212
+
6213
+ if (typeof func != 'function') {
6214
+ throw new TypeError(FUNC_ERROR_TEXT);
6215
+ }
6216
+ wait = toNumber(wait) || 0;
6217
+ if (isObject(options)) {
6218
+ leading = !!options.leading;
6219
+ maxing = 'maxWait' in options;
6220
+ maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
6221
+ trailing = 'trailing' in options ? !!options.trailing : trailing;
6222
+ }
6223
+
6224
+ function invokeFunc(time) {
6225
+ var args = lastArgs,
6226
+ thisArg = lastThis;
6227
+
6228
+ lastArgs = lastThis = undefined;
6229
+ lastInvokeTime = time;
6230
+ result = func.apply(thisArg, args);
6231
+ return result;
6232
+ }
6233
+
6234
+ function leadingEdge(time) {
6235
+ // Reset any `maxWait` timer.
6236
+ lastInvokeTime = time;
6237
+ // Start the timer for the trailing edge.
6238
+ timerId = setTimeout(timerExpired, wait);
6239
+ // Invoke the leading edge.
6240
+ return leading ? invokeFunc(time) : result;
6241
+ }
6242
+
6243
+ function remainingWait(time) {
6244
+ var timeSinceLastCall = time - lastCallTime,
6245
+ timeSinceLastInvoke = time - lastInvokeTime,
6246
+ timeWaiting = wait - timeSinceLastCall;
6247
+
6248
+ return maxing
6249
+ ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
6250
+ : timeWaiting;
6251
+ }
6252
+
6253
+ function shouldInvoke(time) {
6254
+ var timeSinceLastCall = time - lastCallTime,
6255
+ timeSinceLastInvoke = time - lastInvokeTime;
6256
+
6257
+ // Either this is the first call, activity has stopped and we're at the
6258
+ // trailing edge, the system time has gone backwards and we're treating
6259
+ // it as the trailing edge, or we've hit the `maxWait` limit.
6260
+ return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
6261
+ (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
6262
+ }
6263
+
6264
+ function timerExpired() {
6265
+ var time = now();
6266
+ if (shouldInvoke(time)) {
6267
+ return trailingEdge(time);
6268
+ }
6269
+ // Restart the timer.
6270
+ timerId = setTimeout(timerExpired, remainingWait(time));
6271
+ }
6272
+
6273
+ function trailingEdge(time) {
6274
+ timerId = undefined;
6275
+
6276
+ // Only invoke if we have `lastArgs` which means `func` has been
6277
+ // debounced at least once.
6278
+ if (trailing && lastArgs) {
6279
+ return invokeFunc(time);
6280
+ }
6281
+ lastArgs = lastThis = undefined;
6282
+ return result;
6283
+ }
6284
+
6285
+ function cancel() {
6286
+ if (timerId !== undefined) {
6287
+ clearTimeout(timerId);
6288
+ }
6289
+ lastInvokeTime = 0;
6290
+ lastArgs = lastCallTime = lastThis = timerId = undefined;
6291
+ }
6292
+
6293
+ function flush() {
6294
+ return timerId === undefined ? result : trailingEdge(now());
6295
+ }
6296
+
6297
+ function debounced() {
6298
+ var time = now(),
6299
+ isInvoking = shouldInvoke(time);
6300
+
6301
+ lastArgs = arguments;
6302
+ lastThis = this;
6303
+ lastCallTime = time;
6304
+
6305
+ if (isInvoking) {
6306
+ if (timerId === undefined) {
6307
+ return leadingEdge(lastCallTime);
6308
+ }
6309
+ if (maxing) {
6310
+ // Handle invocations in a tight loop.
6311
+ clearTimeout(timerId);
6312
+ timerId = setTimeout(timerExpired, wait);
6313
+ return invokeFunc(lastCallTime);
6314
+ }
6315
+ }
6316
+ if (timerId === undefined) {
6317
+ timerId = setTimeout(timerExpired, wait);
6318
+ }
6319
+ return result;
6320
+ }
6321
+ debounced.cancel = cancel;
6322
+ debounced.flush = flush;
6323
+ return debounced;
6324
+ }
6325
+
6326
+ var debounce_1 = debounce;
6327
+
6328
+ var debounce$1 = /*@__PURE__*/getDefaultExportFromCjs(debounce_1);
6329
+
5801
6330
  /**
5802
6331
  * Convert token amount to USD
5803
6332
  * @param {string|number} tokenAmount - The amount of tokens
5804
6333
  * @param {string|number} tokenPrice - The price of one token in USD
5805
6334
  * @returns {BigNumber} - The equivalent amount in USD
5806
6335
  */
5807
- function convertTokenAmountToUSD(tokenAmount, tokenPrice) {
6336
+ function convertTokenAmountToUSD(tokenAmount, tokenPrice, maxDecimals = 4) {
5808
6337
  if (!tokenAmount || !tokenPrice)
5809
- return '0';
6338
+ return '';
5810
6339
  const amount = new BigNumber(tokenAmount);
5811
6340
  const price = new BigNumber(tokenPrice);
5812
- return amount.multipliedBy(price).decimalPlaces(4).toString();
6341
+ return amount.multipliedBy(price).decimalPlaces(maxDecimals).toString();
5813
6342
  }
5814
6343
  /**
5815
6344
  * Convert USD to token amount
5816
6345
  * @param {string|number} usdAmount - The amount in USD
5817
6346
  * @param {string|number} tokenPrice - The price of one token in USD
6347
+ * @param {number} maxDecimals - The maximum number of decimals
5818
6348
  * @returns {BigNumber} - The equivalent amount of tokens
5819
6349
  */
5820
- function convertUSDToTokenAmount(usdAmount, tokenPrice) {
5821
- if (!usdAmount || !tokenPrice)
6350
+ function convertUSDToTokenAmount(usdAmount, tokenPrice, maxDecimals) {
6351
+ if (!usdAmount || !tokenPrice || !maxDecimals)
5822
6352
  return '0';
5823
6353
  const amount = new BigNumber(usdAmount);
5824
6354
  const price = new BigNumber(tokenPrice);
5825
- return amount.dividedBy(price).toString();
6355
+ return amount.dividedBy(price).decimalPlaces(maxDecimals).toString();
5826
6356
  }
5827
6357
  const INTL_NUMBER_FORMATTER = new Intl.NumberFormat('en-US', {
5828
6358
  minimumFractionDigits: 0,
5829
6359
  maximumFractionDigits: 5,
5830
6360
  });
5831
6361
  /**
5832
- * Formats a number to USD
6362
+ * Formats a number to the en-US number format
5833
6363
  *
5834
- * @param amount - The amount to format
5835
- * @returns The formatted currency string
6364
+ * @param amount - The number to format
6365
+ * @returns The formatted string
5836
6366
  */
5837
- function formatUSD(amount) {
6367
+ function formatAmount(amount) {
5838
6368
  return INTL_NUMBER_FORMATTER.format(amount);
5839
6369
  }
5840
6370
  function trimExtraDecimals(value, maxDecimals) {
@@ -5842,7 +6372,7 @@ function trimExtraDecimals(value, maxDecimals) {
5842
6372
  const split = value.split('.');
5843
6373
  if (split.length > 1) {
5844
6374
  const decimals = (_a = split[1]) !== null && _a !== void 0 ? _a : '';
5845
- if (decimals.length > maxDecimals) {
6375
+ if (maxDecimals && decimals.length > maxDecimals) {
5846
6376
  const newValue = `${split[0]}.${decimals.slice(0, maxDecimals)}`;
5847
6377
  return newValue;
5848
6378
  }
@@ -5850,259 +6380,17 @@ function trimExtraDecimals(value, maxDecimals) {
5850
6380
  return value;
5851
6381
  }
5852
6382
 
5853
- const NumericInput = (_a) => {
5854
- var _b;
5855
- var { onParsedValueChanged, initialValue = '', forcedUpdateValue, maxDecimals, balance = '0', tokenPrice = 0, numericInputMode } = _a, props = __rest(_a, ["onParsedValueChanged", "initialValue", "forcedUpdateValue", "maxDecimals", "balance", "tokenPrice", "numericInputMode"]);
5856
- const [inputValue, setInputValue] = useState(initialValue);
5857
- // Probably a better way to handle this
5858
- // This was introduce to handle the "MAX" button setting an amount
5859
- // Other than that, this component is only sending value to the exterior
5860
- // Without this, we were losing inputs such as ".05" that were forced parsed to "0.05" after debounce
5861
- useEffect(() => {
5862
- if (forcedUpdateValue && forcedUpdateValue !== '0') {
5863
- setInputValue(forcedUpdateValue);
5864
- }
5865
- }, [forcedUpdateValue]);
5866
- /**
5867
- * Get the number of decimals of inputValue
5868
- * If there are more decimals than the maxDecimals
5869
- * remove the extra decimals
5870
- */
5871
- useEffect(() => {
5872
- var _a;
5873
- const split = inputValue.split('.');
5874
- if (split.length > 1) {
5875
- const decimals = (_a = split[1]) !== null && _a !== void 0 ? _a : '';
5876
- if (maxDecimals && decimals.length > maxDecimals) {
5877
- const newValue = `${split[0]}.${decimals.slice(0, maxDecimals)}`;
5878
- setInputValue(newValue);
5879
- onParsedValueChanged(newValue);
5880
- }
5881
- }
5882
- }, [maxDecimals]);
5883
- const debouncePriceChanged = (value = '') => {
5884
- if (value.endsWith('.'))
5885
- return;
5886
- onParsedValueChanged(value);
5887
- };
5888
- // useCallback to memoizes the debounce function, prevents recreating it
5889
- const debouncePriceUpdate = useCallback(debounce(debouncePriceChanged, 700), []);
5890
- const handlePriceChanged = (event) => {
5891
- var _a;
5892
- try {
5893
- const formattedInput = event.currentTarget.value
5894
- .replace(/[^0-9\.\,%]/g, '')
5895
- .replace(',', '.');
5896
- if (formattedInput.includes('%')) {
5897
- let cleanedInput = formattedInput;
5898
- // remove duplicates & always add % at the end
5899
- cleanedInput = formattedInput.replaceAll('%', '').concat('%');
5900
- setInputValue(cleanedInput);
5901
- debouncePriceUpdate.cancel();
5902
- return;
5903
- }
5904
- // This is to prevent the user from typing more decimals than the decimals attribute of the token
5905
- if (maxDecimals !== undefined) {
5906
- const split = formattedInput.split('.');
5907
- if (split.length > 1) {
5908
- const decimals = (_a = split[1]) !== null && _a !== void 0 ? _a : '';
5909
- if (decimals.length > maxDecimals) {
5910
- // Don't update anything
5911
- return;
5912
- }
5913
- }
5914
- }
5915
- // Means the user is currently typing and will add decimal, no need to fetch or parse
5916
- // example input: 0.00
5917
- const isTypingDecimals = (formattedInput.includes('.') && formattedInput.endsWith('0')) ||
5918
- formattedInput.endsWith('.') ||
5919
- (formattedInput === '0' && (inputValue === '' || inputValue === '0'));
5920
- // if input includes at least one character different than `0` (zero), `.` (dot), or `,` (comma)
5921
- // means that user is typing a valid amount, for example: 1.02 or 0.005
5922
- // if so, then update the input value and fetch the price
5923
- if (/[^0,.]/.test(formattedInput)) {
5924
- setInputValue(formattedInput);
5925
- debouncePriceUpdate(formattedInput);
5926
- }
5927
- else if (isTypingDecimals) {
5928
- setInputValue(formattedInput);
5929
- }
5930
- else if (!isNaN(+formattedInput)) {
5931
- setInputValue(formattedInput.toString());
5932
- debouncePriceUpdate(formattedInput.toString());
5933
- // onParsedValueChanged(formattedInput.toString());
5934
- }
5935
- else {
5936
- setInputValue('');
5937
- }
5938
- if (numericInputMode === 'price' && !isTypingDecimals) {
5939
- const usdAmount = Number(formattedInput);
5940
- if (tokenPrice === 0 || usdAmount === 0) {
5941
- setInputValue('');
5942
- onParsedValueChanged('');
5943
- }
5944
- else if (usdAmount > 0) {
5945
- const tokenAmount = convertUSDToTokenAmount(usdAmount, tokenPrice);
5946
- setInputValue(usdAmount.toString());
5947
- debouncePriceUpdate(tokenAmount);
5948
- return;
5949
- }
5950
- }
5951
- }
5952
- catch (error) {
5953
- setInputValue('');
5954
- }
5955
- };
5956
- const handleSubmit = (event) => {
5957
- event.preventDefault();
5958
- if (inputValue.includes('%')) {
5959
- const percentage = Number(inputValue.replace('%', ''));
5960
- // If the percentage is greater than 100, set it to 100
5961
- const formattedPercentage = percentage > 100 ? 100 : percentage;
5962
- const valueByPercentage = Number(balance) * (formattedPercentage / 100);
5963
- // If the value is 0, we want to show 0, not 0.0000
5964
- const formattedValue = valueByPercentage === 0 ? '0' : valueByPercentage.toFixed(4);
5965
- setInputValue(formattedValue);
5966
- onParsedValueChanged(formattedValue);
5967
- }
5968
- };
5969
- return (jsxs("form", { className: "tw-relative tw-px-squid-m tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular", onSubmit: handleSubmit, children: [numericInputMode === 'price' && (jsx("span", { className: "tw-absolute tw-left-[30px] tw-top-[11px] tw-leading-[43px] tw-text-grey-600", children: "$" })), jsx("input", Object.assign({}, props, { onChange: handlePriceChanged, value: inputValue, type: "string", placeholder: (_b = props.placeholder) !== null && _b !== void 0 ? _b : '0', className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', numericInputMode === 'price' && 'tw-pl-[33px]') }))] }));
5970
- };
5971
-
5972
- // font size, line height, and letter spacing classes
5973
- const textClassMap = {
5974
- small: 'tw-text-heading-small tw-tracking-heading-small tw-leading-heading-small',
5975
- medium: 'tw-text-heading-medium tw-tracking-heading-medium tw-leading-heading-medium',
5976
- large: 'tw-text-heading-large tw-tracking-heading-large tw-leading-heading-large',
5977
- };
5978
- function HeadingText({ children, bold, size }) {
5979
- const fontWeightClass = bold
5980
- ? 'tw-font-heading-bold'
5981
- : 'tw-font-heading-regular';
5982
- return (jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
6383
+ function MaxIcon() {
6384
+ return (jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("g", { clipPath: "url(#clip0_41_20801)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM10.6508 4.74074L14.1508 7.74074C14.5701 8.10017 14.6187 8.73147 14.2593 9.15079C13.8998 9.57012 13.2685 9.61868 12.8492 9.25926L10 6.81708L7.15079 9.25926C6.73147 9.61868 6.10017 9.57012 5.74074 9.15079C5.38132 8.73147 5.42988 8.10017 5.84921 7.74074L9.34921 4.74074C9.7237 4.41975 10.2763 4.41975 10.6508 4.74074ZM14.1508 13.7407L10.6508 10.7407C10.2763 10.4198 9.7237 10.4198 9.34921 10.7407L5.84921 13.7407C5.42988 14.1002 5.38132 14.7315 5.74074 15.1508C6.10017 15.5701 6.73147 15.6187 7.15079 15.2593L10 12.8171L12.8492 15.2593C13.2685 15.6187 13.8998 15.5701 14.2593 15.1508C14.6187 14.7315 14.5701 14.1002 14.1508 13.7407Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_41_20801", children: jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
5983
6385
  }
5984
6386
 
5985
- function SettingsSlider({ value, type, onChange, hasDecimals, max, min, }) {
5986
- return (jsxs("div", { className: "tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-rounded-squid-xs", children: [jsx("input", { min: min !== null && min !== void 0 ? min : 0, max: max !== null && max !== void 0 ? max : 99, step: hasDecimals ? 0.1 : 1, placeholder: "0", type: "number", onChange: (e) => {
5987
- onChange === null || onChange === void 0 ? void 0 : onChange(Number(e.target.value));
5988
- }, className: cn('tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-bg-transparent tw-p-squid-xs tw-text-caption !tw-font-medium tw-leading-[10px] tw-text-grey-300 placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', type === 'percentage'
5989
- ? 'tw-w-[84px] tw-pr-[52px] tw-text-right'
5990
- : 'tw-w-[80px] tw-pl-[20px] tw-pr-[32px] tw-text-left'), value: value }), type === 'percentage' && jsx(PercentageDecorator, {}), type === 'amount' && jsx(AmountDecorator, {})] }));
5991
- }
5992
- function PercentageDecorator() {
5993
- return (jsxs("div", { className: "tw-absolute tw-right-squid-xs tw-flex tw-items-center tw-justify-center tw-gap-squid-xs !tw-font-medium tw-leading-[10px]", children: [jsx(CaptionText, { className: "tw-translate-y-[0.5px] !tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: "%" }), jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
6387
+ function SwapInputsIcon() {
6388
+ return (jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("g", { clipPath: "url(#clip0_40_7936)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM8.38268 4.57612C8.75636 4.7309 9 5.09554 9 5.5V15.5C9 16.0523 8.55228 16.5 8 16.5C7.44772 16.5 7 16.0523 7 15.5V7.91421L5.70711 9.20711C5.31658 9.59763 4.68342 9.59763 4.29289 9.20711C3.90237 8.81658 3.90237 8.18342 4.29289 7.79289L7.29289 4.79289C7.57889 4.5069 8.00901 4.42134 8.38268 4.57612ZM11 15.5C11 15.9045 11.2436 16.2691 11.6173 16.4239C11.991 16.5787 12.4211 16.4931 12.7071 16.2071L15.7071 13.2071C16.0976 12.8166 16.0976 12.1834 15.7071 11.7929C15.3166 11.4024 14.6834 11.4024 14.2929 11.7929L13 13.0858V5.5C13 4.94771 12.5523 4.5 12 4.5C11.4477 4.5 11 4.94771 11 5.5V15.5Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_40_7936", children: jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
5994
6389
  }
5995
- function AmountDecorator() {
5996
- return (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-absolute tw-left-squid-xs tw-translate-y-[0.5px] !tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: "$" }), jsx("div", { className: "tw-absolute tw-right-squid-xs tw-flex tw-items-center tw-justify-center tw-gap-squid-xs !tw-font-medium tw-leading-[10px]", children: jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) }) })] }));
5997
- }
5998
-
5999
- const switchSizeClassMap = {
6000
- small: 'tw-w-[36px] tw-h-squid-m tw-p-0.5',
6001
- large: 'tw-w-[54px] tw-h-squid-l tw-p-[3px]',
6002
- };
6003
- const switchKnobSizeClassMap = {
6004
- small: 'tw-w-4 tw-h-4',
6005
- large: 'tw-w-6 tw-h-6',
6006
- };
6007
- const switchKnobCheckedClassMap = {
6008
- large: {
6009
- checked: 'tw-left-[26px]',
6010
- unchecked: 'tw-left-[2px]',
6011
- },
6012
- small: {
6013
- checked: 'tw-left-[17px]',
6014
- unchecked: 'tw-left-[1px]',
6015
- },
6016
- };
6017
- function Switch({ checked = false, onChange, size, disabled = false, }) {
6018
- return (
6019
- // Switch container
6020
- jsxs("label", { className: clsx('tw-relative tw-inline-flex tw-items-center tw-justify-end tw-overflow-hidden tw-rounded-squid-m tw-border tw-border-material-light-thin tw-transition-colors',
6021
- // size styles
6022
- switchSizeClassMap[size],
6023
- // checked styles
6024
- checked ? 'tw-bg-status-positive' : 'tw-bg-grey-800',
6025
- // disabled styles
6026
- disabled ? 'tw-cursor-not-allowed' : 'tw-cursor-pointer'), children: [jsx("input", { disabled: disabled, checked: checked, onChange: disabled ? undefined : (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" }), jsx("span", { style: {
6027
- filter: 'drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.33)) drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))',
6028
- }, className: clsx('tw-absolute tw-rounded-full tw-border tw-border-material-light-thin tw-transition-all',
6029
- // size styles
6030
- switchKnobSizeClassMap[size],
6031
- // checked styles
6032
- switchKnobCheckedClassMap[size][checked ? 'checked' : 'unchecked'], checked
6033
- ? 'group-data-[squid-theme-type=dark]:tw-bg-grey-100 group-data-[squid-theme-type=light]:tw-bg-grey-900'
6034
- : 'tw-bg-grey-500') })] }));
6035
- }
6036
-
6037
- const borderRadiusClassMap = {
6038
- sm: 'tw-rounded-squid-s',
6039
- lg: 'tw-rounded-squid-m',
6040
- };
6041
- function Menu(_a) {
6042
- var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg', menuRef } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded", "menuRef"]);
6043
- return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-xs tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch !tw-leading-[10px]", children: children })) : (jsx("div", { className: "tw-z-20 tw-max-w-full tw-text-caption", children: children })), displayControls ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
6044
- }
6045
-
6046
- const tooltipWidthClassMap = {
6047
- max: 'tw-w-max',
6048
- container: 'tw-w-full',
6049
- };
6050
- const tooltipThresholdClassMap = {
6051
- xxs: 'tw-pb-squid-xxs',
6052
- xs: 'tw-pb-squid-xs',
6053
- s: 'tw-pb-squid-s',
6054
- m: 'tw-pb-squid-m',
6055
- l: 'tw-pb-squid-l',
6056
- xl: 'tw-pb-squid-xl',
6057
- xxl: 'tw-pb-squid-xxl',
6058
- };
6059
- function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, }) {
6060
- return (jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), tooltipContent ? (jsx(Menu, { style: {
6061
- [CSS_VARS.DISPLAY_DELAYED_DURATION]: `${displayDelayMs}ms`,
6062
- }, containerClassName: cn(
6063
- // general styles
6064
- 'tw-absolute tw-z-40 tw-bottom-full tw-left-1/2 -tw-translate-x-1/2',
6065
- // visibility styles. Display only on hover
6066
- 'tw-animate-hide peer-hover:tw-animate-display-delayed hover:tw-animate-display-delayed', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })) : null] }));
6067
- }
6068
-
6069
- function BoostButton({ boostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, boostIndicatorRef, }) {
6070
- return (jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-rounded-squid-m tw-pb-squid-xxs tw-text-grey-300 focus:tw-outline-none", children: [jsx("span", { className: cn('tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
6071
- 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsx("span", { className: cn('tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
6072
- 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled/boost-toggle:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled/boost-toggle:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled/boost-toggle:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
6073
- boxShadow: generateMarkerLines(40),
6074
- } })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors group-disabled/boost-toggle:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
6075
- transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
6076
- } })] }) }));
6077
- }
6078
- function generateMarkerLines(count) {
6079
- const halfCount = Math.ceil(count / 2);
6080
- const rightShadows = Array.from({ length: halfCount }, (_, index) => {
6081
- return `-${(index + 1) * 6}px 0 currentColor`;
6082
- });
6083
- const leftShadows = Array.from({ length: halfCount }, (_, index) => {
6084
- return `${(index + 1) * 6}px 0 currentColor`;
6085
- });
6086
- const allShadows = [...rightShadows, ...leftShadows];
6087
- return allShadows.join(', ');
6088
- }
6089
-
6090
- function Chip(_a) {
6091
- var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
6092
- return (jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
6093
- }
6094
-
6095
- function EthereumIcon() {
6096
- return (jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M9.99866 2.91669L9.99866 12.6994L14.471 10.1298L9.99866 2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 2.91669L5.52637 10.1298L9.99872 12.6995V8.15387V2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 13.5226V17.0802L14.4737 10.9542L9.99866 13.5226Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 17.0801V13.5225L5.52637 10.9542L9.99872 17.0801Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 12.6994L14.4709 10.1298L9.99866 8.15387V12.6994Z", fill: "currentColor" }), jsx("path", { d: "M5.52637 10.1298L9.99865 12.6994V8.15387L5.52637 10.1298Z", fill: "currentColor" })] }));
6097
- }
6098
-
6099
- function FeeButton(_a) {
6100
- var { feeInUsd = '0', chipLabel = 'Fee', className } = _a, props = __rest(_a, ["feeInUsd", "chipLabel", "className"]);
6101
- return (jsxs("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin', className), children: [jsx(Chip, { label: chipLabel }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: feeInUsd })] })] })));
6102
- }
6103
-
6104
- function SettingsButton({ label, isSelected = false, onClick, }) {
6105
- return (jsx("button", { onClick: onClick, className: cn('tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', isSelected && 'tw-outline-royal-500'), children: jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
6390
+
6391
+ function Chip(_a) {
6392
+ var { label, icon } = _a, props = __rest(_a, ["label", "icon"]);
6393
+ return (jsx("div", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-m tw-items-center tw-justify-center tw-rounded-squid-m tw-bg-grey-500 tw-text-grey-900', icon && 'tw-w-squid-m', props.className), children: label ? (jsx(CaptionText, { className: "tw-min-w-squid-xl tw-px-squid-xxs tw-text-center", children: label })) : (icon) })));
6106
6394
  }
6107
6395
 
6108
6396
  function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessage, canToggleBoostMode = true, boostTooltipDisplayDelayMs = 0, }) {
@@ -6127,6 +6415,15 @@ function Boost({ boostMode, onToggleBoostMode, estimatedTime, boostDisabledMessa
6127
6415
  : 'tw-bg-status-positive') })] }) }));
6128
6416
  }
6129
6417
 
6418
+ function EthereumIcon() {
6419
+ return (jsxs("svg", { width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("path", { d: "M9.99866 2.91669L9.99866 12.6994L14.471 10.1298L9.99866 2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 2.91669L5.52637 10.1298L9.99872 12.6995V8.15387V2.91669Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 13.5226V17.0802L14.4737 10.9542L9.99866 13.5226Z", fill: "currentColor" }), jsx("path", { d: "M9.99872 17.0801V13.5225L5.52637 10.9542L9.99872 17.0801Z", fill: "currentColor" }), jsx("path", { d: "M9.99866 12.6994L14.4709 10.1298L9.99866 8.15387V12.6994Z", fill: "currentColor" }), jsx("path", { d: "M5.52637 10.1298L9.99865 12.6994V8.15387L5.52637 10.1298Z", fill: "currentColor" })] }));
6420
+ }
6421
+
6422
+ function FeeButton(_a) {
6423
+ var { feeInUsd = '0', chipLabel = 'Fee', className } = _a, props = __rest(_a, ["feeInUsd", "chipLabel", "className"]);
6424
+ return (jsxs("button", Object.assign({}, props, { className: cn('tw-flex tw-h-squid-xl tw-w-full tw-items-center tw-gap-x-squid-xs tw-rounded-squid-m tw-px-squid-xs hover:tw-bg-material-light-thin', className), children: [jsx(Chip, { label: chipLabel }), jsxs("span", { className: "tw-flex tw-items-center tw-gap-squid-xxs", children: [jsx(Chip, { icon: jsx(EthereumIcon, {}) }), jsx(UsdAmount, { usdAmount: feeInUsd })] })] })));
6425
+ }
6426
+
6130
6427
  function EmojiSadIcon({ className, size = '20', }) {
6131
6428
  return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20ZM13.5341 12.4645C11.5815 10.5118 8.41568 10.5118 6.46306 12.4645C6.07254 12.855 6.07254 13.4882 6.46306 13.8787C6.85358 14.2692 7.48675 14.2692 7.87727 13.8787C9.04885 12.7071 10.9483 12.7071 12.1199 13.8787C12.5104 14.2692 13.1436 14.2692 13.5341 13.8787C13.9247 13.4882 13.9247 12.855 13.5341 12.4645ZM8.5 7.5C8.5 8.32843 7.94036 9 7.25 9C6.55964 9 6 8.32843 6 7.5C6 6.67157 6.55964 6 7.25 6C7.94036 6 8.5 6.67157 8.5 7.5ZM12.75 9C13.4404 9 14 8.32843 14 7.5C14 6.67157 13.4404 6 12.75 6C12.0596 6 11.5 6.67157 11.5 7.5C11.5 8.32843 12.0596 9 12.75 9Z", fill: "currentColor" }) }));
6132
6429
  }
@@ -6134,6 +6431,19 @@ function EmojiMeh({ className, size = '20', }) {
6134
6431
  return (jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: size, height: size, viewBox: "0 0 20 20", fill: "none", className: className, children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM7.25 9C7.94036 9 8.5 8.32843 8.5 7.5C8.5 6.67157 7.94036 6 7.25 6C6.55964 6 6 6.67157 6 7.5C6 8.32843 6.55964 9 7.25 9ZM14 7.5C14 8.32843 13.4404 9 12.75 9C12.0596 9 11.5 8.32843 11.5 7.5C11.5 6.67157 12.0596 6 12.75 6C13.4404 6 14 6.67157 14 7.5ZM7 12C6.44772 12 6 12.4477 6 13C6 13.5523 6.44772 14 7 14H13C13.5523 14 14 13.5523 14 13C14 12.4477 13.5523 12 13 12H7Z", fill: "currentColor" }) }));
6135
6432
  }
6136
6433
 
6434
+ // font size, line height, and letter spacing classes
6435
+ const textClassMap = {
6436
+ small: 'tw-text-heading-small tw-tracking-heading-small tw-leading-heading-small',
6437
+ medium: 'tw-text-heading-medium tw-tracking-heading-medium tw-leading-heading-medium',
6438
+ large: 'tw-text-heading-large tw-tracking-heading-large tw-leading-heading-large',
6439
+ };
6440
+ function HeadingText({ children, bold, size }) {
6441
+ const fontWeightClass = bold
6442
+ ? 'tw-font-heading-bold'
6443
+ : 'tw-font-heading-regular';
6444
+ return (jsx("h6", { className: clsx(textClassMap[size], fontWeightClass), children: children }));
6445
+ }
6446
+
6137
6447
  function ErrorMessage({ message, showIcon = true }) {
6138
6448
  return (jsxs("div", { className: "tw-flex tw-h-squid-xl tw-flex-1 tw-items-center tw-gap-squid-xxs tw-text-status-negative", children: [showIcon ? jsx(EmojiSadIcon, {}) : null, jsx(CaptionText, { children: message })] }));
6139
6449
  }
@@ -6436,6 +6746,15 @@ function SwapStepItem({ descriptionBlocks, showStepSeparator = false, link, stat
6436
6746
  }) })] }), showStepSeparator && (jsx("span", { className: cn(separatorClassMap[status]), style: transitionStyle, children: jsx(SwapStepSeparator, {}) }))] }));
6437
6747
  }
6438
6748
 
6749
+ const borderRadiusClassMap = {
6750
+ sm: 'tw-rounded-squid-s',
6751
+ lg: 'tw-rounded-squid-m',
6752
+ };
6753
+ function Menu(_a) {
6754
+ var { children, containerClassName, contentClassName, title, displayControls, rounded = 'lg', menuRef } = _a, props = __rest(_a, ["children", "containerClassName", "contentClassName", "title", "displayControls", "rounded", "menuRef"]);
6755
+ return (jsx("div", Object.assign({}, props, { className: cn('tw-max-w-[320px]', containerClassName), ref: menuRef, children: jsxs("div", { className: cn('tw-relative tw-inline-flex tw-max-w-full tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-rounded-squid-m tw-bg-material-dark-thick tw-p-squid-xs tw-text-center tw-text-material-light-thick tw-backdrop-blur/20 tw-backdrop-saturate-150 group-data-[squid-theme-type=dark]:tw-shadow-elevation-dark-2 group-data-[squid-theme-type=light]:tw-shadow-elevation-light-2', borderRadiusClassMap[rounded], contentClassName), children: [title ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-self-stretch tw-py-squid-xxs tw-text-grey-100", children: jsx(BodyText, { size: "small", className: "tw-self-stretch !tw-leading-[10px]", children: title }) })) : null, typeof children === 'string' ? (jsx(CaptionText, { className: "tw-z-20 tw-self-stretch !tw-leading-[10px]", children: children })) : (jsx("div", { className: "tw-z-20 tw-max-w-full tw-text-caption", children: children })), displayControls ? (jsx("div", { className: "tw-z-20 tw-flex tw-flex-col tw-items-center tw-justify-center tw-gap-squid-xs tw-self-stretch tw-pt-squid-xs", children: jsx(Button, { size: "md", variant: "tertiary", label: "Learn more", className: "tw-self-stretch" }) })) : null, jsx("div", { className: cn('tw-absolute tw-z-10 tw-h-full tw-w-full tw-border tw-border-material-light-thin tw-bg-material-light-thin', borderRadiusClassMap[rounded]) })] }) })));
6756
+ }
6757
+
6439
6758
  function DropdownMenu({ dropdownRef, items, className, menuRef, isHidden = false, listClassName, }) {
6440
6759
  return (jsx("div", { ref: dropdownRef, className: "tw-relative", children: jsx(Menu, { menuRef: menuRef, rounded: "sm", containerClassName: cn('tw-absolute tw-right-0 tw-z-20', className), contentClassName: "!tw-p-0", children: !isHidden && (jsx("ul", { className: cn('tw-flex tw-max-w-full tw-flex-col tw-gap-squid-xxs tw-overflow-auto tw-px-0 tw-py-squid-xxs', listClassName), children: items.map((item) => (jsx(DropdownMenuItem, Object.assign({}, item), item.label))) })) }) }));
6441
6760
  }
@@ -6518,62 +6837,21 @@ function LogoContainer({ children }) {
6518
6837
  return (jsx("div", { className: "tw-flex tw-h-[60px] tw-w-[60px] tw-items-center tw-justify-center", children: children }));
6519
6838
  }
6520
6839
 
6521
- function MaxIcon() {
6522
- return (jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("g", { clipPath: "url(#clip0_41_20801)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM10.6508 4.74074L14.1508 7.74074C14.5701 8.10017 14.6187 8.73147 14.2593 9.15079C13.8998 9.57012 13.2685 9.61868 12.8492 9.25926L10 6.81708L7.15079 9.25926C6.73147 9.61868 6.10017 9.57012 5.74074 9.15079C5.38132 8.73147 5.42988 8.10017 5.84921 7.74074L9.34921 4.74074C9.7237 4.41975 10.2763 4.41975 10.6508 4.74074ZM14.1508 13.7407L10.6508 10.7407C10.2763 10.4198 9.7237 10.4198 9.34921 10.7407L5.84921 13.7407C5.42988 14.1002 5.38132 14.7315 5.74074 15.1508C6.10017 15.5701 6.73147 15.6187 7.15079 15.2593L10 12.8171L12.8492 15.2593C13.2685 15.6187 13.8998 15.5701 14.2593 15.1508C14.6187 14.7315 14.5701 14.1002 14.1508 13.7407Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_41_20801", children: jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
6523
- }
6524
-
6525
- function SwapInputsIcon() {
6526
- return (jsxs("svg", { width: "20", height: "21", viewBox: "0 0 20 21", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: [jsx("g", { clipPath: "url(#clip0_40_7936)", children: jsx("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M20 10.5C20 16.0228 15.5228 20.5 10 20.5C4.47715 20.5 0 16.0228 0 10.5C0 4.97715 4.47715 0.5 10 0.5C15.5228 0.5 20 4.97715 20 10.5ZM8.38268 4.57612C8.75636 4.7309 9 5.09554 9 5.5V15.5C9 16.0523 8.55228 16.5 8 16.5C7.44772 16.5 7 16.0523 7 15.5V7.91421L5.70711 9.20711C5.31658 9.59763 4.68342 9.59763 4.29289 9.20711C3.90237 8.81658 3.90237 8.18342 4.29289 7.79289L7.29289 4.79289C7.57889 4.5069 8.00901 4.42134 8.38268 4.57612ZM11 15.5C11 15.9045 11.2436 16.2691 11.6173 16.4239C11.991 16.5787 12.4211 16.4931 12.7071 16.2071L15.7071 13.2071C16.0976 12.8166 16.0976 12.1834 15.7071 11.7929C15.3166 11.4024 14.6834 11.4024 14.2929 11.7929L13 13.0858V5.5C13 4.94771 12.5523 4.5 12 4.5C11.4477 4.5 11 4.94771 11 5.5V15.5Z", fill: "currentColor" }) }), jsx("defs", { children: jsx("clipPath", { id: "clip0_40_7936", children: jsx("rect", { width: "20", height: "20", fill: "white", transform: "translate(0 0.5)" }) }) })] }));
6527
- }
6528
-
6529
- const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs';
6530
- const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
6531
- function SwapConfiguration({ priceImpactPercentage, amount, forcedAmount: _forcedAmount, balance = '0', tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, onBalanceButtonClick, address, error, criticalPriceImpactPercentage = 5, emptyAddressLabel = 'Connect wallet', }) {
6840
+ function SwapConfiguration({ amount, tokenPrice = 0, isFetching = false, chain, token, direction, onAmountChange, onWalletButtonClick, onAssetsButtonClick, address, emptyAddressLabel = 'Connect wallet', balance, criticalPriceImpactPercentage, error, priceImpactPercentage, amountUsd, }) {
6532
6841
  var _a, _b;
6533
- const [inputMode, setInputMode] = useState('token');
6534
- const [tokenAmount, setTokenAmount] = useState('0');
6535
- const forcedAmount = useMemo(() => {
6536
- var _a, _b;
6537
- if (_forcedAmount) {
6538
- return _forcedAmount;
6539
- }
6540
- if (inputMode === 'token') {
6541
- const amountLimitedToMaxDecimals = trimExtraDecimals(amount !== null && amount !== void 0 ? amount : '0', (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18);
6542
- return amountLimitedToMaxDecimals;
6543
- }
6544
- else if (inputMode === 'price') {
6545
- const tokenAmountToUsd = convertTokenAmountToUSD(amount || 0, tokenPrice);
6546
- const amountLimitedToMaxDecimals = trimExtraDecimals(tokenAmountToUsd, (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18);
6547
- return amountLimitedToMaxDecimals;
6548
- }
6549
- return '0';
6550
- }, [_forcedAmount, inputMode, amount, tokenPrice, token === null || token === void 0 ? void 0 : token.decimals]);
6551
- const swapAmountUsd = useMemo(() => {
6552
- if (tokenPrice && forcedAmount) {
6553
- return formatUSD(convertTokenAmountToUSD(forcedAmount, tokenPrice));
6554
- }
6555
- return '0';
6556
- }, [forcedAmount, tokenPrice]);
6557
- const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
6558
- ? 'tw-text-status-negative'
6559
- : 'tw-text-grey-300';
6560
- const isBalanceChipInteractive = !!onBalanceButtonClick;
6561
- const BalanceChipTag = isBalanceChipInteractive ? 'button' : 'div';
6562
- const handleSwapAmountButtonClick = useCallback(() => {
6563
- if (inputMode === 'token') {
6564
- setInputMode('price');
6565
- }
6566
- else {
6567
- setInputMode('token');
6568
- }
6569
- }, [inputMode]);
6570
- const tokenAmountFormatted = useMemo(() => {
6571
- return formatUSD(tokenAmount || 0);
6572
- }, [tokenAmount]);
6573
- return (jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-[480px] tw-overflow-hidden tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-l tw-py-squid-xs tw-leading-5 tw-text-grey-300", children: jsxs("button", { onClick: onWalletButtonClick, className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600 hover:tw-bg-material-light-thin", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { size: "small", children: ":" }), jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] })] }) }), jsx("div", { className: "tw-px-squid-l", children: jsx(AssetsButton, { onClick: onAssetsButtonClick, chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor }) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-l tw-z-10 tw-overflow-hidden", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), direction === 'from' ? (jsx(NumericInput, { balance: balance, tokenPrice: tokenPrice, forcedUpdateValue: forcedAmount, initialValue: amount, maxDecimals: (_b = token === null || token === void 0 ? void 0 : token.decimals) !== null && _b !== void 0 ? _b : 18, onParsedValueChanged: (value) => {
6574
- setTokenAmount(value);
6842
+ return (jsxs("section", { className: "tw-relative tw-h-[205px] tw-max-h-[205px] tw-w-[480px] tw-overflow-hidden tw-border-t tw-border-t-material-light-thin tw-bg-grey-900 tw-pb-squid-m", children: [jsx("header", { className: "tw-flex tw-items-center tw-gap-1 tw-px-squid-l tw-py-squid-xs tw-leading-5 tw-text-grey-300", children: jsxs("button", { onClick: onWalletButtonClick, className: "-tw-ml-squid-xs tw-flex tw-h-squid-l tw-items-center tw-gap-squid-xxs tw-rounded-squid-s tw-px-squid-xs tw-text-grey-600 hover:tw-bg-material-light-thin", children: [jsx(BodyText, { className: "tw-text-grey-500", size: "small", children: direction === 'from' ? 'Pay' : 'Receive' }), jsx(BodyText, { size: "small", children: ":" }), jsxs("div", { className: "tw-flex tw-items-center tw-gap-1", children: [jsx(BodyText, { size: "small", className: address ? 'tw-text-grey-300' : 'tw-text-royal-400', children: address ? address : emptyAddressLabel }), jsx(ChevronArrowIcon, { className: address ? 'tw-text-grey-600' : 'tw-text-royal-400' })] })] }) }), jsx("div", { className: "tw-px-squid-l", children: jsx(AssetsButton, { onClick: onAssetsButtonClick, chainImageUrl: chain === null || chain === void 0 ? void 0 : chain.iconUrl, tokenImageUrl: token === null || token === void 0 ? void 0 : token.iconUrl, tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol, chainBgColor: chain === null || chain === void 0 ? void 0 : chain.bgColor, tokenBgColor: token === null || token === void 0 ? void 0 : token.bgColor, tokenTextColor: token === null || token === void 0 ? void 0 : token.textColor }) }), isFetching && (jsx("div", { className: "tw-absolute tw-bottom-4 tw-left-squid-l tw-z-10 tw-overflow-hidden", children: jsx("div", { className: "tw-h-[94px] tw-w-[1260px] tw-animate-move-loading-cover-to-right tw-bg-dark-cover" }) })), jsx(NumericInput, { token: {
6843
+ decimals: (_a = token === null || token === void 0 ? void 0 : token.decimals) !== null && _a !== void 0 ? _a : 18,
6844
+ symbol: (_b = token === null || token === void 0 ? void 0 : token.symbol) !== null && _b !== void 0 ? _b : '',
6845
+ price: tokenPrice,
6846
+ }, onAmountChange: (value) => {
6575
6847
  onAmountChange === null || onAmountChange === void 0 ? void 0 : onAmountChange(value);
6576
- }, numericInputMode: inputMode })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-m tw-pb-[15px] tw-pt-[5px]', isFetching && 'tw-opacity-50'), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsx("span", { children: amount }) }) })), !(token === null || token === void 0 ? void 0 : token.iconUrl) ? null : (jsxs("footer", { className: cn('tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-m tw-text-grey-500', isFetching && 'tw-opacity-50'), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsxs("button", { onClick: handleSwapAmountButtonClick, className: cn(buttonClassName, interactiveChipClassName), children: [jsx(SwapInputsIcon, {}), inputMode === 'token' ? (jsx(UsdAmount, { usdAmount: swapAmountUsd })) : (jsxs("span", { className: "tw-text-grey-500", children: [jsx(CaptionText, { children: tokenAmountFormatted }), ' ', jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: clsx('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, isBalanceChipInteractive && interactiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxs(CaptionText, { children: [balance, " ", token.symbol] }), jsx(MaxIcon, {})] })] }))] }));
6848
+ }, balance: balance, criticalPriceImpactPercentage: criticalPriceImpactPercentage, error: error, formatIfVerySmall: {
6849
+ token: '0.001',
6850
+ usd: '0.01',
6851
+ }, isLoading: isFetching, maxDecimals: {
6852
+ token: 4,
6853
+ usd: 2,
6854
+ }, priceImpactPercentage: priceImpactPercentage, showDetails: !!(token === null || token === void 0 ? void 0 : token.iconUrl), direction: direction, forcedAmount: amount, amountUsd: amountUsd })] }));
6577
6855
  }
6578
6856
 
6579
6857
  function SwapProgressViewHeader({ title, description, }) {
@@ -6654,6 +6932,250 @@ function TokenPair({ firstToken, secondToken }) {
6654
6932
  }, children: [jsx("img", { className: "tw-ml-[1px] tw-aspect-square tw-w-10", src: firstToken.imageUrl }), jsx("img", { className: "tw-mr-[1px] tw-aspect-square tw-w-10", src: secondToken.imageUrl })] })] }));
6655
6933
  }
6656
6934
 
6935
+ const buttonClassName = 'tw-flex tw-h-squid-l tw-items-center tw-gap-1.5 tw-rounded-squid-s tw-px-squid-xs';
6936
+ // checks that the value includes at least one character different than `0` (zero), or `.` (dot)
6937
+ const RegExpNonZeroValue = /[^0.]/;
6938
+ const interactiveChipClassName = 'hover:tw-bg-material-light-thin';
6939
+ var InputMode;
6940
+ (function (InputMode) {
6941
+ InputMode[InputMode["TOKEN"] = 0] = "TOKEN";
6942
+ InputMode[InputMode["USD"] = 1] = "USD";
6943
+ })(InputMode || (InputMode = {}));
6944
+ function NumericInput({ priceImpactPercentage, balance = '0', error, criticalPriceImpactPercentage = 5, token, onAmountChange, forcedAmount, maxDecimals = {
6945
+ token: 4,
6946
+ usd: 2,
6947
+ }, formatIfVerySmall = {
6948
+ token: '0.001',
6949
+ usd: '0.01',
6950
+ }, showDetails = true, isLoading = false, direction, amountUsd, }) {
6951
+ var _a;
6952
+ const [inputValue, setInputValue] = useState('');
6953
+ const [inputMode, setInputMode] = useState(InputMode.TOKEN);
6954
+ useEffect(() => {
6955
+ if (forcedAmount !== undefined) {
6956
+ updateInputValue(forcedAmount);
6957
+ }
6958
+ }, [forcedAmount]);
6959
+ const updateInputValue = useCallback((newValue) => {
6960
+ const safeNewValue = trimExtraDecimals(newValue, token.decimals);
6961
+ const formattedAmount = inputMode === InputMode.TOKEN
6962
+ ? safeNewValue
6963
+ : convertTokenAmountToUSD(safeNewValue, token.price);
6964
+ setInputValue(formattedAmount);
6965
+ }, [inputMode, token.price, direction, token.decimals]);
6966
+ const onBalanceButtonClick = useCallback(() => {
6967
+ if (direction === 'from') {
6968
+ updateInputValue(balance);
6969
+ onAmountChange(balance);
6970
+ }
6971
+ }, [balance, direction, onAmountChange, updateInputValue]);
6972
+ const onAmountChangeDebounced = useCallback(debounce$1(onAmountChange, 1000), [
6973
+ onAmountChange,
6974
+ ]);
6975
+ const handleInputChange = (e) => {
6976
+ let value = e.target.value.replace(/,/g, '.'); // Replace commas with dots
6977
+ const maxDecimalsForInputType = inputMode === InputMode.TOKEN ? token.decimals : maxDecimals.usd;
6978
+ const isValidAmount = new RegExp(`^\\d*\\.?\\d{0,${maxDecimalsForInputType}}$`).test(value);
6979
+ if (isValidAmount) {
6980
+ setInputValue(value);
6981
+ // Means the user is currently typing and will add decimal, no need to fetch or parse
6982
+ // example inputs: 0.00, 0., 0, 0.0, 50. 13.00
6983
+ const isTypingDecimals = (value.includes('.') && value.endsWith('0')) || value.endsWith('.');
6984
+ if (isTypingDecimals) {
6985
+ onAmountChangeDebounced.cancel();
6986
+ }
6987
+ else {
6988
+ const { tokenRawAmount } = getRawAmounts(value);
6989
+ onAmountChangeDebounced(tokenRawAmount);
6990
+ }
6991
+ }
6992
+ };
6993
+ const handleSwitchInputMode = () => {
6994
+ if (inputValue !== '') {
6995
+ const convertedAmount = inputMode === InputMode.TOKEN
6996
+ ? convertTokenAmountToUSD(inputValue, token.price)
6997
+ : convertUSDToTokenAmount(inputValue, token.price, token.decimals);
6998
+ setInputValue(convertedAmount);
6999
+ }
7000
+ setInputMode((prevMode) => prevMode === InputMode.TOKEN ? InputMode.USD : InputMode.TOKEN);
7001
+ };
7002
+ const getRawAmounts = (amount) => {
7003
+ if (amount === '')
7004
+ return {
7005
+ usdRawAmount: '',
7006
+ tokenRawAmount: '',
7007
+ isTokenAmountVerySmall: false,
7008
+ isUsdAmountVerySmall: false,
7009
+ };
7010
+ if (inputMode === InputMode.TOKEN) {
7011
+ const usdRawAmount = convertTokenAmountToUSD(amount, token.price, maxDecimals.usd);
7012
+ const tokenRawAmount = amount;
7013
+ const isTokenAmountVerySmall = !!tokenRawAmount &&
7014
+ RegExpNonZeroValue.test(tokenRawAmount) &&
7015
+ BigNumber(tokenRawAmount).isLessThan(formatIfVerySmall.token);
7016
+ const isUsdAmountVerySmall = (!!usdRawAmount &&
7017
+ RegExpNonZeroValue.test(usdRawAmount) &&
7018
+ BigNumber(usdRawAmount).isLessThan(formatIfVerySmall.usd)) ||
7019
+ (usdRawAmount === '0' && RegExpNonZeroValue.test(tokenRawAmount));
7020
+ return {
7021
+ tokenRawAmount,
7022
+ usdRawAmount,
7023
+ isTokenAmountVerySmall,
7024
+ isUsdAmountVerySmall,
7025
+ };
7026
+ }
7027
+ else {
7028
+ const tokenRawAmount = convertUSDToTokenAmount(amount, token.price, token.decimals);
7029
+ const usdRawAmount = amount;
7030
+ const isUsdAmountVerySmall = (!!usdRawAmount &&
7031
+ RegExpNonZeroValue.test(usdRawAmount) &&
7032
+ BigNumber(usdRawAmount).isLessThan(formatIfVerySmall.usd)) ||
7033
+ (usdRawAmount === '0' && RegExpNonZeroValue.test(tokenRawAmount));
7034
+ const isTokenAmountVerySmall = !!tokenRawAmount &&
7035
+ RegExpNonZeroValue.test(tokenRawAmount) &&
7036
+ BigNumber(tokenRawAmount).isLessThan(formatIfVerySmall.token);
7037
+ return {
7038
+ tokenRawAmount,
7039
+ usdRawAmount,
7040
+ isTokenAmountVerySmall,
7041
+ isUsdAmountVerySmall,
7042
+ };
7043
+ }
7044
+ };
7045
+ const { isTokenAmountVerySmall, isUsdAmountVerySmall } = getRawAmounts(inputValue);
7046
+ const amountFormatted = useMemo(() => {
7047
+ if (inputValue === '')
7048
+ return '0';
7049
+ if (inputMode === InputMode.TOKEN) {
7050
+ if (direction === 'from') {
7051
+ return formatAmount(convertTokenAmountToUSD(inputValue, token.price, maxDecimals.usd));
7052
+ }
7053
+ else {
7054
+ return formatAmount(amountUsd !== null && amountUsd !== void 0 ? amountUsd : '0');
7055
+ }
7056
+ }
7057
+ else {
7058
+ return formatAmount(convertUSDToTokenAmount(inputValue, token.price, maxDecimals.token));
7059
+ }
7060
+ }, [inputValue, inputMode, token.price, maxDecimals, direction, amountUsd]);
7061
+ const isInteractive = direction === 'from';
7062
+ const AmountChip = isInteractive ? 'button' : 'div';
7063
+ const priceImpactClass = ((_a = Number(priceImpactPercentage)) !== null && _a !== void 0 ? _a : 0) > Number(criticalPriceImpactPercentage)
7064
+ ? 'tw-text-status-negative'
7065
+ : 'tw-text-grey-300';
7066
+ const BalanceChipTag = isInteractive ? 'button' : 'div';
7067
+ const balanceFormatted = useMemo(() => {
7068
+ return formatAmount(balance !== null && balance !== void 0 ? balance : '0');
7069
+ }, [balance]);
7070
+ return (jsxs(Fragment, { children: [isInteractive ? (jsxs("form", { className: "tw-relative tw-px-squid-m tw-pb-[15px] tw-pt-[5px] tw-text-heading-small tw-font-heading-regular", onSubmit: (e) => {
7071
+ e.preventDefault();
7072
+ }, children: [inputMode === InputMode.USD && (jsx("span", { className: "tw-absolute tw-left-[30px] tw-top-[11px] tw-leading-[43px] tw-text-grey-600", children: "$" })), jsx("input", { type: "text", value: inputValue, onChange: handleInputChange, placeholder: "0", className: cn('tw-h-[55px] tw-w-full tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-grey-300 placeholder:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin focus:tw-text-royal-400 focus:tw-outline-none', inputMode === InputMode.USD && 'tw-pl-[33px]') })] })) : (jsx("div", { className: cn('tw-w-full tw-px-squid-m tw-pb-[15px] tw-pt-[5px]', isLoading && 'tw-opacity-50'), children: jsx("div", { className: "tw-flex tw-h-[55px] tw-w-full tw-items-center tw-rounded-squid-s tw-bg-transparent tw-px-squid-xs tw-py-squid-s tw-text-heading-small tw-font-heading-regular tw-text-grey-300", children: jsx("span", { children: inputValue }) }) })), !showDetails ? null : (jsxs("footer", { className: cn('tw-flex tw-h-squid-m tw-max-h-squid-m tw-items-center tw-justify-between tw-gap-2 tw-px-squid-m tw-text-grey-500', isLoading && 'tw-opacity-50'), children: [error ? (jsx("div", { className: "tw-px-squid-xs", children: jsx(ErrorMessage, { message: error.message }) })) : (jsxs(AmountChip, { onClick: isInteractive ? handleSwitchInputMode : undefined, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsx(SwapInputsIcon, {}), inputMode === InputMode.TOKEN ? (jsx(Fragment, { children: jsxs("span", { className: "tw-flex tw-items-center tw-text-grey-500", children: [jsxs(CaptionText, { className: "tw-opacity-66", children: [isUsdAmountVerySmall ? '<' : '', "$"] }), jsx(CaptionText, { children: isUsdAmountVerySmall
7073
+ ? formatIfVerySmall.token
7074
+ : amountFormatted })] }) })) : (jsxs("span", { className: "tw-text-grey-500", children: [isTokenAmountVerySmall ? '<' : '', jsx(CaptionText, { children: isTokenAmountVerySmall
7075
+ ? formatIfVerySmall.token
7076
+ : amountFormatted }), ' ', jsx(CaptionText, { className: "tw-opacity-66", children: token.symbol })] })), priceImpactPercentage && direction === 'to' ? (jsxs("span", { className: cn('tw-flex tw-items-center', priceImpactClass), children: [jsx(ArrowTriangle, {}), jsx(CaptionText, { bold: true, children: priceImpactPercentage.toString().concat('%') })] })) : null] })), jsxs(BalanceChipTag, { onClick: onBalanceButtonClick, className: cn(buttonClassName, isInteractive && interactiveChipClassName), children: [jsx(CaptionText, { className: "tw-opacity-66", children: "Balance" }), jsxs(CaptionText, { children: [balanceFormatted, " ", token.symbol] }), jsx(MaxIcon, {})] })] }))] }));
7077
+ }
7078
+
7079
+ function SettingsSlider({ value, type, onChange, hasDecimals, max, min, }) {
7080
+ return (jsxs("div", { className: "tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-rounded-squid-xs", children: [jsx("input", { min: min !== null && min !== void 0 ? min : 0, max: max !== null && max !== void 0 ? max : 99, step: hasDecimals ? 0.1 : 1, placeholder: "0", type: "number", onChange: (e) => {
7081
+ onChange === null || onChange === void 0 ? void 0 : onChange(Number(e.target.value));
7082
+ }, className: cn('tw-relative tw-flex tw-h-full tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-bg-transparent tw-p-squid-xs tw-text-caption !tw-font-medium tw-leading-[10px] tw-text-grey-300 placeholder-shown:tw-text-grey-600 hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', type === 'percentage'
7083
+ ? 'tw-w-[84px] tw-pr-[52px] tw-text-right'
7084
+ : 'tw-w-[80px] tw-pl-[20px] tw-pr-[32px] tw-text-left'), value: value }), type === 'percentage' && jsx(PercentageDecorator, {}), type === 'amount' && jsx(AmountDecorator, {})] }));
7085
+ }
7086
+ function PercentageDecorator() {
7087
+ return (jsxs("div", { className: "tw-absolute tw-right-squid-xs tw-flex tw-items-center tw-justify-center tw-gap-squid-xs !tw-font-medium tw-leading-[10px]", children: [jsx(CaptionText, { className: "tw-translate-y-[0.5px] !tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: "%" }), jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) })] }));
7088
+ }
7089
+ function AmountDecorator() {
7090
+ return (jsxs(Fragment, { children: [jsx(CaptionText, { className: "tw-absolute tw-left-squid-xs tw-translate-y-[0.5px] !tw-font-medium !tw-leading-[10px] tw-text-grey-300", children: "$" }), jsx("div", { className: "tw-absolute tw-right-squid-xs tw-flex tw-items-center tw-justify-center tw-gap-squid-xs !tw-font-medium tw-leading-[10px]", children: jsx(Chip, { icon: jsx(ChevronGrabberVerticalIcon, { className: "tw-text-grey-900" }) }) })] }));
7091
+ }
7092
+
7093
+ const switchSizeClassMap = {
7094
+ small: 'tw-w-[36px] tw-h-squid-m tw-p-0.5',
7095
+ large: 'tw-w-[54px] tw-h-squid-l tw-p-[3px]',
7096
+ };
7097
+ const switchKnobSizeClassMap = {
7098
+ small: 'tw-w-4 tw-h-4',
7099
+ large: 'tw-w-6 tw-h-6',
7100
+ };
7101
+ const switchKnobCheckedClassMap = {
7102
+ large: {
7103
+ checked: 'tw-left-[26px]',
7104
+ unchecked: 'tw-left-[2px]',
7105
+ },
7106
+ small: {
7107
+ checked: 'tw-left-[17px]',
7108
+ unchecked: 'tw-left-[1px]',
7109
+ },
7110
+ };
7111
+ function Switch({ checked = false, onChange, size, disabled = false, }) {
7112
+ return (
7113
+ // Switch container
7114
+ jsxs("label", { className: clsx('tw-relative tw-inline-flex tw-items-center tw-justify-end tw-overflow-hidden tw-rounded-squid-m tw-border tw-border-material-light-thin tw-transition-colors',
7115
+ // size styles
7116
+ switchSizeClassMap[size],
7117
+ // checked styles
7118
+ checked ? 'tw-bg-status-positive' : 'tw-bg-grey-800',
7119
+ // disabled styles
7120
+ disabled ? 'tw-cursor-not-allowed' : 'tw-cursor-pointer'), children: [jsx("input", { disabled: disabled, checked: checked, onChange: disabled ? undefined : (e) => onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked), type: "checkbox", className: "tw-peer tw-sr-only" }), jsx("span", { style: {
7121
+ filter: 'drop-shadow(0px 5px 20px rgba(0, 0, 0, 0.33)) drop-shadow(0px 2px 5px rgba(0, 0, 0, 0.20))',
7122
+ }, className: clsx('tw-absolute tw-rounded-full tw-border tw-border-material-light-thin tw-transition-all',
7123
+ // size styles
7124
+ switchKnobSizeClassMap[size],
7125
+ // checked styles
7126
+ switchKnobCheckedClassMap[size][checked ? 'checked' : 'unchecked'], checked
7127
+ ? 'group-data-[squid-theme-type=dark]:tw-bg-grey-100 group-data-[squid-theme-type=light]:tw-bg-grey-900'
7128
+ : 'tw-bg-grey-500') })] }));
7129
+ }
7130
+
7131
+ const tooltipWidthClassMap = {
7132
+ max: 'tw-w-max',
7133
+ container: 'tw-w-full',
7134
+ };
7135
+ const tooltipThresholdClassMap = {
7136
+ xxs: 'tw-pb-squid-xxs',
7137
+ xs: 'tw-pb-squid-xs',
7138
+ s: 'tw-pb-squid-s',
7139
+ m: 'tw-pb-squid-m',
7140
+ l: 'tw-pb-squid-l',
7141
+ xl: 'tw-pb-squid-xl',
7142
+ xxl: 'tw-pb-squid-xxl',
7143
+ };
7144
+ function Tooltip({ children, tooltipContent, tooltipWidth = 'container', threshold = 'xxs', containerClassName, childrenClassName, tooltipClassName, displayDelayMs = 0, }) {
7145
+ return (jsxs("div", { className: cn('tw-relative', containerClassName), children: [jsx("div", { className: cn('tw-peer', childrenClassName), children: children }), tooltipContent ? (jsx(Menu, { style: {
7146
+ [CSS_VARS.DISPLAY_DELAYED_DURATION]: `${displayDelayMs}ms`,
7147
+ }, containerClassName: cn(
7148
+ // general styles
7149
+ 'tw-absolute tw-z-40 tw-bottom-full tw-left-1/2 -tw-translate-x-1/2',
7150
+ // visibility styles. Display only on hover
7151
+ 'tw-animate-hide peer-hover:tw-animate-display-delayed hover:tw-animate-display-delayed', tooltipWidthClassMap[tooltipWidth], tooltipThresholdClassMap[threshold], tooltipClassName), children: tooltipContent })) : null] }));
7152
+ }
7153
+
7154
+ function BoostButton({ boostMode, canToggleBoostMode = true, boostDisabledMessage = 'Boost disabled', tooltipDisplayDelayMs = 0, boostIndicatorRef, }) {
7155
+ return (jsx(Tooltip, { tooltipWidth: "max", displayDelayMs: tooltipDisplayDelayMs, tooltipContent: canToggleBoostMode ? null : boostDisabledMessage, children: jsxs("div", { className: "tw-relative tw-flex tw-h-squid-xl tw-w-[140px] tw-flex-col tw-justify-between tw-overflow-hidden tw-rounded-squid-m tw-pb-squid-xxs tw-text-grey-300 focus:tw-outline-none", children: [jsx("span", { className: cn('tw-absolute tw-left-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-r tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
7156
+ 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsx("span", { className: cn('tw-absolute tw-right-0 tw-top-0 tw-z-10 tw-h-full tw-w-8 tw-bg-gradient-to-l tw-from-grey-900 tw-to-transparent', canToggleBoostMode &&
7157
+ 'group-hover/boost-toggle:tw-from-material-light-blend-grey-900') }), jsxs("div", { ref: boostIndicatorRef, "data-boost-mode": boostMode, className: "tw-group tw-peer tw-flex tw-h-full tw-w-full tw-items-center tw-justify-between tw-transition-transform group-disabled/boost-toggle:tw-grayscale data-[boost-mode=boost]:tw-animate-move-to-left-with-spring-bounce data-[boost-mode=normal]:tw-animate-move-to-right-with-spring-bounce", children: [jsx("div", { className: "tw-w-1/2 tw-text-center group-disabled/boost-toggle:tw-grayscale", children: jsx(BodyText, { size: "small", className: "tw-text-grey-300", children: "Normal" }) }), jsxs("div", { className: "tw-w-1/2 tw-text-center group-disabled/boost-toggle:tw-grayscale", children: [jsx(BodyText, { size: "small", className: "tw-text-status-positive", children: "Boost" }), ' '] }), jsx("div", { className: "tw-absolute tw-bottom-0 tw-h-1.5 tw-w-[1.5px] tw-rounded-sm tw-bg-grey-500 tw-text-grey-500 group-data-[boost-mode=boost]:tw-left-[calc(50%-2px)] group-data-[boost-mode=normal]:tw-left-[calc(50%-6px)]", style: {
7158
+ boxShadow: generateMarkerLines(40),
7159
+ } })] }), jsx("div", { className: cn('tw-absolute tw-bottom-0.5 tw-left-[calc(50%-1.5px)] tw-z-20 tw-h-[10px] tw-w-[3px] tw-rounded-sm tw-transition-colors group-disabled/boost-toggle:tw-grayscale peer-data-[boost-mode=boost]:tw-bg-status-positive peer-data-[boost-mode=normal]:tw-bg-current'), style: {
7160
+ transitionDuration: `${ANIMATION_DURATIONS.BOOST_BUTTON}ms`,
7161
+ } })] }) }));
7162
+ }
7163
+ function generateMarkerLines(count) {
7164
+ const halfCount = Math.ceil(count / 2);
7165
+ const rightShadows = Array.from({ length: halfCount }, (_, index) => {
7166
+ return `-${(index + 1) * 6}px 0 currentColor`;
7167
+ });
7168
+ const leftShadows = Array.from({ length: halfCount }, (_, index) => {
7169
+ return `${(index + 1) * 6}px 0 currentColor`;
7170
+ });
7171
+ const allShadows = [...rightShadows, ...leftShadows];
7172
+ return allShadows.join(', ');
7173
+ }
7174
+
7175
+ function SettingsButton({ label, isSelected = false, onClick, }) {
7176
+ return (jsx("button", { onClick: onClick, className: cn('tw-flex tw-items-center tw-justify-center tw-self-stretch tw-rounded-squid-xs tw-border-2 tw-border-transparent tw-p-squid-xs hover:tw-bg-material-light-thin focus:tw-bg-material-light-thin', isSelected && 'tw-outline-royal-500'), children: jsx(CaptionText, { className: "!tw-font-medium", children: label }) }));
7177
+ }
7178
+
6657
7179
  var v$5 = "5.10.0";
6658
7180
  var fr$5 = 25;
6659
7181
  var ip$5 = 0;