From af43c4dd0df091a1b5cf03ab2d95305e6fa786e3 Mon Sep 17 00:00:00 2001 From: corbanbrook Date: Fri, 12 Jul 2024 18:09:27 +0000 Subject: [PATCH] Build: (adff797) Removing kit-connectors package and moving connectors into kit core (#99) --- ...owser-external_commonjs-proxy-oqeR_S5I.js} | 2 +- assets/{ccip-DQVuDNGZ.js => ccip-D5wfP5v-.js} | 2 +- ...e-Bz4OPKaj.js => hooks.module-C3Y13jW2.js} | 4 +- .../{index-BFuhqPpM.js => index-7aSMReUM.js} | 4 +- .../{index-BeA2wVnB.js => index-BZnoQhaP.js} | 6 +- .../{index-Di7E48vJ.js => index-Cao3Bn8F.js} | 6 +- .../{index-DWrj2Pjw.js => index-CecTsOdJ.js} | 4 +- .../{index-BF1QEdWV.js => index-Cw4Pg6FI.js} | 46986 ++++++++-------- ...ex.es-DC_84r2q.js => index.es-zKxjBZAj.js} | 8 +- index.html | 2 +- 10 files changed, 22823 insertions(+), 24201 deletions(-) rename assets/{___vite-browser-external_commonjs-proxy-DzBU9k--.js => ___vite-browser-external_commonjs-proxy-oqeR_S5I.js} (99%) rename assets/{ccip-DQVuDNGZ.js => ccip-D5wfP5v-.js} (99%) rename assets/{hooks.module-Bz4OPKaj.js => hooks.module-C3Y13jW2.js} (99%) rename assets/{index-BFuhqPpM.js => index-7aSMReUM.js} (99%) rename assets/{index-BeA2wVnB.js => index-BZnoQhaP.js} (99%) rename assets/{index-Di7E48vJ.js => index-Cao3Bn8F.js} (99%) rename assets/{index-DWrj2Pjw.js => index-CecTsOdJ.js} (99%) rename assets/{index-BF1QEdWV.js => index-Cw4Pg6FI.js} (96%) rename assets/{index.es-DC_84r2q.js => index.es-zKxjBZAj.js} (99%) diff --git a/assets/___vite-browser-external_commonjs-proxy-DzBU9k--.js b/assets/___vite-browser-external_commonjs-proxy-oqeR_S5I.js similarity index 99% rename from assets/___vite-browser-external_commonjs-proxy-DzBU9k--.js rename to assets/___vite-browser-external_commonjs-proxy-oqeR_S5I.js index fb241f8d..de275a05 100644 --- a/assets/___vite-browser-external_commonjs-proxy-DzBU9k--.js +++ b/assets/___vite-browser-external_commonjs-proxy-oqeR_S5I.js @@ -1,4 +1,4 @@ -import { g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./index-BF1QEdWV.js"; +import { g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./index-Cw4Pg6FI.js"; var events = { exports: {} }; var R = typeof Reflect === "object" ? Reflect : null; var ReflectApply = R && typeof R.apply === "function" ? R.apply : function ReflectApply2(target, receiver, args) { diff --git a/assets/ccip-DQVuDNGZ.js b/assets/ccip-D5wfP5v-.js similarity index 99% rename from assets/ccip-DQVuDNGZ.js rename to assets/ccip-D5wfP5v-.js index 63bbdb82..34c94dc5 100644 --- a/assets/ccip-DQVuDNGZ.js +++ b/assets/ccip-D5wfP5v-.js @@ -1,4 +1,4 @@ -import { h as BaseError, j as getUrl, s as stringify, k as decodeErrorResult, l as isAddressEqual, m as call, n as concat, o as encodeAbiParameters, H as HttpRequestError, q as isHex } from "./index-BF1QEdWV.js"; +import { h as BaseError, j as getUrl, s as stringify, k as decodeErrorResult, l as isAddressEqual, m as call, n as concat, o as encodeAbiParameters, H as HttpRequestError, q as isHex } from "./index-Cw4Pg6FI.js"; class OffchainLookupError extends BaseError { constructor({ callbackSelector, cause, data, extraData, sender, urls }) { var _a; diff --git a/assets/hooks.module-Bz4OPKaj.js b/assets/hooks.module-C3Y13jW2.js similarity index 99% rename from assets/hooks.module-Bz4OPKaj.js rename to assets/hooks.module-C3Y13jW2.js index fd274170..2449d36e 100644 --- a/assets/hooks.module-Bz4OPKaj.js +++ b/assets/hooks.module-C3Y13jW2.js @@ -1,5 +1,5 @@ -import { r as require$$2$1, p as process$1, c as commonjsGlobal, i as inherits_browserExports, B as Buffer$7, a as getAugmentedNamespace } from "./index-BF1QEdWV.js"; -import { e as eventsExports, r as require$$3 } from "./___vite-browser-external_commonjs-proxy-DzBU9k--.js"; +import { r as require$$2$1, p as process$1, c as commonjsGlobal, i as inherits_browserExports, B as Buffer$7, a as getAugmentedNamespace } from "./index-Cw4Pg6FI.js"; +import { e as eventsExports, r as require$$3 } from "./___vite-browser-external_commonjs-proxy-oqeR_S5I.js"; var readableBrowser = { exports: {} }; var streamBrowser = eventsExports.EventEmitter; var buffer_list; diff --git a/assets/index-BFuhqPpM.js b/assets/index-7aSMReUM.js similarity index 99% rename from assets/index-BFuhqPpM.js rename to assets/index-7aSMReUM.js index 24dfeff5..562937fb 100644 --- a/assets/index-BFuhqPpM.js +++ b/assets/index-7aSMReUM.js @@ -1,5 +1,5 @@ -import { n as ne$1, s as se$1, T as T$2, t as te$1, a as a$2, o as oe$1, R as R$1, p as p$1, y as y$1 } from "./index-Di7E48vJ.js"; -import "./index-BF1QEdWV.js"; +import { n as ne$1, s as se$1, T as T$2, t as te$1, a as a$2, o as oe$1, R as R$1, p as p$1, y as y$1 } from "./index-Cao3Bn8F.js"; +import "./index-Cw4Pg6FI.js"; function addUniqueItem(array, item) { array.indexOf(item) === -1 && array.push(item); } diff --git a/assets/index-BeA2wVnB.js b/assets/index-BZnoQhaP.js similarity index 99% rename from assets/index-BeA2wVnB.js rename to assets/index-BZnoQhaP.js index a076a2c5..b8d03fb9 100644 --- a/assets/index-BeA2wVnB.js +++ b/assets/index-BZnoQhaP.js @@ -1,6 +1,6 @@ -import { c as commonjsGlobal, b as bnExports, B as Buffer, a as getAugmentedNamespace, p as process$1, t as tslib_es6, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-BF1QEdWV.js"; -import { s as sha_jsExports, a as require$$1$1, b as require$$2, r as require$$0$1, j as js } from "./hooks.module-Bz4OPKaj.js"; -import { e as eventsExports } from "./___vite-browser-external_commonjs-proxy-DzBU9k--.js"; +import { c as commonjsGlobal, b as bnExports, B as Buffer, a as getAugmentedNamespace, p as process$1, t as tslib_es6, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-Cw4Pg6FI.js"; +import { s as sha_jsExports, a as require$$1$1, b as require$$2, r as require$$0$1, j as js } from "./hooks.module-C3Y13jW2.js"; +import { e as eventsExports } from "./___vite-browser-external_commonjs-proxy-oqeR_S5I.js"; function _mergeNamespaces(n, m) { for (var i = 0; i < m.length; i++) { const e = m[i]; diff --git a/assets/index-Di7E48vJ.js b/assets/index-Cao3Bn8F.js similarity index 99% rename from assets/index-Di7E48vJ.js rename to assets/index-Cao3Bn8F.js index c90f3c59..dbba6d43 100644 --- a/assets/index-Di7E48vJ.js +++ b/assets/index-Cao3Bn8F.js @@ -1,5 +1,5 @@ -const __vite__fileDeps=["./index-BFuhqPpM.js","./index-BF1QEdWV.js","./index-KxIcnz1U.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); -import { _ as __vitePreload } from "./index-BF1QEdWV.js"; +const __vite__fileDeps=["./index-7aSMReUM.js","./index-Cw4Pg6FI.js","./index-KxIcnz1U.css"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); +import { _ as __vitePreload } from "./index-Cw4Pg6FI.js"; const t = Symbol(); const s = Object.getPrototypeOf, c$1 = /* @__PURE__ */ new WeakMap(), l = (e) => e && (c$1.has(e) ? c$1.get(e) : s(e) === Object.prototype || s(e) === Array.prototype), y$1 = (e) => l(e) && e[t] || null, h = (e, t2 = true) => { c$1.set(e, t2); @@ -487,7 +487,7 @@ class d { } async initUi() { if (typeof window < "u") { - await __vitePreload(() => import("./index-BFuhqPpM.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url); + await __vitePreload(() => import("./index-7aSMReUM.js"), true ? __vite__mapDeps([0,1,2]) : void 0, import.meta.url); const e = document.createElement("wcm-modal"); document.body.insertAdjacentElement("beforeend", e), p.setIsUiLoaded(true); } diff --git a/assets/index-DWrj2Pjw.js b/assets/index-CecTsOdJ.js similarity index 99% rename from assets/index-DWrj2Pjw.js rename to assets/index-CecTsOdJ.js index 2cf0dbfd..fb5be37f 100644 --- a/assets/index-DWrj2Pjw.js +++ b/assets/index-CecTsOdJ.js @@ -1,5 +1,5 @@ -import { B as Buffer, c as commonjsGlobal, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-BF1QEdWV.js"; -import { j as js, s as sha_jsExports, r as require$$0, a as require$$1, b as require$$2 } from "./hooks.module-Bz4OPKaj.js"; +import { B as Buffer, c as commonjsGlobal, e as eventemitter3Exports, g as getDefaultExportFromCjs } from "./index-Cw4Pg6FI.js"; +import { j as js, s as sha_jsExports, r as require$$0, a as require$$1, b as require$$2 } from "./hooks.module-C3Y13jW2.js"; function _mergeNamespaces(n, m) { for (var i = 0; i < m.length; i++) { const e = m[i]; diff --git a/assets/index-BF1QEdWV.js b/assets/index-Cw4Pg6FI.js similarity index 96% rename from assets/index-BF1QEdWV.js rename to assets/index-Cw4Pg6FI.js index 965cda2f..c54dc2d7 100644 --- a/assets/index-BF1QEdWV.js +++ b/assets/index-Cw4Pg6FI.js @@ -1,4 +1,4 @@ -const __vite__fileDeps=["./index-DWrj2Pjw.js","./hooks.module-Bz4OPKaj.js","./___vite-browser-external_commonjs-proxy-DzBU9k--.js","./index-BeA2wVnB.js","./index.es-DC_84r2q.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); +const __vite__fileDeps=["./index-CecTsOdJ.js","./hooks.module-C3Y13jW2.js","./___vite-browser-external_commonjs-proxy-oqeR_S5I.js","./index-BZnoQhaP.js","./index.es-zKxjBZAj.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]); var __defProp = Object.defineProperty; var __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; var __publicField = (obj, key2, value) => { @@ -37,8 +37,8 @@ var __privateMethod = (obj, member, method) => { }; var _focused, _cleanup, _setup, _a, _online, _cleanup2, _setup2, _b, _gcTimeout, _c, _initialState, _revertState, _cache, _retryer, _defaultOptions, _abortSignalConsumed, _dispatch, dispatch_fn, _d, _queries, _e, _observers, _mutationCache, _retryer2, _dispatch2, dispatch_fn2, _f, _mutations, _mutationId, _g, _queryCache, _mutationCache2, _defaultOptions2, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline, _h, _client, _currentQuery, _currentQueryInitialState, _currentResult, _currentResultState, _currentResultOptions, _selectError, _selectFn, _selectResult, _lastQueryWithDefinedData, _staleTimeoutId, _refetchIntervalId, _currentRefetchInterval, _trackedProps, _executeFetch, executeFetch_fn, _updateStaleTimeout, updateStaleTimeout_fn, _computeRefetchInterval, computeRefetchInterval_fn, _updateRefetchInterval, updateRefetchInterval_fn, _updateTimers, updateTimers_fn, _clearStaleTimeout, clearStaleTimeout_fn, _clearRefetchInterval, clearRefetchInterval_fn, _updateQuery, updateQuery_fn, _notify, notify_fn, _i, _client2, _currentResult2, _currentMutation, _mutateOptions, _updateResult, updateResult_fn, _notify2, notify_fn2, _j; function _mergeNamespaces(n2, m2) { - for (var i2 = 0; i2 < m2.length; i2++) { - const e2 = m2[i2]; + for (var i = 0; i < m2.length; i++) { + const e2 = m2[i]; if (typeof e2 !== "string" && !Array.isArray(e2)) { for (const k2 in e2) { if (k2 !== "default" && !(k2 in n2)) { @@ -8865,8 +8865,8 @@ function shallowCompare(next, prev) { const prevLength = prev.length; if (prevLength !== next.length) return false; - for (let i2 = 0; i2 < prevLength; i2++) { - if (prev[i2] !== next[i2]) + for (let i = 0; i < prevLength; i++) { + if (prev[i] !== next[i]) return false; } return true; @@ -8925,8 +8925,8 @@ function createRenderStep(runNextFrame2) { toRunNextFrame.length = 0; numToRun = toRun.length; if (numToRun) { - for (let i2 = 0; i2 < numToRun; i2++) { - const callback = toRun[i2]; + for (let i = 0; i < numToRun; i++) { + const callback = toRun[i]; callback(frameData2); if (toKeepAlive.has(callback)) { step.schedule(callback); @@ -9018,8 +9018,8 @@ class SubscriptionManager { if (numSubscriptions === 1) { this.subscriptions[0](a2, b2, c2); } else { - for (let i2 = 0; i2 < numSubscriptions; i2++) { - const handler = this.subscriptions[i2]; + for (let i = 0; i < numSubscriptions; i++) { + const handler = this.subscriptions[i]; handler && handler(a2, b2, c2); } } @@ -9410,8 +9410,8 @@ function createTransformer(source) { const numValues = values.length; return (v3) => { let output2 = tokenised; - for (let i2 = 0; i2 < numValues; i2++) { - output2 = output2.replace(i2 < numColors ? colorToken : numberToken, i2 < numColors ? color.transform(v3[i2]) : sanitize(v3[i2])); + for (let i = 0; i < numValues; i++) { + output2 = output2.replace(i < numColors ? colorToken : numberToken, i < numColors ? color.transform(v3[i]) : sanitize(v3[i])); } return output2; }; @@ -9515,8 +9515,8 @@ function checkTargetForNewValues(visualElement, target, origin) { const numNewValues = newValueKeys.length; if (!numNewValues) return; - for (let i2 = 0; i2 < numNewValues; i2++) { - const key2 = newValueKeys[i2]; + for (let i = 0; i < numNewValues; i++) { + const key2 = newValueKeys[i]; const targetValue = target[key2]; let value = null; if (Array.isArray(targetValue)) { @@ -9646,10 +9646,10 @@ function getMixer(origin, target) { const mixArray = (from, to) => { const output2 = [...from]; const numValues = output2.length; - const blendValue = from.map((fromThis, i2) => getMixer(fromThis, to[i2])); + const blendValue = from.map((fromThis, i) => getMixer(fromThis, to[i])); return (v3) => { - for (let i2 = 0; i2 < numValues; i2++) { - output2[i2] = blendValue[i2](v3); + for (let i = 0; i < numValues; i++) { + output2[i] = blendValue[i](v3); } return output2; }; @@ -9705,10 +9705,10 @@ function createMixers(output2, ease, customMixer) { const mixers = []; const mixerFactory = customMixer || detectMixerFactory(output2[0]); const numMixers = output2.length - 1; - for (let i2 = 0; i2 < numMixers; i2++) { - let mixer = mixerFactory(output2[i2], output2[i2 + 1]); + for (let i = 0; i < numMixers; i++) { + let mixer = mixerFactory(output2[i], output2[i + 1]); if (ease) { - const easingFunction = Array.isArray(ease) ? ease[i2] : ease; + const easingFunction = Array.isArray(ease) ? ease[i] : ease; mixer = pipe(easingFunction, mixer); } mixers.push(mixer); @@ -9726,15 +9726,15 @@ function interpolate(input2, output2, { clamp: isClamp = true, ease, mixer } = { const mixers = createMixers(output2, ease, mixer); const numMixers = mixers.length; const interpolator = (v3) => { - let i2 = 0; + let i = 0; if (numMixers > 1) { - for (; i2 < input2.length - 2; i2++) { - if (v3 < input2[i2 + 1]) + for (; i < input2.length - 2; i++) { + if (v3 < input2[i + 1]) break; } } - const progressInRange = progress(input2[i2], input2[i2 + 1], v3); - return mixers[i2](progressInRange); + const progressInRange = progress(input2[i], input2[i + 1], v3); + return mixers[i](progressInRange); }; return isClamp ? (v3) => interpolator(clamp$3(input2[0], input2[inputLength - 1], v3)) : interpolator; } @@ -9745,7 +9745,7 @@ const subdivisionMaxIterations = 12; function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) { let currentX; let currentT; - let i2 = 0; + let i = 0; do { currentT = lowerBound + (upperBound - lowerBound) / 2; currentX = calcBezier(currentT, mX1, mX2) - x; @@ -9754,7 +9754,7 @@ function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) { } else { lowerBound = currentT; } - } while (Math.abs(currentX) > subdivisionPrecision && ++i2 < subdivisionMaxIterations); + } while (Math.abs(currentX) > subdivisionPrecision && ++i < subdivisionMaxIterations); return currentT; } function cubicBezier(mX1, mY1, mX2, mY2) { @@ -9802,7 +9802,7 @@ function defaultEasing(values, easing) { } function defaultOffset(values) { const numValues = values.length; - return values.map((_value, i2) => i2 !== 0 ? i2 / (numValues - 1) : 0); + return values.map((_value, i) => i !== 0 ? i / (numValues - 1) : 0); } function convertOffsetToTimes(offset2, duration) { return offset2.map((o2) => o2 * duration); @@ -9901,7 +9901,7 @@ function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1 }) { const rootIterations = 12; function approximateRoot(envelope, derivative, initialGuess) { let result = initialGuess; - for (let i2 = 1; i2 < rootIterations; i2++) { + for (let i = 1; i < rootIterations; i++) { result = result - envelope(result) / derivative(result); } return result; @@ -10573,12 +10573,12 @@ function animateTarget(visualElement, definition, { delay: delay2 = 0, transitio function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) { const animations2 = []; const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren; - const generateStaggerDuration = staggerDirection === 1 ? (i2 = 0) => i2 * staggerChildren : (i2 = 0) => maxStaggerDuration - i2 * staggerChildren; - Array.from(visualElement.variantChildren).sort(sortByTreeOrder).forEach((child, i2) => { + const generateStaggerDuration = staggerDirection === 1 ? (i = 0) => i * staggerChildren : (i = 0) => maxStaggerDuration - i * staggerChildren; + Array.from(visualElement.variantChildren).sort(sortByTreeOrder).forEach((child, i) => { child.notify("AnimationStart", variant); animations2.push(animateVariant(child, variant, { ...options, - delay: delayChildren + generateStaggerDuration(i2) + delay: delayChildren + generateStaggerDuration(i) }).then(() => child.notify("AnimationComplete", variant))); }); return Promise.all(animations2); @@ -10627,14 +10627,14 @@ function createAnimationState(visualElement) { const removedKeys = /* @__PURE__ */ new Set(); let encounteredKeys = {}; let removedVariantIndex = Infinity; - for (let i2 = 0; i2 < numAnimationTypes; i2++) { - const type = reversePriorityOrder[i2]; + for (let i = 0; i < numAnimationTypes; i++) { + const type = reversePriorityOrder[i]; const typeState = state[type]; const prop = props[type] !== void 0 ? props[type] : context2[type]; const propIsVariant = isVariantLabel(prop); const activeDelta = type === changedActiveType ? typeState.isActive : null; if (activeDelta === false) - removedVariantIndex = i2; + removedVariantIndex = i; let isInherited = prop === context2[type] && prop !== props[type] && propIsVariant; if (isInherited && isInitialRender && visualElement.manuallyAnimateOnMount) { isInherited = false; @@ -10651,7 +10651,7 @@ function createAnimationState(visualElement) { const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop); let shouldAnimateType = variantDidChange || // If we're making this variant active, we want to always make it active type === changedActiveType && typeState.isActive && !isInherited && propIsVariant || // If we removed a higher-priority variant (i is in reverse order) - i2 > removedVariantIndex && propIsVariant; + i > removedVariantIndex && propIsVariant; const definitionList = Array.isArray(prop) ? prop : [prop]; let resolvedValues = definitionList.reduce(buildResolvedTypeValues, {}); if (activeDelta === false) @@ -10883,15 +10883,15 @@ function getVelocity(history, timeDelta) { if (history.length < 2) { return { x: 0, y: 0 }; } - let i2 = history.length - 1; + let i = history.length - 1; let timestampedPoint = null; const lastPoint = lastDevicePoint(history); - while (i2 >= 0) { - timestampedPoint = history[i2]; + while (i >= 0) { + timestampedPoint = history[i]; if (lastPoint.timestamp - timestampedPoint.timestamp > secondsToMilliseconds(timeDelta)) { break; } - i2--; + i--; } if (!timestampedPoint) { return { x: 0, y: 0 }; @@ -11105,8 +11105,8 @@ function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) { treeScale.x = treeScale.y = 1; let node; let delta; - for (let i2 = 0; i2 < treeLength; i2++) { - node = treePath[i2]; + for (let i = 0; i < treeLength; i++) { + node = treePath[i]; delta = node.projectionDelta; if (((_b2 = (_a2 = node.instance) === null || _a2 === void 0 ? void 0 : _a2.style) === null || _b2 === void 0 ? void 0 : _b2.display) === "contents") continue; @@ -11677,11 +11677,11 @@ const checkAndConvertChangedValueTypes = (visualElement, target, origin = {}, tr const fromIndex = to[0] === null ? 1 : 0; from = to[fromIndex]; fromType = findDimensionValueType(from); - for (let i2 = fromIndex; i2 < numKeyframes; i2++) { + for (let i = fromIndex; i < numKeyframes; i++) { if (!toType) { - toType = findDimensionValueType(to[i2]); + toType = findDimensionValueType(to[i]); } else { - invariant(findDimensionValueType(to[i2]) === toType); + invariant(findDimensionValueType(to[i]) === toType); } } } else { @@ -11909,8 +11909,8 @@ class VisualElement { } loadFeatures({ children, ...renderedProps }, isStrict, preloadedFeatures, projectionId, ProjectionNodeConstructor, initialLayoutGroupConfig) { const features = []; - for (let i2 = 0; i2 < numFeatures; i2++) { - const name2 = featureNames[i2]; + for (let i = 0; i < numFeatures; i++) { + const name2 = featureNames[i]; const { isEnabled: isEnabled2, Component: Component2 } = featureDefinitions[name2]; if (isEnabled2(renderedProps) && Component2) { features.push(reactExports.createElement(Component2, { @@ -11981,8 +11981,8 @@ class VisualElement { } const prevProps = this.props; this.props = props; - for (let i2 = 0; i2 < propEventHandlers.length; i2++) { - const key2 = propEventHandlers[i2]; + for (let i = 0; i < propEventHandlers.length; i++) { + const key2 = propEventHandlers[i]; if (this.propEventSubscriptions[key2]) { this.propEventSubscriptions[key2](); delete this.propEventSubscriptions[key2]; @@ -12032,8 +12032,8 @@ class VisualElement { return context22; } const context2 = {}; - for (let i2 = 0; i2 < numVariantProps; i2++) { - const name2 = variantProps[i2]; + for (let i = 0; i < numVariantProps; i++) { + const name2 = variantProps[i]; const prop = this.props[name2]; if (isVariantLabel(prop) || prop === false) { context2[name2] = prop; @@ -12295,10 +12295,10 @@ const correctBoxShadow = { shadow[3 + offset2] /= averageScale; let output2 = template(shadow); if (containsCSSVariables) { - let i2 = 0; + let i = 0; output2 = output2.replace(varToken, () => { - const cssVariable = cssVariables[i2]; - i2++; + const cssVariable = cssVariables[i]; + i++; return cssVariable; }); } @@ -12433,8 +12433,8 @@ function mixValues(target, follow, lead, progress2, shouldCrossfadeOpacity, isOn } else if (isOnlyMember) { target.opacity = mix(follow.opacity !== void 0 ? follow.opacity : 1, lead.opacity !== void 0 ? lead.opacity : 1, progress2); } - for (let i2 = 0; i2 < numBorders; i2++) { - const borderLabel = `border${borders[i2]}Radius`; + for (let i = 0; i < numBorders; i++) { + const borderLabel = `border${borders[i]}Radius`; let followRadius = getRadius(follow, borderLabel); let leadRadius = getRadius(lead, borderLabel); if (followRadius === void 0 && leadRadius === void 0) @@ -12545,8 +12545,8 @@ class NodeStack { if (indexOfNode === 0) return false; let prevLead; - for (let i2 = indexOfNode; i2 >= 0; i2--) { - const member = this.members[i2]; + for (let i = indexOfNode; i >= 0; i--) { + const member = this.members[i]; if (member.isPresent !== false) { prevLead = member; break; @@ -12701,8 +12701,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro this.parent = parent2; this.depth = parent2 ? parent2.depth + 1 : 0; elementId && this.root.registerPotentialNode(elementId, this); - for (let i2 = 0; i2 < this.path.length; i2++) { - this.path[i2].shouldResetTransform = true; + for (let i = 0; i < this.path.length; i++) { + this.path[i].shouldResetTransform = true; } if (this.root === this) this.nodes = new FlatTree(); @@ -12842,8 +12842,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro if (this.isLayoutDirty) return; this.isLayoutDirty = true; - for (let i2 = 0; i2 < this.path.length; i2++) { - const node = this.path[i2]; + for (let i = 0; i < this.path.length; i++) { + const node = this.path[i]; node.shouldResetTransform = true; node.updateScroll("snapshot"); if (node.options.layoutRoot) { @@ -12914,8 +12914,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro return; } if (this.resumeFrom && !this.resumeFrom.instance) { - for (let i2 = 0; i2 < this.path.length; i2++) { - const node = this.path[i2]; + for (let i = 0; i < this.path.length; i++) { + const node = this.path[i]; node.updateScroll(); } } @@ -12985,8 +12985,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro removeElementScroll(box) { const boxWithoutScroll = createBox(); copyBoxInto(boxWithoutScroll, box); - for (let i2 = 0; i2 < this.path.length; i2++) { - const node = this.path[i2]; + for (let i = 0; i < this.path.length; i++) { + const node = this.path[i]; const { scroll: scroll2, options } = node; if (node !== this.root && scroll2 && options.layoutScroll) { if (scroll2.isRoot) { @@ -13006,8 +13006,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro applyTransform(box, transformOnly = false) { const withTransforms = createBox(); copyBoxInto(withTransforms, box); - for (let i2 = 0; i2 < this.path.length; i2++) { - const node = this.path[i2]; + for (let i = 0; i < this.path.length; i++) { + const node = this.path[i]; if (!transformOnly && node.options.layoutScroll && node.scroll && node !== node.root) { transformBox(withTransforms, { x: -node.scroll.offset.x, @@ -13027,8 +13027,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro var _a2; const boxWithoutTransform = createBox(); copyBoxInto(boxWithoutTransform, box); - for (let i2 = 0; i2 < this.path.length; i2++) { - const node = this.path[i2]; + for (let i = 0; i < this.path.length; i++) { + const node = this.path[i]; if (!node.instance) continue; if (!hasTransform(node.latestValues)) @@ -13354,8 +13354,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro if (!hasRotate) return; const resetValues = {}; - for (let i2 = 0; i2 < transformAxes.length; i2++) { - const key2 = "rotate" + transformAxes[i2]; + for (let i = 0; i < transformAxes.length; i++) { + const key2 = "rotate" + transformAxes[i]; if (latestValues[key2]) { resetValues[key2] = latestValues[key2]; visualElement.setStaticValue(key2, 0); @@ -13418,8 +13418,8 @@ function createProjectionNode({ attachResizeListener, defaultParent, measureScro const corrected = styles.transform === "none" ? valuesToRender[key2] : correct(valuesToRender[key2], lead); if (applyTo) { const num = applyTo.length; - for (let i2 = 0; i2 < num; i2++) { - styles[applyTo[i2]] = corrected; + for (let i = 0; i < num; i++) { + styles[applyTo[i]] = corrected; } } else { styles[key2] = corrected; @@ -13567,9 +13567,9 @@ const defaultLayoutTransition = { }; function mountNodeEarly(node, elementId) { let searchNode = node.root; - for (let i2 = node.path.length - 1; i2 >= 0; i2--) { - if (Boolean(node.path[i2].instance)) { - searchNode = node.path[i2]; + for (let i = node.path.length - 1; i >= 0; i--) { + if (Boolean(node.path[i].instance)) { + searchNode = node.path[i]; break; } } @@ -13789,8 +13789,8 @@ const AnimatePresence = ({ children, custom: custom2, initial = true, onExitComp const presentKeys = presentChildren.current.map(getChildKey); const targetKeys = filteredChildren.map(getChildKey); const numPresent = presentKeys.length; - for (let i2 = 0; i2 < numPresent; i2++) { - const key2 = presentKeys[i2]; + for (let i = 0; i < numPresent; i++) { + const key2 = presentKeys[i]; if (targetKeys.indexOf(key2) === -1) { exiting.add(key2); } @@ -13847,8 +13847,8 @@ function __extends$1(d2, b2) { } var __assign$3 = function() { __assign$3 = Object.assign || function __assign2(t2) { - for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { - s2 = arguments[i2]; + for (var s2, i = 1, n2 = arguments.length; i < n2; i++) { + s2 = arguments[i]; for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t2[p2] = s2[p2]; @@ -13863,9 +13863,9 @@ function __rest$2(s2, e2) { if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2]; if (s2 != null && typeof Object.getOwnPropertySymbols === "function") - for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) { - if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2])) - t2[p2[i2]] = s2[p2[i2]]; + for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) { + if (e2.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i])) + t2[p2[i]] = s2[p2[i]]; } return t2; } @@ -13874,8 +13874,8 @@ function __decorate$1(decorators, target, key2, desc) { if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r2 = Reflect.decorate(decorators, target, key2, desc); else - for (var i2 = decorators.length - 1; i2 >= 0; i2--) - if (d2 = decorators[i2]) + for (var i = decorators.length - 1; i >= 0; i--) + if (d2 = decorators[i]) r2 = (c2 < 3 ? d2(r2) : c2 > 3 ? d2(target, key2, r2) : d2(target, key2)) || r2; return c2 > 3 && r2 && Object.defineProperty(target, key2, r2), r2; } @@ -13894,7 +13894,7 @@ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, e var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); var _, done = false; - for (var i2 = decorators.length - 1; i2 >= 0; i2--) { + for (var i = decorators.length - 1; i >= 0; i--) { var context2 = {}; for (var p2 in contextIn) context2[p2] = p2 === "access" ? {} : contextIn[p2]; @@ -13905,7 +13905,7 @@ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, e throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f2 || null)); }; - var result = (0, decorators[i2])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key2], context2); + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key2], context2); if (kind === "accessor") { if (result === void 0) continue; @@ -13930,8 +13930,8 @@ function __esDecorate(ctor, descriptorIn, decorators, contextIn, initializers, e } function __runInitializers(thisArg, initializers, value) { var useValue = arguments.length > 2; - for (var i2 = 0; i2 < initializers.length; i2++) { - value = useValue ? initializers[i2].call(thisArg, value) : initializers[i2].call(thisArg); + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); } return useValue ? value : void 0; } @@ -14071,15 +14071,15 @@ function __exportStar$1(m2, o2) { __createBinding$1(o2, m2, p2); } function __values$1(o2) { - var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i2 = 0; + var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i = 0; if (m2) return m2.call(o2); if (o2 && typeof o2.length === "number") return { next: function() { - if (o2 && i2 >= o2.length) + if (o2 && i >= o2.length) o2 = void 0; - return { value: o2 && o2[i2++], done: !o2 }; + return { value: o2 && o2[i++], done: !o2 }; } }; throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined."); @@ -14088,16 +14088,16 @@ function __read$1(o2, n2) { var m2 = typeof Symbol === "function" && o2[Symbol.iterator]; if (!m2) return o2; - var i2 = m2.call(o2), r2, ar = [], e2; + var i = m2.call(o2), r2, ar = [], e2; try { - while ((n2 === void 0 || n2-- > 0) && !(r2 = i2.next()).done) + while ((n2 === void 0 || n2-- > 0) && !(r2 = i.next()).done) ar.push(r2.value); } catch (error) { e2 = { error }; } finally { try { - if (r2 && !r2.done && (m2 = i2["return"])) - m2.call(i2); + if (r2 && !r2.done && (m2 = i["return"])) + m2.call(i); } finally { if (e2) throw e2.error; @@ -14106,25 +14106,25 @@ function __read$1(o2, n2) { return ar; } function __spread$1() { - for (var ar = [], i2 = 0; i2 < arguments.length; i2++) - ar = ar.concat(__read$1(arguments[i2])); + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read$1(arguments[i])); return ar; } function __spreadArrays$1() { - for (var s2 = 0, i2 = 0, il2 = arguments.length; i2 < il2; i2++) - s2 += arguments[i2].length; - for (var r2 = Array(s2), k2 = 0, i2 = 0; i2 < il2; i2++) - for (var a2 = arguments[i2], j2 = 0, jl2 = a2.length; j2 < jl2; j2++, k2++) + for (var s2 = 0, i = 0, il2 = arguments.length; i < il2; i++) + s2 += arguments[i].length; + for (var r2 = Array(s2), k2 = 0, i = 0; i < il2; i++) + for (var a2 = arguments[i], j2 = 0, jl2 = a2.length; j2 < jl2; j2++, k2++) r2[k2] = a2[j2]; return r2; } function __spreadArray$1(to, from, pack2) { if (pack2 || arguments.length === 2) - for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) { - if (ar || !(i2 in from)) { + for (var i = 0, l2 = from.length, ar; i < l2; i++) { + if (ar || !(i in from)) { if (!ar) - ar = Array.prototype.slice.call(from, 0, i2); - ar[i2] = from[i2]; + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); @@ -14135,13 +14135,13 @@ function __await$1(v3) { function __asyncGenerator$1(thisArg, _arguments, generator) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var g2 = generator.apply(thisArg, _arguments || []), i2, q2 = []; - return i2 = {}, verb("next"), verb("throw"), verb("return"), i2[Symbol.asyncIterator] = function() { + var g2 = generator.apply(thisArg, _arguments || []), i, q2 = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { return this; - }, i2; + }, i; function verb(n2) { if (g2[n2]) - i2[n2] = function(v3) { + i[n2] = function(v3) { return new Promise(function(a2, b2) { q2.push([n2, v3, a2, b2]) > 1 || resume(n2, v3); }); @@ -14169,14 +14169,14 @@ function __asyncGenerator$1(thisArg, _arguments, generator) { } } function __asyncDelegator$1(o2) { - var i2, p2; - return i2 = {}, verb("next"), verb("throw", function(e2) { + var i, p2; + return i = {}, verb("next"), verb("throw", function(e2) { throw e2; - }), verb("return"), i2[Symbol.iterator] = function() { + }), verb("return"), i[Symbol.iterator] = function() { return this; - }, i2; + }, i; function verb(n2, f2) { - i2[n2] = o2[n2] ? function(v3) { + i[n2] = o2[n2] ? function(v3) { return (p2 = !p2) ? { value: __await$1(o2[n2](v3)), done: false } : f2 ? f2(v3) : v3; } : f2; } @@ -14184,12 +14184,12 @@ function __asyncDelegator$1(o2) { function __asyncValues$1(o2) { if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined."); - var m2 = o2[Symbol.asyncIterator], i2; - return m2 ? m2.call(o2) : (o2 = typeof __values$1 === "function" ? __values$1(o2) : o2[Symbol.iterator](), i2 = {}, verb("next"), verb("throw"), verb("return"), i2[Symbol.asyncIterator] = function() { + var m2 = o2[Symbol.asyncIterator], i; + return m2 ? m2.call(o2) : (o2 = typeof __values$1 === "function" ? __values$1(o2) : o2[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { return this; - }, i2); + }, i); function verb(n2) { - i2[n2] = o2[n2] && function(v3) { + i[n2] = o2[n2] && function(v3) { return new Promise(function(resolve, reject) { v3 = o2[n2](v3), settle(resolve, reject, v3.done, v3.value); }); @@ -14514,16 +14514,16 @@ function toPrimitive$1(t2, r2) { return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r2 || "default"); - if ("object" != typeof i2) - return i2; + var i = e2.call(t2, r2 || "default"); + if ("object" != typeof i) + return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r2 ? String : Number)(t2); } function toPropertyKey$1(t2) { - var i2 = toPrimitive$1(t2, "string"); - return "symbol" == typeof i2 ? i2 : String(i2); + var i = toPrimitive$1(t2, "string"); + return "symbol" == typeof i ? i : String(i); } function _defineProperty$1$1(obj, key2, value) { key2 = toPropertyKey$1(key2); @@ -14758,16 +14758,16 @@ function toPrimitive(t2, r2) { return t2; var e2 = t2[Symbol.toPrimitive]; if (void 0 !== e2) { - var i2 = e2.call(t2, r2 || "default"); - if ("object" != typeof i2) - return i2; + var i = e2.call(t2, r2 || "default"); + if ("object" != typeof i) + return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r2 ? String : Number)(t2); } function toPropertyKey(t2) { - var i2 = toPrimitive(t2, "string"); - return "symbol" == typeof i2 ? i2 : String(i2); + var i = toPrimitive(t2, "string"); + return "symbol" == typeof i ? i : String(i); } function _defineProperty$2(obj, key2, value) { key2 = toPropertyKey(key2); @@ -17263,11 +17263,11 @@ const computePosition$1$1 = async (reference, floating, config2) => { let statefulPlacement = placement; let middlewareData = {}; let resetCount = 0; - for (let i2 = 0; i2 < validMiddleware.length; i2++) { + for (let i = 0; i < validMiddleware.length; i++) { const { name: name2, fn - } = validMiddleware[i2]; + } = validMiddleware[i]; const { x: nextX, y: nextY, @@ -17314,7 +17314,7 @@ const computePosition$1$1 = async (reference, floating, config2) => { y: y2 } = computeCoordsFromPlacement$1(rects, statefulPlacement, rtl)); } - i2 = -1; + i = -1; } } return { @@ -18587,15 +18587,15 @@ function deepEqual$2(a2, b2) { return true; } let length; - let i2; + let i; let keys; if (a2 && b2 && typeof a2 === "object") { if (Array.isArray(a2)) { length = a2.length; if (length !== b2.length) return false; - for (i2 = length; i2-- !== 0; ) { - if (!deepEqual$2(a2[i2], b2[i2])) { + for (i = length; i-- !== 0; ) { + if (!deepEqual$2(a2[i], b2[i])) { return false; } } @@ -18606,13 +18606,13 @@ function deepEqual$2(a2, b2) { if (length !== Object.keys(b2).length) { return false; } - for (i2 = length; i2-- !== 0; ) { - if (!{}.hasOwnProperty.call(b2, keys[i2])) { + for (i = length; i-- !== 0; ) { + if (!{}.hasOwnProperty.call(b2, keys[i])) { return false; } } - for (i2 = length; i2-- !== 0; ) { - const key2 = keys[i2]; + for (i = length; i-- !== 0; ) { + const key2 = keys[i]; if (key2 === "_owner" && a2.$$typeof) { continue; } @@ -19482,8 +19482,8 @@ var hideOthers$1 = function(originalTarget, parentNode, markerName) { }; var __assign$2 = function() { __assign$2 = Object.assign || function __assign2(t2) { - for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { - s2 = arguments[i2]; + for (var s2, i = 1, n2 = arguments.length; i < n2; i++) { + s2 = arguments[i]; for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t2[p2] = s2[p2]; @@ -19498,18 +19498,18 @@ function __rest$1(s2, e2) { if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) t2[p2] = s2[p2]; if (s2 != null && typeof Object.getOwnPropertySymbols === "function") - for (var i2 = 0, p2 = Object.getOwnPropertySymbols(s2); i2 < p2.length; i2++) { - if (e2.indexOf(p2[i2]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i2])) - t2[p2[i2]] = s2[p2[i2]]; + for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) { + if (e2.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i])) + t2[p2[i]] = s2[p2[i]]; } return t2; } function __spreadArray(to, from, pack2) { - for (var i2 = 0, l2 = from.length, ar; i2 < l2; i2++) { - if (ar || !(i2 in from)) { + for (var i = 0, l2 = from.length, ar; i < l2; i++) { + if (ar || !(i in from)) { if (!ar) - ar = Array.prototype.slice.call(from, 0, i2); - ar[i2] = from[i2]; + ar = Array.prototype.slice.call(from, 0, i); + ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); @@ -20913,9 +20913,9 @@ function getNextMatch(values, search2, currentMatch) { function isPointInPolygon$1(point3, polygon2) { const { x, y: y2 } = point3; let inside = false; - for (let i2 = 0, j2 = polygon2.length - 1; i2 < polygon2.length; j2 = i2++) { - const xi2 = polygon2[i2].x; - const yi2 = polygon2[i2].y; + for (let i = 0, j2 = polygon2.length - 1; i < polygon2.length; j2 = i++) { + const xi2 = polygon2[i].x; + const yi2 = polygon2[i].y; const xj2 = polygon2[j2].x; const yj2 = polygon2[j2].y; const intersect = yi2 > y2 !== yj2 > y2 && x < (xj2 - xi2) * (y2 - yi2) / (yj2 - yi2) + xi2; @@ -21367,8 +21367,8 @@ const scaledMod = (value, mod2 = MOD) => { }; const cyrb53 = (str, seed = 0) => { let h1 = 3735928559 ^ seed, h2 = 1103547991 ^ seed; - for (let i2 = 0, ch2; i2 < str.length; i2++) { - ch2 = str.charCodeAt(i2); + for (let i = 0, ch2; i < str.length; i++) { + ch2 = str.charCodeAt(i); h1 = Math.imul(h1 ^ ch2, 2654435761); h2 = Math.imul(h2 ^ ch2, 1597334677); } @@ -21388,8 +21388,8 @@ const createGradient = (a2, b2, c2) => { }; const createGradients = (address, complexity) => { const hashes = []; - for (let i2 = 0; i2 < complexity; i2++) { - const offset2 = i2 * 6; + for (let i = 0; i < complexity; i++) { + const offset2 = i * 6; hashes.push({ a: cyrb53(address + "a", offset2), b: cyrb53(address + "b", offset2 + 1), @@ -25550,9 +25550,9 @@ function getPointsFromRect(rect) { function isPointInPolygon(point3, polygon2) { const { x, y: y2 } = point3; let inside = false; - for (let i2 = 0, j2 = polygon2.length - 1; i2 < polygon2.length; j2 = i2++) { - const xi2 = polygon2[i2].x; - const yi2 = polygon2[i2].y; + for (let i = 0, j2 = polygon2.length - 1; i < polygon2.length; j2 = i++) { + const xi2 = polygon2[i].x; + const yi2 = polygon2[i].y; const xj2 = polygon2[j2].x; const yj2 = polygon2[j2].y; const intersect = yi2 > y2 !== yj2 > y2 && x < (xj2 - xi2) * (y2 - yi2) / (yj2 - yi2) + xi2; @@ -25581,8 +25581,8 @@ function getHullPresorted(points) { if (points.length <= 1) return points.slice(); const upperHull = []; - for (let i2 = 0; i2 < points.length; i2++) { - const p2 = points[i2]; + for (let i = 0; i < points.length; i++) { + const p2 = points[i]; while (upperHull.length >= 2) { const q2 = upperHull[upperHull.length - 1]; const r2 = upperHull[upperHull.length - 2]; @@ -25595,8 +25595,8 @@ function getHullPresorted(points) { } upperHull.pop(); const lowerHull = []; - for (let i2 = points.length - 1; i2 >= 0; i2--) { - const p2 = points[i2]; + for (let i = points.length - 1; i >= 0; i--) { + const p2 = points[i]; while (lowerHull.length >= 2) { const q2 = lowerHull[lowerHull.length - 1]; const r2 = lowerHull[lowerHull.length - 2]; @@ -26418,10 +26418,10 @@ const abi$1$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope walletContracts }, Symbol.toStringTag, { value: "Module" })); const global$1 = globalThis || void 0 || self; -function _extends$l() { - _extends$l = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$h() { + _extends$h = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -26430,7 +26430,7 @@ function _extends$l() { } return target; }; - return _extends$l.apply(this, arguments); + return _extends$h.apply(this, arguments); } const WebRPCVersion$3 = "v1"; const WebRPCSchemaVersion$3 = "v0.4.0"; @@ -27026,7 +27026,7 @@ class API { const createHTTPRequest$7 = (body = {}, headers = {}, signal = null) => { return { method: "POST", - headers: _extends$l({}, headers, { + headers: _extends$h({}, headers, { "Content-Type": "application/json" }), body: JSON.stringify(body || {}), @@ -27249,7 +27249,7 @@ class SequenceAPIClient extends API { if (projectAccessKey3 && projectAccessKey3.length > 0) { headers["X-Access-Key"] = projectAccessKey3; } - init3.headers = _extends$l({}, init3.headers, headers); + init3.headers = _extends$h({}, init3.headers, headers); return fetch$5(input2, init3); }; this.fetch = this._fetch; @@ -27295,9 +27295,9 @@ var lookup = []; var revLookup = []; var Arr = typeof Uint8Array !== "undefined" ? Uint8Array : Array; var code = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -for (var i$1 = 0, len = code.length; i$1 < len; ++i$1) { - lookup[i$1] = code[i$1]; - revLookup[code.charCodeAt(i$1)] = i$1; +for (var i$2 = 0, len = code.length; i$2 < len; ++i$2) { + lookup[i$2] = code[i$2]; + revLookup[code.charCodeAt(i$2)] = i$2; } revLookup["-".charCodeAt(0)] = 62; revLookup["_".charCodeAt(0)] = 63; @@ -27329,19 +27329,19 @@ function toByteArray(b64) { var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen)); var curByte = 0; var len = placeHoldersLen > 0 ? validLen - 4 : validLen; - var i2; - for (i2 = 0; i2 < len; i2 += 4) { - tmp = revLookup[b64.charCodeAt(i2)] << 18 | revLookup[b64.charCodeAt(i2 + 1)] << 12 | revLookup[b64.charCodeAt(i2 + 2)] << 6 | revLookup[b64.charCodeAt(i2 + 3)]; + var i; + for (i = 0; i < len; i += 4) { + tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)]; arr[curByte++] = tmp >> 16 & 255; arr[curByte++] = tmp >> 8 & 255; arr[curByte++] = tmp & 255; } if (placeHoldersLen === 2) { - tmp = revLookup[b64.charCodeAt(i2)] << 2 | revLookup[b64.charCodeAt(i2 + 1)] >> 4; + tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4; arr[curByte++] = tmp & 255; } if (placeHoldersLen === 1) { - tmp = revLookup[b64.charCodeAt(i2)] << 10 | revLookup[b64.charCodeAt(i2 + 1)] << 4 | revLookup[b64.charCodeAt(i2 + 2)] >> 2; + tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2; arr[curByte++] = tmp >> 8 & 255; arr[curByte++] = tmp & 255; } @@ -27353,8 +27353,8 @@ function tripletToBase64(num) { function encodeChunk(uint8, start, end) { var tmp; var output2 = []; - for (var i2 = start; i2 < end; i2 += 3) { - tmp = (uint8[i2] << 16 & 16711680) + (uint8[i2 + 1] << 8 & 65280) + (uint8[i2 + 2] & 255); + for (var i = start; i < end; i += 3) { + tmp = (uint8[i] << 16 & 16711680) + (uint8[i + 1] << 8 & 65280) + (uint8[i + 2] & 255); output2.push(tripletToBase64(tmp)); } return output2.join(""); @@ -27365,8 +27365,8 @@ function fromByteArray(uint8) { var extraBytes = len % 3; var parts = []; var maxChunkLength = 16383; - for (var i2 = 0, len2 = len - extraBytes; i2 < len2; i2 += maxChunkLength) { - parts.push(encodeChunk(uint8, i2, i2 + maxChunkLength > len2 ? len2 : i2 + maxChunkLength)); + for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) { + parts.push(encodeChunk(uint8, i, i + maxChunkLength > len2 ? len2 : i + maxChunkLength)); } if (extraBytes === 1) { tmp = uint8[len - 1]; @@ -27389,19 +27389,19 @@ ieee754.read = function(buffer2, offset2, isLE2, mLen, nBytes) { var eMax = (1 << eLen) - 1; var eBias = eMax >> 1; var nBits = -7; - var i2 = isLE2 ? nBytes - 1 : 0; + var i = isLE2 ? nBytes - 1 : 0; var d2 = isLE2 ? -1 : 1; - var s2 = buffer2[offset2 + i2]; - i2 += d2; + var s2 = buffer2[offset2 + i]; + i += d2; e2 = s2 & (1 << -nBits) - 1; s2 >>= -nBits; nBits += eLen; - for (; nBits > 0; e2 = e2 * 256 + buffer2[offset2 + i2], i2 += d2, nBits -= 8) { + for (; nBits > 0; e2 = e2 * 256 + buffer2[offset2 + i], i += d2, nBits -= 8) { } m2 = e2 & (1 << -nBits) - 1; e2 >>= -nBits; nBits += mLen; - for (; nBits > 0; m2 = m2 * 256 + buffer2[offset2 + i2], i2 += d2, nBits -= 8) { + for (; nBits > 0; m2 = m2 * 256 + buffer2[offset2 + i], i += d2, nBits -= 8) { } if (e2 === 0) { e2 = 1 - eBias; @@ -27419,7 +27419,7 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { var eMax = (1 << eLen) - 1; var eBias = eMax >> 1; var rt = mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0; - var i2 = isLE2 ? 0 : nBytes - 1; + var i = isLE2 ? 0 : nBytes - 1; var d2 = isLE2 ? 1 : -1; var s2 = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0; value = Math.abs(value); @@ -27452,13 +27452,13 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { e2 = 0; } } - for (; mLen >= 8; buffer2[offset2 + i2] = m2 & 255, i2 += d2, m2 /= 256, mLen -= 8) { + for (; mLen >= 8; buffer2[offset2 + i] = m2 & 255, i += d2, m2 /= 256, mLen -= 8) { } e2 = e2 << mLen | m2; eLen += mLen; - for (; eLen > 0; buffer2[offset2 + i2] = e2 & 255, i2 += d2, e2 /= 256, eLen -= 8) { + for (; eLen > 0; buffer2[offset2 + i] = e2 & 255, i += d2, e2 /= 256, eLen -= 8) { } - buffer2[offset2 + i2 - d2] |= s2 * 128; + buffer2[offset2 + i - d2] |= s2 * 128; }; /*! * The buffer module from node.js, for the browser. @@ -27621,8 +27621,8 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { function fromArrayLike(array) { const length = array.length < 0 ? 0 : checked(array.length) | 0; const buf = createBuffer(length); - for (let i2 = 0; i2 < length; i2 += 1) { - buf[i2] = array[i2] & 255; + for (let i = 0; i < length; i += 1) { + buf[i] = array[i] & 255; } return buf; } @@ -27700,10 +27700,10 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { return 0; let x = a2.length; let y2 = b2.length; - for (let i2 = 0, len = Math.min(x, y2); i2 < len; ++i2) { - if (a2[i2] !== b2[i2]) { - x = a2[i2]; - y2 = b2[i2]; + for (let i = 0, len = Math.min(x, y2); i < len; ++i) { + if (a2[i] !== b2[i]) { + x = a2[i]; + y2 = b2[i]; break; } } @@ -27738,17 +27738,17 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { if (list2.length === 0) { return Buffer3.alloc(0); } - let i2; + let i; if (length === void 0) { length = 0; - for (i2 = 0; i2 < list2.length; ++i2) { - length += list2[i2].length; + for (i = 0; i < list2.length; ++i) { + length += list2[i].length; } } const buffer2 = Buffer3.allocUnsafe(length); let pos = 0; - for (i2 = 0; i2 < list2.length; ++i2) { - let buf = list2[i2]; + for (i = 0; i < list2.length; ++i) { + let buf = list2[i]; if (isInstance(buf, GlobalUint8Array)) { if (pos + buf.length > buffer2.length) { if (!Buffer3.isBuffer(buf)) @@ -27865,17 +27865,17 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { } Buffer3.prototype._isBuffer = true; function swap(b2, n2, m2) { - const i2 = b2[n2]; + const i = b2[n2]; b2[n2] = b2[m2]; - b2[m2] = i2; + b2[m2] = i; } Buffer3.prototype.swap16 = function swap16() { const len = this.length; if (len % 2 !== 0) { throw new RangeError("Buffer size must be a multiple of 16-bits"); } - for (let i2 = 0; i2 < len; i2 += 2) { - swap(this, i2, i2 + 1); + for (let i = 0; i < len; i += 2) { + swap(this, i, i + 1); } return this; }; @@ -27884,9 +27884,9 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { if (len % 4 !== 0) { throw new RangeError("Buffer size must be a multiple of 32-bits"); } - for (let i2 = 0; i2 < len; i2 += 4) { - swap(this, i2, i2 + 3); - swap(this, i2 + 1, i2 + 2); + for (let i = 0; i < len; i += 4) { + swap(this, i, i + 3); + swap(this, i + 1, i + 2); } return this; }; @@ -27895,11 +27895,11 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { if (len % 8 !== 0) { throw new RangeError("Buffer size must be a multiple of 64-bits"); } - for (let i2 = 0; i2 < len; i2 += 8) { - swap(this, i2, i2 + 7); - swap(this, i2 + 1, i2 + 6); - swap(this, i2 + 2, i2 + 5); - swap(this, i2 + 3, i2 + 4); + for (let i = 0; i < len; i += 8) { + swap(this, i, i + 7); + swap(this, i + 1, i + 6); + swap(this, i + 2, i + 5); + swap(this, i + 3, i + 4); } return this; }; @@ -27974,10 +27974,10 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { const len = Math.min(x, y2); const thisCopy = this.slice(thisStart, thisEnd); const targetCopy = target.slice(start, end); - for (let i2 = 0; i2 < len; ++i2) { - if (thisCopy[i2] !== targetCopy[i2]) { - x = thisCopy[i2]; - y2 = targetCopy[i2]; + for (let i = 0; i < len; ++i) { + if (thisCopy[i] !== targetCopy[i]) { + x = thisCopy[i]; + y2 = targetCopy[i]; break; } } @@ -28052,41 +28052,41 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { byteOffset /= 2; } } - function read(buf, i3) { + function read(buf, i2) { if (indexSize === 1) { - return buf[i3]; + return buf[i2]; } else { - return buf.readUInt16BE(i3 * indexSize); + return buf.readUInt16BE(i2 * indexSize); } } - let i2; + let i; if (dir) { let foundIndex = -1; - for (i2 = byteOffset; i2 < arrLength; i2++) { - if (read(arr, i2) === read(val, foundIndex === -1 ? 0 : i2 - foundIndex)) { + for (i = byteOffset; i < arrLength; i++) { + if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) { if (foundIndex === -1) - foundIndex = i2; - if (i2 - foundIndex + 1 === valLength) + foundIndex = i; + if (i - foundIndex + 1 === valLength) return foundIndex * indexSize; } else { if (foundIndex !== -1) - i2 -= i2 - foundIndex; + i -= i - foundIndex; foundIndex = -1; } } } else { if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength; - for (i2 = byteOffset; i2 >= 0; i2--) { + for (i = byteOffset; i >= 0; i--) { let found = true; for (let j2 = 0; j2 < valLength; j2++) { - if (read(arr, i2 + j2) !== read(val, j2)) { + if (read(arr, i + j2) !== read(val, j2)) { found = false; break; } } if (found) - return i2; + return i; } } return -1; @@ -28115,14 +28115,14 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { if (length > strLen / 2) { length = strLen / 2; } - let i2; - for (i2 = 0; i2 < length; ++i2) { - const parsed = parseInt(string.substr(i2 * 2, 2), 16); + let i; + for (i = 0; i < length; ++i) { + const parsed = parseInt(string.substr(i * 2, 2), 16); if (numberIsNaN(parsed)) - return i2; - buf[offset2 + i2] = parsed; + return i; + buf[offset2 + i] = parsed; } - return i2; + return i; } function utf8Write(buf, string, offset2, length) { return blitBuffer(utf8ToBytes2(string, buf.length - offset2), buf, offset2, length); @@ -28211,12 +28211,12 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { function utf8Slice(buf, start, end) { end = Math.min(buf.length, end); const res = []; - let i2 = start; - while (i2 < end) { - const firstByte = buf[i2]; + let i = start; + while (i < end) { + const firstByte = buf[i]; let codePoint = null; let bytesPerSequence = firstByte > 239 ? 4 : firstByte > 223 ? 3 : firstByte > 191 ? 2 : 1; - if (i2 + bytesPerSequence <= end) { + if (i + bytesPerSequence <= end) { let secondByte, thirdByte, fourthByte, tempCodePoint; switch (bytesPerSequence) { case 1: @@ -28225,7 +28225,7 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { } break; case 2: - secondByte = buf[i2 + 1]; + secondByte = buf[i + 1]; if ((secondByte & 192) === 128) { tempCodePoint = (firstByte & 31) << 6 | secondByte & 63; if (tempCodePoint > 127) { @@ -28234,8 +28234,8 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { } break; case 3: - secondByte = buf[i2 + 1]; - thirdByte = buf[i2 + 2]; + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; if ((secondByte & 192) === 128 && (thirdByte & 192) === 128) { tempCodePoint = (firstByte & 15) << 12 | (secondByte & 63) << 6 | thirdByte & 63; if (tempCodePoint > 2047 && (tempCodePoint < 55296 || tempCodePoint > 57343)) { @@ -28244,9 +28244,9 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { } break; case 4: - secondByte = buf[i2 + 1]; - thirdByte = buf[i2 + 2]; - fourthByte = buf[i2 + 3]; + secondByte = buf[i + 1]; + thirdByte = buf[i + 2]; + fourthByte = buf[i + 3]; if ((secondByte & 192) === 128 && (thirdByte & 192) === 128 && (fourthByte & 192) === 128) { tempCodePoint = (firstByte & 15) << 18 | (secondByte & 63) << 12 | (thirdByte & 63) << 6 | fourthByte & 63; if (tempCodePoint > 65535 && tempCodePoint < 1114112) { @@ -28264,7 +28264,7 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { codePoint = 56320 | codePoint & 1023; } res.push(codePoint); - i2 += bytesPerSequence; + i += bytesPerSequence; } return decodeCodePointsArray(res); } @@ -28275,11 +28275,11 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { return String.fromCharCode.apply(String, codePoints); } let res = ""; - let i2 = 0; - while (i2 < len) { + let i = 0; + while (i < len) { res += String.fromCharCode.apply( String, - codePoints.slice(i2, i2 += MAX_ARGUMENTS_LENGTH) + codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH) ); } return res; @@ -28287,16 +28287,16 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { function asciiSlice(buf, start, end) { let ret = ""; end = Math.min(buf.length, end); - for (let i2 = start; i2 < end; ++i2) { - ret += String.fromCharCode(buf[i2] & 127); + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i] & 127); } return ret; } function latin1Slice(buf, start, end) { let ret = ""; end = Math.min(buf.length, end); - for (let i2 = start; i2 < end; ++i2) { - ret += String.fromCharCode(buf[i2]); + for (let i = start; i < end; ++i) { + ret += String.fromCharCode(buf[i]); } return ret; } @@ -28307,16 +28307,16 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { if (!end || end < 0 || end > len) end = len; let out = ""; - for (let i2 = start; i2 < end; ++i2) { - out += hexSliceLookupTable[buf[i2]]; + for (let i = start; i < end; ++i) { + out += hexSliceLookupTable[buf[i]]; } return out; } function utf16leSlice(buf, start, end) { const bytes3 = buf.slice(start, end); let res = ""; - for (let i2 = 0; i2 < bytes3.length - 1; i2 += 2) { - res += String.fromCharCode(bytes3[i2] + bytes3[i2 + 1] * 256); + for (let i = 0; i < bytes3.length - 1; i += 2) { + res += String.fromCharCode(bytes3[i] + bytes3[i + 1] * 256); } return res; } @@ -28357,9 +28357,9 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { checkOffset(offset2, byteLength3, this.length); let val = this[offset2]; let mul3 = 1; - let i2 = 0; - while (++i2 < byteLength3 && (mul3 *= 256)) { - val += this[offset2 + i2] * mul3; + let i = 0; + while (++i < byteLength3 && (mul3 *= 256)) { + val += this[offset2 + i] * mul3; } return val; }; @@ -28437,9 +28437,9 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { checkOffset(offset2, byteLength3, this.length); let val = this[offset2]; let mul3 = 1; - let i2 = 0; - while (++i2 < byteLength3 && (mul3 *= 256)) { - val += this[offset2 + i2] * mul3; + let i = 0; + while (++i < byteLength3 && (mul3 *= 256)) { + val += this[offset2 + i] * mul3; } mul3 *= 128; if (val >= mul3) @@ -28451,11 +28451,11 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { byteLength3 = byteLength3 >>> 0; if (!noAssert) checkOffset(offset2, byteLength3, this.length); - let i2 = byteLength3; + let i = byteLength3; let mul3 = 1; - let val = this[offset2 + --i2]; - while (i2 > 0 && (mul3 *= 256)) { - val += this[offset2 + --i2] * mul3; + let val = this[offset2 + --i]; + while (i > 0 && (mul3 *= 256)) { + val += this[offset2 + --i] * mul3; } mul3 *= 128; if (val >= mul3) @@ -28560,10 +28560,10 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { checkInt(this, value, offset2, byteLength3, maxBytes, 0); } let mul3 = 1; - let i2 = 0; + let i = 0; this[offset2] = value & 255; - while (++i2 < byteLength3 && (mul3 *= 256)) { - this[offset2 + i2] = value / mul3 & 255; + while (++i < byteLength3 && (mul3 *= 256)) { + this[offset2 + i] = value / mul3 & 255; } return offset2 + byteLength3; }; @@ -28575,11 +28575,11 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { const maxBytes = Math.pow(2, 8 * byteLength3) - 1; checkInt(this, value, offset2, byteLength3, maxBytes, 0); } - let i2 = byteLength3 - 1; + let i = byteLength3 - 1; let mul3 = 1; - this[offset2 + i2] = value & 255; - while (--i2 >= 0 && (mul3 *= 256)) { - this[offset2 + i2] = value / mul3 & 255; + this[offset2 + i] = value & 255; + while (--i >= 0 && (mul3 *= 256)) { + this[offset2 + i] = value / mul3 & 255; } return offset2 + byteLength3; }; @@ -28684,15 +28684,15 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { const limit = Math.pow(2, 8 * byteLength3 - 1); checkInt(this, value, offset2, byteLength3, limit - 1, -limit); } - let i2 = 0; + let i = 0; let mul3 = 1; let sub = 0; this[offset2] = value & 255; - while (++i2 < byteLength3 && (mul3 *= 256)) { - if (value < 0 && sub === 0 && this[offset2 + i2 - 1] !== 0) { + while (++i < byteLength3 && (mul3 *= 256)) { + if (value < 0 && sub === 0 && this[offset2 + i - 1] !== 0) { sub = 1; } - this[offset2 + i2] = (value / mul3 >> 0) - sub & 255; + this[offset2 + i] = (value / mul3 >> 0) - sub & 255; } return offset2 + byteLength3; }; @@ -28703,15 +28703,15 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { const limit = Math.pow(2, 8 * byteLength3 - 1); checkInt(this, value, offset2, byteLength3, limit - 1, -limit); } - let i2 = byteLength3 - 1; + let i = byteLength3 - 1; let mul3 = 1; let sub = 0; - this[offset2 + i2] = value & 255; - while (--i2 >= 0 && (mul3 *= 256)) { - if (value < 0 && sub === 0 && this[offset2 + i2 + 1] !== 0) { + this[offset2 + i] = value & 255; + while (--i >= 0 && (mul3 *= 256)) { + if (value < 0 && sub === 0 && this[offset2 + i + 1] !== 0) { sub = 1; } - this[offset2 + i2] = (value / mul3 >> 0) - sub & 255; + this[offset2 + i] = (value / mul3 >> 0) - sub & 255; } return offset2 + byteLength3; }; @@ -28887,10 +28887,10 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { end = end === void 0 ? this.length : end >>> 0; if (!val) val = 0; - let i2; + let i; if (typeof val === "number") { - for (i2 = start; i2 < end; ++i2) { - this[i2] = val; + for (i = start; i < end; ++i) { + this[i] = val; } } else { const bytes3 = Buffer3.isBuffer(val) ? val : Buffer3.from(val, encoding); @@ -28898,8 +28898,8 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { if (len === 0) { throw new TypeError('The value "' + val + '" is invalid for argument "value"'); } - for (i2 = 0; i2 < end - start; ++i2) { - this[i2 + start] = bytes3[i2 % len]; + for (i = 0; i < end - start; ++i) { + this[i + start] = bytes3[i % len]; } } return this; @@ -28972,12 +28972,12 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { ); function addNumericalSeparator(val) { let res = ""; - let i2 = val.length; + let i = val.length; const start = val[0] === "-" ? 1 : 0; - for (; i2 >= start + 4; i2 -= 3) { - res = `_${val.slice(i2 - 3, i2)}${res}`; + for (; i >= start + 4; i -= 3) { + res = `_${val.slice(i - 3, i)}${res}`; } - return `${val.slice(0, i2)}${res}`; + return `${val.slice(0, i)}${res}`; } function checkBounds(buf, offset2, byteLength3) { validateNumber(offset2, "offset"); @@ -29036,15 +29036,15 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { const length = string.length; let leadSurrogate = null; const bytes3 = []; - for (let i2 = 0; i2 < length; ++i2) { - codePoint = string.charCodeAt(i2); + for (let i = 0; i < length; ++i) { + codePoint = string.charCodeAt(i); if (codePoint > 55295 && codePoint < 57344) { if (!leadSurrogate) { if (codePoint > 56319) { if ((units -= 3) > -1) bytes3.push(239, 191, 189); continue; - } else if (i2 + 1 === length) { + } else if (i + 1 === length) { if ((units -= 3) > -1) bytes3.push(239, 191, 189); continue; @@ -29100,18 +29100,18 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { } function asciiToBytes(str) { const byteArray = []; - for (let i2 = 0; i2 < str.length; ++i2) { - byteArray.push(str.charCodeAt(i2) & 255); + for (let i = 0; i < str.length; ++i) { + byteArray.push(str.charCodeAt(i) & 255); } return byteArray; } function utf16leToBytes(str, units) { let c2, hi2, lo; const byteArray = []; - for (let i2 = 0; i2 < str.length; ++i2) { + for (let i = 0; i < str.length; ++i) { if ((units -= 2) < 0) break; - c2 = str.charCodeAt(i2); + c2 = str.charCodeAt(i); hi2 = c2 >> 8; lo = c2 % 256; byteArray.push(lo); @@ -29123,13 +29123,13 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { return base64.toByteArray(base64clean(str)); } function blitBuffer(src, dst, offset2, length) { - let i2; - for (i2 = 0; i2 < length; ++i2) { - if (i2 + offset2 >= dst.length || i2 >= src.length) + let i; + for (i = 0; i < length; ++i) { + if (i + offset2 >= dst.length || i >= src.length) break; - dst[i2 + offset2] = src[i2]; + dst[i + offset2] = src[i]; } - return i2; + return i; } function isInstance(obj, type) { return obj instanceof type || obj != null && obj.constructor != null && obj.constructor.name != null && obj.constructor.name === type.name; @@ -29140,10 +29140,10 @@ ieee754.write = function(buffer2, value, offset2, isLE2, mLen, nBytes) { const hexSliceLookupTable = function() { const alphabet = "0123456789abcdef"; const table = new Array(256); - for (let i2 = 0; i2 < 16; ++i2) { - const i16 = i2 * 16; + for (let i = 0; i < 16; ++i) { + const i16 = i * 16; for (let j2 = 0; j2 < 16; ++j2) { - table[i16 + j2] = alphabet[i2] + alphabet[j2]; + table[i16 + j2] = alphabet[i] + alphabet[j2]; } } return table; @@ -29322,14 +29322,14 @@ bn.exports; } this.length = Math.ceil(number2.length / 3); this.words = new Array(this.length); - for (var i2 = 0; i2 < this.length; i2++) { - this.words[i2] = 0; + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; } var j2, w2; var off = 0; if (endian === "be") { - for (i2 = number2.length - 1, j2 = 0; i2 >= 0; i2 -= 3) { - w2 = number2[i2] | number2[i2 - 1] << 8 | number2[i2 - 2] << 16; + for (i = number2.length - 1, j2 = 0; i >= 0; i -= 3) { + w2 = number2[i] | number2[i - 1] << 8 | number2[i - 2] << 16; this.words[j2] |= w2 << off & 67108863; this.words[j2 + 1] = w2 >>> 26 - off & 67108863; off += 24; @@ -29339,8 +29339,8 @@ bn.exports; } } } else if (endian === "le") { - for (i2 = 0, j2 = 0; i2 < number2.length; i2 += 3) { - w2 = number2[i2] | number2[i2 + 1] << 8 | number2[i2 + 2] << 16; + for (i = 0, j2 = 0; i < number2.length; i += 3) { + w2 = number2[i] | number2[i + 1] << 8 | number2[i + 2] << 16; this.words[j2] |= w2 << off & 67108863; this.words[j2 + 1] = w2 >>> 26 - off & 67108863; off += 24; @@ -29374,15 +29374,15 @@ bn.exports; BN2.prototype._parseHex = function _parseHex(number2, start, endian) { this.length = Math.ceil((number2.length - start) / 6); this.words = new Array(this.length); - for (var i2 = 0; i2 < this.length; i2++) { - this.words[i2] = 0; + for (var i = 0; i < this.length; i++) { + this.words[i] = 0; } var off = 0; var j2 = 0; var w2; if (endian === "be") { - for (i2 = number2.length - 1; i2 >= start; i2 -= 2) { - w2 = parseHexByte(number2, start, i2) << off; + for (i = number2.length - 1; i >= start; i -= 2) { + w2 = parseHexByte(number2, start, i) << off; this.words[j2] |= w2 & 67108863; if (off >= 18) { off -= 18; @@ -29394,8 +29394,8 @@ bn.exports; } } else { var parseLength = number2.length - start; - for (i2 = parseLength % 2 === 0 ? start + 1 : start; i2 < number2.length; i2 += 2) { - w2 = parseHexByte(number2, start, i2) << off; + for (i = parseLength % 2 === 0 ? start + 1 : start; i < number2.length; i += 2) { + w2 = parseHexByte(number2, start, i) << off; this.words[j2] |= w2 & 67108863; if (off >= 18) { off -= 18; @@ -29412,8 +29412,8 @@ bn.exports; var r2 = 0; var b2 = 0; var len = Math.min(str.length, end); - for (var i2 = start; i2 < len; i2++) { - var c2 = str.charCodeAt(i2) - 48; + for (var i = start; i < len; i++) { + var c2 = str.charCodeAt(i) - 48; r2 *= mul3; if (c2 >= 49) { b2 = c2 - 49 + 10; @@ -29439,8 +29439,8 @@ bn.exports; var mod2 = total % limbLen; var end = Math.min(total, total - mod2) + start; var word = 0; - for (var i2 = start; i2 < end; i2 += limbLen) { - word = parseBase(number2, i2, i2 + limbLen, base2); + for (var i = start; i < end; i += limbLen) { + word = parseBase(number2, i, i + limbLen, base2); this.imuln(limbPow); if (this.words[0] + word < 67108864) { this.words[0] += word; @@ -29450,8 +29450,8 @@ bn.exports; } if (mod2 !== 0) { var pow3 = 1; - word = parseBase(number2, i2, number2.length, base2); - for (i2 = 0; i2 < mod2; i2++) { + word = parseBase(number2, i, number2.length, base2); + for (i = 0; i < mod2; i++) { pow3 *= base2; } this.imuln(pow3); @@ -29465,8 +29465,8 @@ bn.exports; }; BN2.prototype.copy = function copy2(dest) { dest.words = new Array(this.length); - for (var i2 = 0; i2 < this.length; i2++) { - dest.words[i2] = this.words[i2]; + for (var i = 0; i < this.length; i++) { + dest.words[i] = this.words[i]; } dest.length = this.length; dest.negative = this.negative; @@ -29630,16 +29630,16 @@ bn.exports; out = ""; var off = 0; var carry = 0; - for (var i2 = 0; i2 < this.length; i2++) { - var w2 = this.words[i2]; + for (var i = 0; i < this.length; i++) { + var w2 = this.words[i]; var word = ((w2 << off | carry) & 16777215).toString(16); carry = w2 >>> 24 - off & 16777215; off += 2; if (off >= 26) { off -= 26; - i2--; + i--; } - if (carry !== 0 || i2 !== this.length - 1) { + if (carry !== 0 || i !== this.length - 1) { out = zeros2[6 - word.length] + word + out; } else { out = word + out; @@ -29726,8 +29726,8 @@ bn.exports; BN2.prototype._toArrayLikeLE = function _toArrayLikeLE(res, byteLength2) { var position = 0; var carry = 0; - for (var i2 = 0, shift2 = 0; i2 < this.length; i2++) { - var word = this.words[i2] << shift2 | carry; + for (var i = 0, shift2 = 0; i < this.length; i++) { + var word = this.words[i] << shift2 | carry; res[position++] = word & 255; if (position < res.length) { res[position++] = word >> 8 & 255; @@ -29756,8 +29756,8 @@ bn.exports; BN2.prototype._toArrayLikeBE = function _toArrayLikeBE(res, byteLength2) { var position = res.length - 1; var carry = 0; - for (var i2 = 0, shift2 = 0; i2 < this.length; i2++) { - var word = this.words[i2] << shift2 | carry; + for (var i = 0, shift2 = 0; i < this.length; i++) { + var word = this.words[i] << shift2 | carry; res[position--] = word & 255; if (position >= 0) { res[position--] = word >> 8 & 255; @@ -29854,8 +29854,8 @@ bn.exports; if (this.isZero()) return 0; var r2 = 0; - for (var i2 = 0; i2 < this.length; i2++) { - var b2 = this._zeroBits(this.words[i2]); + for (var i = 0; i < this.length; i++) { + var b2 = this._zeroBits(this.words[i]); r2 += b2; if (b2 !== 26) break; @@ -29893,8 +29893,8 @@ bn.exports; while (this.length < num.length) { this.words[this.length++] = 0; } - for (var i2 = 0; i2 < num.length; i2++) { - this.words[i2] = this.words[i2] | num.words[i2]; + for (var i = 0; i < num.length; i++) { + this.words[i] = this.words[i] | num.words[i]; } return this._strip(); }; @@ -29919,8 +29919,8 @@ bn.exports; } else { b2 = this; } - for (var i2 = 0; i2 < b2.length; i2++) { - this.words[i2] = this.words[i2] & num.words[i2]; + for (var i = 0; i < b2.length; i++) { + this.words[i] = this.words[i] & num.words[i]; } this.length = b2.length; return this._strip(); @@ -29949,12 +29949,12 @@ bn.exports; a2 = num; b2 = this; } - for (var i2 = 0; i2 < b2.length; i2++) { - this.words[i2] = a2.words[i2] ^ b2.words[i2]; + for (var i = 0; i < b2.length; i++) { + this.words[i] = a2.words[i] ^ b2.words[i]; } if (this !== a2) { - for (; i2 < a2.length; i2++) { - this.words[i2] = a2.words[i2]; + for (; i < a2.length; i++) { + this.words[i] = a2.words[i]; } } this.length = a2.length; @@ -29982,11 +29982,11 @@ bn.exports; if (bitsLeft > 0) { bytesNeeded--; } - for (var i2 = 0; i2 < bytesNeeded; i2++) { - this.words[i2] = ~this.words[i2] & 67108863; + for (var i = 0; i < bytesNeeded; i++) { + this.words[i] = ~this.words[i] & 67108863; } if (bitsLeft > 0) { - this.words[i2] = ~this.words[i2] & 67108863 >> 26 - bitsLeft; + this.words[i] = ~this.words[i] & 67108863 >> 26 - bitsLeft; } return this._strip(); }; @@ -30027,14 +30027,14 @@ bn.exports; b2 = this; } var carry = 0; - for (var i2 = 0; i2 < b2.length; i2++) { - r2 = (a2.words[i2] | 0) + (b2.words[i2] | 0) + carry; - this.words[i2] = r2 & 67108863; + for (var i = 0; i < b2.length; i++) { + r2 = (a2.words[i] | 0) + (b2.words[i] | 0) + carry; + this.words[i] = r2 & 67108863; carry = r2 >>> 26; } - for (; carry !== 0 && i2 < a2.length; i2++) { - r2 = (a2.words[i2] | 0) + carry; - this.words[i2] = r2 & 67108863; + for (; carry !== 0 && i < a2.length; i++) { + r2 = (a2.words[i] | 0) + carry; + this.words[i] = r2 & 67108863; carry = r2 >>> 26; } this.length = a2.length; @@ -30042,8 +30042,8 @@ bn.exports; this.words[this.length] = carry; this.length++; } else if (a2 !== this) { - for (; i2 < a2.length; i2++) { - this.words[i2] = a2.words[i2]; + for (; i < a2.length; i++) { + this.words[i] = a2.words[i]; } } return this; @@ -30093,22 +30093,22 @@ bn.exports; b2 = this; } var carry = 0; - for (var i2 = 0; i2 < b2.length; i2++) { - r2 = (a2.words[i2] | 0) - (b2.words[i2] | 0) + carry; + for (var i = 0; i < b2.length; i++) { + r2 = (a2.words[i] | 0) - (b2.words[i] | 0) + carry; carry = r2 >> 26; - this.words[i2] = r2 & 67108863; + this.words[i] = r2 & 67108863; } - for (; carry !== 0 && i2 < a2.length; i2++) { - r2 = (a2.words[i2] | 0) + carry; + for (; carry !== 0 && i < a2.length; i++) { + r2 = (a2.words[i] | 0) + carry; carry = r2 >> 26; - this.words[i2] = r2 & 67108863; + this.words[i] = r2 & 67108863; } - if (carry === 0 && i2 < a2.length && a2 !== this) { - for (; i2 < a2.length; i2++) { - this.words[i2] = a2.words[i2]; + if (carry === 0 && i < a2.length && a2 !== this) { + for (; i < a2.length; i++) { + this.words[i] = a2.words[i]; } } - this.length = Math.max(this.length, i2); + this.length = Math.max(this.length, i); if (a2 !== this) { this.negative = 1; } @@ -30133,8 +30133,8 @@ bn.exports; var rword = carry & 67108863; var maxJ = Math.min(k2, num.length - 1); for (var j2 = Math.max(0, k2 - self2.length + 1); j2 <= maxJ; j2++) { - var i2 = k2 - j2 | 0; - a2 = self2.words[i2] | 0; + var i = k2 - j2 | 0; + a2 = self2.words[i] | 0; b2 = num.words[j2] | 0; r2 = a2 * b2 + rword; ncarry += r2 / 67108864 | 0; @@ -30716,8 +30716,8 @@ bn.exports; var rword = carry & 67108863; var maxJ = Math.min(k2, num.length - 1); for (var j2 = Math.max(0, k2 - self2.length + 1); j2 <= maxJ; j2++) { - var i2 = k2 - j2; - var a2 = self2.words[i2] | 0; + var i = k2 - j2; + var a2 = self2.words[i] | 0; var b2 = num.words[j2] | 0; var r2 = a2 * b2; var lo = r2 & 67108863; @@ -30776,16 +30776,16 @@ bn.exports; assert2(typeof num === "number"); assert2(num < 67108864); var carry = 0; - for (var i2 = 0; i2 < this.length; i2++) { - var w2 = (this.words[i2] | 0) * num; + for (var i = 0; i < this.length; i++) { + var w2 = (this.words[i] | 0) * num; var lo = (w2 & 67108863) + (carry & 67108863); carry >>= 26; carry += w2 / 67108864 | 0; carry += lo >>> 26; - this.words[i2] = lo & 67108863; + this.words[i] = lo & 67108863; } if (carry !== 0) { - this.words[i2] = carry; + this.words[i] = carry; this.length++; } return isNegNum ? this.ineg() : this; @@ -30804,13 +30804,13 @@ bn.exports; if (w2.length === 0) return new BN2(1); var res = this; - for (var i2 = 0; i2 < w2.length; i2++, res = res.sqr()) { - if (w2[i2] !== 0) + for (var i = 0; i < w2.length; i++, res = res.sqr()) { + if (w2[i] !== 0) break; } - if (++i2 < w2.length) { - for (var q2 = res.sqr(); i2 < w2.length; i2++, q2 = q2.sqr()) { - if (w2[i2] === 0) + if (++i < w2.length) { + for (var q2 = res.sqr(); i < w2.length; i++, q2 = q2.sqr()) { + if (w2[i] === 0) continue; res = res.mul(q2); } @@ -30822,26 +30822,26 @@ bn.exports; var r2 = bits % 26; var s2 = (bits - r2) / 26; var carryMask = 67108863 >>> 26 - r2 << 26 - r2; - var i2; + var i; if (r2 !== 0) { var carry = 0; - for (i2 = 0; i2 < this.length; i2++) { - var newCarry = this.words[i2] & carryMask; - var c2 = (this.words[i2] | 0) - newCarry << r2; - this.words[i2] = c2 | carry; + for (i = 0; i < this.length; i++) { + var newCarry = this.words[i] & carryMask; + var c2 = (this.words[i] | 0) - newCarry << r2; + this.words[i] = c2 | carry; carry = newCarry >>> 26 - r2; } if (carry) { - this.words[i2] = carry; + this.words[i] = carry; this.length++; } } if (s2 !== 0) { - for (i2 = this.length - 1; i2 >= 0; i2--) { - this.words[i2 + s2] = this.words[i2]; + for (i = this.length - 1; i >= 0; i--) { + this.words[i + s2] = this.words[i]; } - for (i2 = 0; i2 < s2; i2++) { - this.words[i2] = 0; + for (i = 0; i < s2; i++) { + this.words[i] = 0; } this.length += s2; } @@ -30866,8 +30866,8 @@ bn.exports; h2 -= s2; h2 = Math.max(0, h2); if (maskedWords) { - for (var i2 = 0; i2 < s2; i2++) { - maskedWords.words[i2] = this.words[i2]; + for (var i = 0; i < s2; i++) { + maskedWords.words[i] = this.words[i]; } maskedWords.length = s2; } @@ -30875,17 +30875,17 @@ bn.exports; ; else if (this.length > s2) { this.length -= s2; - for (i2 = 0; i2 < this.length; i2++) { - this.words[i2] = this.words[i2 + s2]; + for (i = 0; i < this.length; i++) { + this.words[i] = this.words[i + s2]; } } else { this.words[0] = 0; this.length = 1; } var carry = 0; - for (i2 = this.length - 1; i2 >= 0 && (carry !== 0 || i2 >= h2); i2--) { - var word = this.words[i2] | 0; - this.words[i2] = carry << 26 - r2 | word >>> r2; + for (i = this.length - 1; i >= 0 && (carry !== 0 || i >= h2); i--) { + var word = this.words[i] | 0; + this.words[i] = carry << 26 - r2 | word >>> r2; carry = word & mask; } if (maskedWords && carry !== 0) { @@ -30964,15 +30964,15 @@ bn.exports; }; BN2.prototype._iaddn = function _iaddn(num) { this.words[0] += num; - for (var i2 = 0; i2 < this.length && this.words[i2] >= 67108864; i2++) { - this.words[i2] -= 67108864; - if (i2 === this.length - 1) { - this.words[i2 + 1] = 1; + for (var i = 0; i < this.length && this.words[i] >= 67108864; i++) { + this.words[i] -= 67108864; + if (i === this.length - 1) { + this.words[i + 1] = 1; } else { - this.words[i2 + 1]++; + this.words[i + 1]++; } } - this.length = Math.max(this.length, i2 + 1); + this.length = Math.max(this.length, i + 1); return this; }; BN2.prototype.isubn = function isubn(num) { @@ -30991,9 +30991,9 @@ bn.exports; this.words[0] = -this.words[0]; this.negative = 1; } else { - for (var i2 = 0; i2 < this.length && this.words[i2] < 0; i2++) { - this.words[i2] += 67108864; - this.words[i2 + 1] -= 1; + for (var i = 0; i < this.length && this.words[i] < 0; i++) { + this.words[i] += 67108864; + this.words[i + 1] -= 1; } } return this._strip(); @@ -31013,30 +31013,30 @@ bn.exports; }; BN2.prototype._ishlnsubmul = function _ishlnsubmul(num, mul3, shift2) { var len = num.length + shift2; - var i2; + var i; this._expand(len); var w2; var carry = 0; - for (i2 = 0; i2 < num.length; i2++) { - w2 = (this.words[i2 + shift2] | 0) + carry; - var right = (num.words[i2] | 0) * mul3; + for (i = 0; i < num.length; i++) { + w2 = (this.words[i + shift2] | 0) + carry; + var right = (num.words[i] | 0) * mul3; w2 -= right & 67108863; carry = (w2 >> 26) - (right / 67108864 | 0); - this.words[i2 + shift2] = w2 & 67108863; + this.words[i + shift2] = w2 & 67108863; } - for (; i2 < this.length - shift2; i2++) { - w2 = (this.words[i2 + shift2] | 0) + carry; + for (; i < this.length - shift2; i++) { + w2 = (this.words[i + shift2] | 0) + carry; carry = w2 >> 26; - this.words[i2 + shift2] = w2 & 67108863; + this.words[i + shift2] = w2 & 67108863; } if (carry === 0) return this._strip(); assert2(carry === -1); carry = 0; - for (i2 = 0; i2 < this.length; i2++) { - w2 = -(this.words[i2] | 0) + carry; + for (i = 0; i < this.length; i++) { + w2 = -(this.words[i] | 0) + carry; carry = w2 >> 26; - this.words[i2] = w2 & 67108863; + this.words[i] = w2 & 67108863; } this.negative = 1; return this._strip(); @@ -31059,8 +31059,8 @@ bn.exports; q2 = new BN2(null); q2.length = m2 + 1; q2.words = new Array(q2.length); - for (var i2 = 0; i2 < q2.length; i2++) { - q2.words[i2] = 0; + for (var i = 0; i < q2.length; i++) { + q2.words[i] = 0; } } var diff = a2.clone()._ishlnsubmul(b2, 1, m2); @@ -31200,8 +31200,8 @@ bn.exports; assert2(num <= 67108863); var p2 = (1 << 26) % num; var acc = 0; - for (var i2 = this.length - 1; i2 >= 0; i2--) { - acc = (p2 * acc + (this.words[i2] | 0)) % num; + for (var i = this.length - 1; i >= 0; i--) { + acc = (p2 * acc + (this.words[i] | 0)) % num; } return isNegNum ? -acc : acc; }; @@ -31214,9 +31214,9 @@ bn.exports; num = -num; assert2(num <= 67108863); var carry = 0; - for (var i2 = this.length - 1; i2 >= 0; i2--) { - var w2 = (this.words[i2] | 0) + carry * 67108864; - this.words[i2] = w2 / num | 0; + for (var i = this.length - 1; i >= 0; i--) { + var w2 = (this.words[i] | 0) + carry * 67108864; + this.words[i] = w2 / num | 0; carry = w2 % num; } this._strip(); @@ -31248,11 +31248,11 @@ bn.exports; var yp = y2.clone(); var xp = x.clone(); while (!x.isZero()) { - for (var i2 = 0, im = 1; (x.words[0] & im) === 0 && i2 < 26; ++i2, im <<= 1) + for (var i = 0, im = 1; (x.words[0] & im) === 0 && i < 26; ++i, im <<= 1) ; - if (i2 > 0) { - x.iushrn(i2); - while (i2-- > 0) { + if (i > 0) { + x.iushrn(i); + while (i-- > 0) { if (A2.isOdd() || B2.isOdd()) { A2.iadd(yp); B2.isub(xp); @@ -31304,11 +31304,11 @@ bn.exports; var x2 = new BN2(0); var delta = b2.clone(); while (a2.cmpn(1) > 0 && b2.cmpn(1) > 0) { - for (var i2 = 0, im = 1; (a2.words[0] & im) === 0 && i2 < 26; ++i2, im <<= 1) + for (var i = 0, im = 1; (a2.words[0] & im) === 0 && i < 26; ++i, im <<= 1) ; - if (i2 > 0) { - a2.iushrn(i2); - while (i2-- > 0) { + if (i > 0) { + a2.iushrn(i); + while (i-- > 0) { if (x1.isOdd()) { x1.iadd(delta); } @@ -31400,15 +31400,15 @@ bn.exports; return this; } var carry = q2; - for (var i2 = s2; carry !== 0 && i2 < this.length; i2++) { - var w2 = this.words[i2] | 0; + for (var i = s2; carry !== 0 && i < this.length; i++) { + var w2 = this.words[i] | 0; w2 += carry; carry = w2 >>> 26; w2 &= 67108863; - this.words[i2] = w2; + this.words[i] = w2; } if (carry !== 0) { - this.words[i2] = carry; + this.words[i] = carry; this.length++; } return this; @@ -31454,9 +31454,9 @@ bn.exports; if (this.length < num.length) return -1; var res = 0; - for (var i2 = this.length - 1; i2 >= 0; i2--) { - var a2 = this.words[i2] | 0; - var b2 = num.words[i2] | 0; + for (var i = this.length - 1; i >= 0; i--) { + var a2 = this.words[i] | 0; + var b2 = num.words[i] | 0; if (a2 === b2) continue; if (a2 < b2) { @@ -31637,8 +31637,8 @@ bn.exports; K256.prototype.split = function split2(input2, output2) { var mask = 4194303; var outLen = Math.min(input2.length, 9); - for (var i2 = 0; i2 < outLen; i2++) { - output2.words[i2] = input2.words[i2]; + for (var i = 0; i < outLen; i++) { + output2.words[i] = input2.words[i]; } output2.length = outLen; if (input2.length <= 9) { @@ -31648,13 +31648,13 @@ bn.exports; } var prev = input2.words[9]; output2.words[output2.length++] = prev & mask; - for (i2 = 10; i2 < input2.length; i2++) { - var next = input2.words[i2] | 0; - input2.words[i2 - 10] = (next & mask) << 4 | prev >>> 22; + for (i = 10; i < input2.length; i++) { + var next = input2.words[i] | 0; + input2.words[i - 10] = (next & mask) << 4 | prev >>> 22; prev = next; } prev >>>= 22; - input2.words[i2 - 10] = prev; + input2.words[i - 10] = prev; if (prev === 0 && input2.length > 10) { input2.length -= 10; } else { @@ -31666,10 +31666,10 @@ bn.exports; num.words[num.length + 1] = 0; num.length += 2; var lo = 0; - for (var i2 = 0; i2 < num.length; i2++) { - var w2 = num.words[i2] | 0; + for (var i = 0; i < num.length; i++) { + var w2 = num.words[i] | 0; lo += w2 * 977; - num.words[i2] = lo & 67108863; + num.words[i] = lo & 67108863; lo = w2 * 64 + (lo / 67108864 | 0); } if (num.words[num.length - 1] === 0) { @@ -31706,11 +31706,11 @@ bn.exports; inherits2(P25519, MPrime); P25519.prototype.imulK = function imulK(num) { var carry = 0; - for (var i2 = 0; i2 < num.length; i2++) { - var hi2 = (num.words[i2] | 0) * 19 + carry; + for (var i = 0; i < num.length; i++) { + var hi2 = (num.words[i] | 0) * 19 + carry; var lo = hi2 & 67108863; hi2 >>>= 26; - num.words[i2] = lo; + num.words[i] = lo; carry = hi2; } if (carry !== 0) { @@ -31850,15 +31850,15 @@ bn.exports; var m2 = s2; while (t2.cmp(one) !== 0) { var tmp = t2; - for (var i2 = 0; tmp.cmp(one) !== 0; i2++) { + for (var i = 0; tmp.cmp(one) !== 0; i++) { tmp = tmp.redSqr(); } - assert2(i2 < m2); - var b2 = this.pow(c2, new BN2(1).iushln(m2 - i2 - 1)); + assert2(i < m2); + var b2 = this.pow(c2, new BN2(1).iushln(m2 - i - 1)); r2 = r2.redMul(b2); c2 = b2.redSqr(); t2 = t2.redMul(c2); - m2 = i2; + m2 = i; } return r2; }; @@ -31880,8 +31880,8 @@ bn.exports; var wnd = new Array(1 << windowSize); wnd[0] = new BN2(1).toRed(this); wnd[1] = a2; - for (var i2 = 2; i2 < wnd.length; i2++) { - wnd[i2] = this.mul(wnd[i2 - 1], a2); + for (var i = 2; i < wnd.length; i++) { + wnd[i] = this.mul(wnd[i - 1], a2); } var res = wnd[0]; var current = 0; @@ -31890,8 +31890,8 @@ bn.exports; if (start === 0) { start = 26; } - for (i2 = num.length - 1; i2 >= 0; i2--) { - var word = num.words[i2]; + for (i = num.length - 1; i >= 0; i--) { + var word = num.words[i]; for (var j2 = start - 1; j2 >= 0; j2--) { var bit = word >> j2 & 1; if (res !== wnd[0]) { @@ -31904,7 +31904,7 @@ bn.exports; current <<= 1; current |= bit; currentLen++; - if (currentLen !== windowSize && (i2 !== 0 || j2 !== 0)) + if (currentLen !== windowSize && (i !== 0 || j2 !== 0)) continue; res = this.mul(res, wnd[current]); currentLen = 0; @@ -32049,7 +32049,7 @@ var ErrorCode; ErrorCode2["ACTION_REJECTED"] = "ACTION_REJECTED"; })(ErrorCode || (ErrorCode = {})); const HEX = "0123456789abcdef"; -let Logger$3 = class Logger { +let Logger$1 = class Logger { constructor(version2) { Object.defineProperty(this, "version", { enumerable: true, @@ -32092,9 +32092,9 @@ let Logger$3 = class Logger { try { if (value instanceof Uint8Array) { let hex2 = ""; - for (let i2 = 0; i2 < value.length; i2++) { - hex2 += HEX[value[i2] >> 4]; - hex2 += HEX[value[i2] & 15]; + for (let i = 0; i < value.length; i++) { + hex2 += HEX[value[i] >> 4]; + hex2 += HEX[value[i] & 15]; } messageDetails.push(key2 + "=Uint8Array(0x" + hex2 + ")"); } else { @@ -32269,8 +32269,8 @@ let Logger$3 = class Logger { return new Logger(version2); } }; -Logger$3.errors = ErrorCode; -Logger$3.levels = LogLevel; +Logger$1.errors = ErrorCode; +Logger$1.levels = LogLevel; const lib_esm$k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, get ErrorCode() { @@ -32279,10 +32279,10 @@ const lib_esm$k = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro get LogLevel() { return LogLevel; }, - Logger: Logger$3 + Logger: Logger$1 }, Symbol.toStringTag, { value: "Module" })); const version$v = "bytes/5.7.0"; -const logger$A = new Logger$3(version$v); +const logger$A = new Logger$1(version$v); function isHexable(value) { return !!value.toHexString; } @@ -32315,8 +32315,8 @@ function isBytes$1(value) { if (!isInteger(value.length) || value.length < 0) { return false; } - for (let i2 = 0; i2 < value.length; i2++) { - const v3 = value[i2]; + for (let i = 0; i < value.length; i++) { + const v3 = value[i]; if (!isInteger(v3) || v3 < 0 || v3 >= 256) { return false; } @@ -32357,8 +32357,8 @@ function arrayify(value, options) { } } const result = []; - for (let i2 = 0; i2 < hex2.length; i2 += 2) { - result.push(parseInt(hex2.substring(i2, i2 + 2), 16)); + for (let i = 0; i < hex2.length; i += 2) { + result.push(parseInt(hex2.substring(i, i + 2), 16)); } return addSlice(new Uint8Array(result)); } @@ -32456,8 +32456,8 @@ function hexlify(value, options) { } if (isBytes$1(value)) { let result = "0x"; - for (let i2 = 0; i2 < value.length; i2++) { - let v3 = value[i2]; + for (let i = 0; i < value.length; i++) { + let v3 = value[i]; result += HexCharacters[(v3 & 240) >> 4] + HexCharacters[v3 & 15]; } return result; @@ -32666,7 +32666,7 @@ const lib_esm$j = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro }, Symbol.toStringTag, { value: "Module" })); const version$u = "bignumber/5.7.0"; var BN = BN$1.BN; -const logger$z = new Logger$3(version$u); +const logger$z = new Logger$1(version$u); const _constructorGuard$4 = {}; const MAX_SAFE = 9007199254740991; function isBigNumberish$1(value) { @@ -32676,7 +32676,7 @@ let _warnedToStringRadix = false; class BigNumber { constructor(constructorGuard, hex2) { if (constructorGuard !== _constructorGuard$4) { - logger$z.throwError("cannot call constructor directly; use BigNumber.from", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$z.throwError("cannot call constructor directly; use BigNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "new (BigNumber)" }); } @@ -32799,7 +32799,7 @@ class BigNumber { return BigInt(this.toString()); } catch (e2) { } - return logger$z.throwError("this platform does not support BigInt", Logger$3.errors.UNSUPPORTED_OPERATION, { + return logger$z.throwError("this platform does not support BigInt", Logger$1.errors.UNSUPPORTED_OPERATION, { value: this.toString() }); } @@ -32811,9 +32811,9 @@ class BigNumber { logger$z.warn("BigNumber.toString does not accept any parameters; base-10 is assumed"); } } else if (arguments[0] === 16) { - logger$z.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$3.errors.UNEXPECTED_ARGUMENT, {}); + logger$z.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()", Logger$1.errors.UNEXPECTED_ARGUMENT, {}); } else { - logger$z.throwError("BigNumber.toString does not accept parameters", Logger$3.errors.UNEXPECTED_ARGUMENT, {}); + logger$z.throwError("BigNumber.toString does not accept parameters", Logger$1.errors.UNEXPECTED_ARGUMENT, {}); } } return toBN(this).toString(10); @@ -32921,7 +32921,7 @@ function throwFault$1(fault, operation, value) { if (value != null) { params.value = value; } - return logger$z.throwError(fault, Logger$3.errors.NUMERIC_FAULT, params); + return logger$z.throwError(fault, Logger$1.errors.NUMERIC_FAULT, params); } function _base36To16(value) { return new BN(value, 36).toString(16); @@ -32929,7 +32929,7 @@ function _base36To16(value) { function _base16To36(value) { return new BN(value, 16).toString(36); } -const logger$y = new Logger$3(version$u); +const logger$y = new Logger$1(version$u); const _constructorGuard$3 = {}; const Zero$2 = BigNumber.from(0); const NegativeOne$2 = BigNumber.from(-1); @@ -32938,7 +32938,7 @@ function throwFault(message, fault, operation, value) { if (value !== void 0) { params.value = value; } - return logger$y.throwError(message, Logger$3.errors.NUMERIC_FAULT, params); + return logger$y.throwError(message, Logger$1.errors.NUMERIC_FAULT, params); } let zeros = "0"; while (zeros.length < 256) { @@ -33031,7 +33031,7 @@ function parseFixed(value, decimals) { class FixedFormat { constructor(constructorGuard, signed2, width, decimals) { if (constructorGuard !== _constructorGuard$3) { - logger$y.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$y.throwError("cannot use FixedFormat constructor; use FixedFormat.from", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); } @@ -33092,7 +33092,7 @@ class FixedFormat { class FixedNumber { constructor(constructorGuard, hex2, value, format2) { if (constructorGuard !== _constructorGuard$3) { - logger$y.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$y.throwError("cannot use FixedNumber constructor; use FixedNumber.from", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "new FixedFormat" }); } @@ -33257,7 +33257,7 @@ class FixedNumber { try { return FixedNumber.fromValue(value, 0, format2); } catch (error) { - if (error.code !== Logger$3.errors.INVALID_ARGUMENT) { + if (error.code !== Logger$1.errors.INVALID_ARGUMENT) { throw error; } } @@ -33297,7 +33297,7 @@ var __awaiter$e = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$x = new Logger$3(version$t); +const logger$x = new Logger$1(version$t); function defineReadOnly$1(object, name2, value) { Object.defineProperty(object, name2, { enumerable: true, @@ -33306,7 +33306,7 @@ function defineReadOnly$1(object, name2, value) { }); } function getStatic$1(ctor, key2) { - for (let i2 = 0; i2 < 32; i2++) { + for (let i = 0; i < 32; i++) { if (ctor[key2]) { return ctor[key2]; } @@ -33357,10 +33357,10 @@ function _isFrozen(object) { return false; } const keys = Object.keys(object); - for (let i2 = 0; i2 < keys.length; i2++) { + for (let i = 0; i < keys.length; i++) { let value = null; try { - value = object[keys[i2]]; + value = object[keys[i]]; } catch (error) { continue; } @@ -33413,7 +33413,7 @@ const lib_esm$i = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro shallowCopy: shallowCopy$1 }, Symbol.toStringTag, { value: "Module" })); const version$s = "abi/5.7.0"; -const logger$w = new Logger$3(version$s); +const logger$w = new Logger$1(version$s); const _constructorGuard$2 = {}; let ModifiersBytes = { calldata: true, memory: true, storage: true }; let ModifiersNest = { calldata: true, memory: true }; @@ -33438,8 +33438,8 @@ function checkModifier(type, name2) { } function parseParamType(param, allowIndexed) { let originalParam = param; - function throwError(i2) { - logger$w.throwArgumentError(`unexpected character at position ${i2}`, "param", param); + function throwError(i) { + logger$w.throwArgumentError(`unexpected character at position ${i}`, "param", param); } param = param.replace(/\s/g, " "); function newNode(parent3) { @@ -33451,14 +33451,14 @@ function parseParamType(param, allowIndexed) { } let parent2 = { type: "", name: "", state: { allowType: true } }; let node = parent2; - for (let i2 = 0; i2 < param.length; i2++) { - let c2 = param[i2]; + for (let i = 0; i < param.length; i++) { + let c2 = param[i]; switch (c2) { case "(": if (node.state.allowType && node.type === "") { node.type = "tuple"; } else if (!node.state.allowParams) { - throwError(i2); + throwError(i); } node.state.allowType = false; node.type = verifyType(node.type); @@ -33469,7 +33469,7 @@ function parseParamType(param, allowIndexed) { delete node.state; if (node.name === "indexed") { if (!allowIndexed) { - throwError(i2); + throwError(i); } node.indexed = true; node.name = ""; @@ -33481,7 +33481,7 @@ function parseParamType(param, allowIndexed) { let child = node; node = node.parent; if (!node) { - throwError(i2); + throwError(i); } delete child.parent; node.state.allowParams = false; @@ -33492,7 +33492,7 @@ function parseParamType(param, allowIndexed) { delete node.state; if (node.name === "indexed") { if (!allowIndexed) { - throwError(i2); + throwError(i); } node.indexed = true; node.name = ""; @@ -33519,10 +33519,10 @@ function parseParamType(param, allowIndexed) { if (node.name !== "") { if (node.name === "indexed") { if (!allowIndexed) { - throwError(i2); + throwError(i); } if (node.indexed) { - throwError(i2); + throwError(i); } node.indexed = true; node.name = ""; @@ -33536,7 +33536,7 @@ function parseParamType(param, allowIndexed) { break; case "[": if (!node.state.allowArray) { - throwError(i2); + throwError(i); } node.type += c2; node.state.allowArray = false; @@ -33545,7 +33545,7 @@ function parseParamType(param, allowIndexed) { break; case "]": if (!node.state.readArray) { - throwError(i2); + throwError(i); } node.type += c2; node.state.readArray = false; @@ -33563,7 +33563,7 @@ function parseParamType(param, allowIndexed) { } else if (node.state.readArray) { node.type += c2; } else { - throwError(i2); + throwError(i); } } } @@ -33605,7 +33605,7 @@ const paramTypeArray = new RegExp(/^(.*)\[([0-9]*)\]$/); class ParamType { constructor(constructorGuard, params) { if (constructorGuard !== _constructorGuard$2) { - logger$w.throwError("use fromString", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$w.throwError("use fromString", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "new ParamType()" }); } @@ -33716,7 +33716,7 @@ function parseParams(value, allowIndex) { class Fragment { constructor(constructorGuard, params) { if (constructorGuard !== _constructorGuard$2) { - logger$w.throwError("use a static from method", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$w.throwError("use a static from method", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "new Fragment()" }); } @@ -33958,7 +33958,7 @@ class ConstructorFragment extends Fragment { }); } if (format2 === FormatTypes.sighash) { - logger$w.throwError("cannot format a constructor for sighash", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$w.throwError("cannot format a constructor for sighash", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "format(sighash)" }); } @@ -34219,7 +34219,7 @@ function splitNesting(value) { } return result; } -const logger$v = new Logger$3(version$s); +const logger$v = new Logger$1(version$s); function checkResultErrors(result) { const errors2 = []; const checkErrors = function(path, object) { @@ -34283,7 +34283,7 @@ class Writer { _getValue(value) { let bytes3 = arrayify(BigNumber.from(value)); if (bytes3.length > this.wordSize) { - logger$v.throwError("value out-of-bounds", Logger$3.errors.BUFFER_OVERRUN, { + logger$v.throwError("value out-of-bounds", Logger$1.errors.BUFFER_OVERRUN, { length: this.wordSize, offset: bytes3.length }); @@ -34340,7 +34340,7 @@ class Reader { if (this.allowLoose && loose && this._offset + length <= this._data.length) { alignedLength = length; } else { - logger$v.throwError("data out-of-bounds", Logger$3.errors.BUFFER_OVERRUN, { + logger$v.throwError("data out-of-bounds", Logger$1.errors.BUFFER_OVERRUN, { length: this._data.length, offset: this._offset + alignedLength }); @@ -34472,8 +34472,8 @@ function drainQueue() { process.nextTick = function(fun) { var args = new Array(arguments.length - 1); if (arguments.length > 1) { - for (var i2 = 1; i2 < arguments.length; i2++) { - args[i2 - 1] = arguments[i2]; + for (var i = 1; i < arguments.length; i++) { + args[i - 1] = arguments[i]; } } queue.push(new Item(fun, args)); @@ -34635,8 +34635,8 @@ var sha3$1 = { exports: {} }; }; }; var createOutputMethods = function(method, createMethod2, bits2, padding2) { - for (var i3 = 0; i3 < OUTPUT_TYPES.length; ++i3) { - var type = OUTPUT_TYPES[i3]; + for (var i2 = 0; i2 < OUTPUT_TYPES.length; ++i2) { + var type = OUTPUT_TYPES[i2]; method[type] = createMethod2(bits2, padding2, type); } return method; @@ -34695,8 +34695,8 @@ var sha3$1 = { exports: {} }; { name: "kmac", padding: CSHAKE_PADDING, bits: SHAKE_BITS, createMethod: createKmacMethod } ]; var methods = {}, methodNames = []; - for (var i2 = 0; i2 < algorithms.length; ++i2) { - var algorithm = algorithms[i2]; + for (var i = 0; i < algorithms.length; ++i) { + var algorithm = algorithms[i]; var bits = algorithm.bits; for (var j2 = 0; j2 < bits.length; ++j2) { var methodName = algorithm.name + "_" + bits[j2]; @@ -34722,8 +34722,8 @@ var sha3$1 = { exports: {} }; this.byteCount = this.blockCount << 2; this.outputBlocks = outputBits >> 5; this.extraBytes = (outputBits & 31) >> 3; - for (var i3 = 0; i3 < 50; ++i3) { - this.s[i3] = 0; + for (var i2 = 0; i2 < 50; ++i2) { + this.s[i2] = 0; } } Keccak2.prototype.update = function(message) { @@ -34747,51 +34747,51 @@ var sha3$1 = { exports: {} }; } notString = true; } - var blocks = this.blocks, byteCount = this.byteCount, length = message.length, blockCount = this.blockCount, index2 = 0, s2 = this.s, i3, code2; + var blocks = this.blocks, byteCount = this.byteCount, length = message.length, blockCount = this.blockCount, index2 = 0, s2 = this.s, i2, code2; while (index2 < length) { if (this.reset) { this.reset = false; blocks[0] = this.block; - for (i3 = 1; i3 < blockCount + 1; ++i3) { - blocks[i3] = 0; + for (i2 = 1; i2 < blockCount + 1; ++i2) { + blocks[i2] = 0; } } if (notString) { - for (i3 = this.start; index2 < length && i3 < byteCount; ++index2) { - blocks[i3 >> 2] |= message[index2] << SHIFT[i3++ & 3]; + for (i2 = this.start; index2 < length && i2 < byteCount; ++index2) { + blocks[i2 >> 2] |= message[index2] << SHIFT[i2++ & 3]; } } else { - for (i3 = this.start; index2 < length && i3 < byteCount; ++index2) { + for (i2 = this.start; index2 < length && i2 < byteCount; ++index2) { code2 = message.charCodeAt(index2); if (code2 < 128) { - blocks[i3 >> 2] |= code2 << SHIFT[i3++ & 3]; + blocks[i2 >> 2] |= code2 << SHIFT[i2++ & 3]; } else if (code2 < 2048) { - blocks[i3 >> 2] |= (192 | code2 >> 6) << SHIFT[i3++ & 3]; - blocks[i3 >> 2] |= (128 | code2 & 63) << SHIFT[i3++ & 3]; + blocks[i2 >> 2] |= (192 | code2 >> 6) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code2 & 63) << SHIFT[i2++ & 3]; } else if (code2 < 55296 || code2 >= 57344) { - blocks[i3 >> 2] |= (224 | code2 >> 12) << SHIFT[i3++ & 3]; - blocks[i3 >> 2] |= (128 | code2 >> 6 & 63) << SHIFT[i3++ & 3]; - blocks[i3 >> 2] |= (128 | code2 & 63) << SHIFT[i3++ & 3]; + blocks[i2 >> 2] |= (224 | code2 >> 12) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code2 >> 6 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code2 & 63) << SHIFT[i2++ & 3]; } else { code2 = 65536 + ((code2 & 1023) << 10 | message.charCodeAt(++index2) & 1023); - blocks[i3 >> 2] |= (240 | code2 >> 18) << SHIFT[i3++ & 3]; - blocks[i3 >> 2] |= (128 | code2 >> 12 & 63) << SHIFT[i3++ & 3]; - blocks[i3 >> 2] |= (128 | code2 >> 6 & 63) << SHIFT[i3++ & 3]; - blocks[i3 >> 2] |= (128 | code2 & 63) << SHIFT[i3++ & 3]; + blocks[i2 >> 2] |= (240 | code2 >> 18) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code2 >> 12 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code2 >> 6 & 63) << SHIFT[i2++ & 3]; + blocks[i2 >> 2] |= (128 | code2 & 63) << SHIFT[i2++ & 3]; } } } - this.lastByteIndex = i3; - if (i3 >= byteCount) { - this.start = i3 - byteCount; + this.lastByteIndex = i2; + if (i2 >= byteCount) { + this.start = i2 - byteCount; this.block = blocks[blockCount]; - for (i3 = 0; i3 < blockCount; ++i3) { - s2[i3] ^= blocks[i3]; + for (i2 = 0; i2 < blockCount; ++i2) { + s2[i2] ^= blocks[i2]; } f2(s2); this.reset = true; } else { - this.start = i3; + this.start = i2; } } return this; @@ -34837,8 +34837,8 @@ var sha3$1 = { exports: {} }; if (notString) { bytes3 = length; } else { - for (var i3 = 0; i3 < str.length; ++i3) { - var code2 = str.charCodeAt(i3); + for (var i2 = 0; i2 < str.length; ++i2) { + var code2 = str.charCodeAt(i2); if (code2 < 128) { bytes3 += 1; } else if (code2 < 2048) { @@ -34846,7 +34846,7 @@ var sha3$1 = { exports: {} }; } else if (code2 < 55296 || code2 >= 57344) { bytes3 += 3; } else { - code2 = 65536 + ((code2 & 1023) << 10 | str.charCodeAt(++i3) & 1023); + code2 = 65536 + ((code2 & 1023) << 10 | str.charCodeAt(++i2) & 1023); bytes3 += 4; } } @@ -34857,8 +34857,8 @@ var sha3$1 = { exports: {} }; }; Keccak2.prototype.bytepad = function(strs, w2) { var bytes3 = this.encode(w2); - for (var i3 = 0; i3 < strs.length; ++i3) { - bytes3 += this.encodeString(strs[i3]); + for (var i2 = 0; i2 < strs.length; ++i2) { + bytes3 += this.encodeString(strs[i2]); } var paddingBytes = w2 - bytes3 % w2; var zeros2 = []; @@ -34871,36 +34871,36 @@ var sha3$1 = { exports: {} }; return; } this.finalized = true; - var blocks = this.blocks, i3 = this.lastByteIndex, blockCount = this.blockCount, s2 = this.s; - blocks[i3 >> 2] |= this.padding[i3 & 3]; + var blocks = this.blocks, i2 = this.lastByteIndex, blockCount = this.blockCount, s2 = this.s; + blocks[i2 >> 2] |= this.padding[i2 & 3]; if (this.lastByteIndex === this.byteCount) { blocks[0] = blocks[blockCount]; - for (i3 = 1; i3 < blockCount + 1; ++i3) { - blocks[i3] = 0; + for (i2 = 1; i2 < blockCount + 1; ++i2) { + blocks[i2] = 0; } } blocks[blockCount - 1] |= 2147483648; - for (i3 = 0; i3 < blockCount; ++i3) { - s2[i3] ^= blocks[i3]; + for (i2 = 0; i2 < blockCount; ++i2) { + s2[i2] ^= blocks[i2]; } f2(s2); }; Keccak2.prototype.toString = Keccak2.prototype.hex = function() { this.finalize(); - var blockCount = this.blockCount, s2 = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i3 = 0, j3 = 0; + var blockCount = this.blockCount, s2 = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j3 = 0; var hex2 = "", block; while (j3 < outputBlocks) { - for (i3 = 0; i3 < blockCount && j3 < outputBlocks; ++i3, ++j3) { - block = s2[i3]; + for (i2 = 0; i2 < blockCount && j3 < outputBlocks; ++i2, ++j3) { + block = s2[i2]; hex2 += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15] + HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15] + HEX_CHARS[block >> 20 & 15] + HEX_CHARS[block >> 16 & 15] + HEX_CHARS[block >> 28 & 15] + HEX_CHARS[block >> 24 & 15]; } if (j3 % blockCount === 0) { f2(s2); - i3 = 0; + i2 = 0; } } if (extraBytes) { - block = s2[i3]; + block = s2[i2]; hex2 += HEX_CHARS[block >> 4 & 15] + HEX_CHARS[block & 15]; if (extraBytes > 1) { hex2 += HEX_CHARS[block >> 12 & 15] + HEX_CHARS[block >> 8 & 15]; @@ -34913,7 +34913,7 @@ var sha3$1 = { exports: {} }; }; Keccak2.prototype.arrayBuffer = function() { this.finalize(); - var blockCount = this.blockCount, s2 = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i3 = 0, j3 = 0; + var blockCount = this.blockCount, s2 = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j3 = 0; var bytes3 = this.outputBits >> 3; var buffer2; if (extraBytes) { @@ -34923,15 +34923,15 @@ var sha3$1 = { exports: {} }; } var array = new Uint32Array(buffer2); while (j3 < outputBlocks) { - for (i3 = 0; i3 < blockCount && j3 < outputBlocks; ++i3, ++j3) { - array[j3] = s2[i3]; + for (i2 = 0; i2 < blockCount && j3 < outputBlocks; ++i2, ++j3) { + array[j3] = s2[i2]; } if (j3 % blockCount === 0) { f2(s2); } } if (extraBytes) { - array[i3] = s2[i3]; + array[i2] = s2[i2]; buffer2 = buffer2.slice(0, bytes3); } return buffer2; @@ -34939,12 +34939,12 @@ var sha3$1 = { exports: {} }; Keccak2.prototype.buffer = Keccak2.prototype.arrayBuffer; Keccak2.prototype.digest = Keccak2.prototype.array = function() { this.finalize(); - var blockCount = this.blockCount, s2 = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i3 = 0, j3 = 0; + var blockCount = this.blockCount, s2 = this.s, outputBlocks = this.outputBlocks, extraBytes = this.extraBytes, i2 = 0, j3 = 0; var array = [], offset2, block; while (j3 < outputBlocks) { - for (i3 = 0; i3 < blockCount && j3 < outputBlocks; ++i3, ++j3) { + for (i2 = 0; i2 < blockCount && j3 < outputBlocks; ++i2, ++j3) { offset2 = j3 << 2; - block = s2[i3]; + block = s2[i2]; array[offset2] = block & 255; array[offset2 + 1] = block >> 8 & 255; array[offset2 + 2] = block >> 16 & 255; @@ -34956,7 +34956,7 @@ var sha3$1 = { exports: {} }; } if (extraBytes) { offset2 = j3 << 2; - block = s2[i3]; + block = s2[i2]; array[offset2] = block & 255; if (extraBytes > 1) { array[offset2 + 1] = block >> 8 & 255; @@ -35155,8 +35155,8 @@ var sha3$1 = { exports: {} }; if (COMMON_JS) { module2.exports = methods; } else { - for (i2 = 0; i2 < methodNames.length; ++i2) { - root2[methodNames[i2]] = methods[methodNames[i2]]; + for (i = 0; i < methodNames.length; ++i) { + root2[methodNames[i]] = methods[methodNames[i]]; } } })(); @@ -35171,7 +35171,7 @@ const lib_esm$h = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro keccak256: keccak256$2 }, Symbol.toStringTag, { value: "Module" })); const version$r = "rlp/5.7.0"; -const logger$u = new Logger$3(version$r); +const logger$u = new Logger$1(version$r); function arrayifyInteger(value) { const result = []; while (value) { @@ -35182,8 +35182,8 @@ function arrayifyInteger(value) { } function unarrayifyInteger(data, offset2, length) { let result = 0; - for (let i2 = 0; i2 < length; i2++) { - result = result * 256 + data[offset2 + i2]; + for (let i = 0; i < length; i++) { + result = result * 256 + data[offset2 + i]; } return result; } @@ -35225,46 +35225,46 @@ function _decodeChildren(data, offset2, childOffset, length) { result.push(decoded.result); childOffset += decoded.consumed; if (childOffset > offset2 + 1 + length) { - logger$u.throwError("child data too short", Logger$3.errors.BUFFER_OVERRUN, {}); + logger$u.throwError("child data too short", Logger$1.errors.BUFFER_OVERRUN, {}); } } return { consumed: 1 + length, result }; } function _decode$1(data, offset2) { if (data.length === 0) { - logger$u.throwError("data too short", Logger$3.errors.BUFFER_OVERRUN, {}); + logger$u.throwError("data too short", Logger$1.errors.BUFFER_OVERRUN, {}); } if (data[offset2] >= 248) { const lengthLength = data[offset2] - 247; if (offset2 + 1 + lengthLength > data.length) { - logger$u.throwError("data short segment too short", Logger$3.errors.BUFFER_OVERRUN, {}); + logger$u.throwError("data short segment too short", Logger$1.errors.BUFFER_OVERRUN, {}); } const length = unarrayifyInteger(data, offset2 + 1, lengthLength); if (offset2 + 1 + lengthLength + length > data.length) { - logger$u.throwError("data long segment too short", Logger$3.errors.BUFFER_OVERRUN, {}); + logger$u.throwError("data long segment too short", Logger$1.errors.BUFFER_OVERRUN, {}); } return _decodeChildren(data, offset2, offset2 + 1 + lengthLength, lengthLength + length); } else if (data[offset2] >= 192) { const length = data[offset2] - 192; if (offset2 + 1 + length > data.length) { - logger$u.throwError("data array too short", Logger$3.errors.BUFFER_OVERRUN, {}); + logger$u.throwError("data array too short", Logger$1.errors.BUFFER_OVERRUN, {}); } return _decodeChildren(data, offset2, offset2 + 1, length); } else if (data[offset2] >= 184) { const lengthLength = data[offset2] - 183; if (offset2 + 1 + lengthLength > data.length) { - logger$u.throwError("data array too short", Logger$3.errors.BUFFER_OVERRUN, {}); + logger$u.throwError("data array too short", Logger$1.errors.BUFFER_OVERRUN, {}); } const length = unarrayifyInteger(data, offset2 + 1, lengthLength); if (offset2 + 1 + lengthLength + length > data.length) { - logger$u.throwError("data array too short", Logger$3.errors.BUFFER_OVERRUN, {}); + logger$u.throwError("data array too short", Logger$1.errors.BUFFER_OVERRUN, {}); } const result = hexlify(data.slice(offset2 + 1 + lengthLength, offset2 + 1 + lengthLength + length)); return { consumed: 1 + lengthLength + length, result }; } else if (data[offset2] >= 128) { const length = data[offset2] - 128; if (offset2 + 1 + length > data.length) { - logger$u.throwError("data too short", Logger$3.errors.BUFFER_OVERRUN, {}); + logger$u.throwError("data too short", Logger$1.errors.BUFFER_OVERRUN, {}); } const result = hexlify(data.slice(offset2 + 1, offset2 + 1 + length)); return { consumed: 1 + length, result }; @@ -35285,7 +35285,7 @@ const lib_esm$g = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro encode: encode$3 }, Symbol.toStringTag, { value: "Module" })); const version$q = "address/5.7.0"; -const logger$t = new Logger$3(version$q); +const logger$t = new Logger$1(version$q); function getChecksumAddress(address) { if (!isHexString(address, 20)) { logger$t.throwArgumentError("invalid address", "address", address); @@ -35293,16 +35293,16 @@ function getChecksumAddress(address) { address = address.toLowerCase(); const chars = address.substring(2).split(""); const expanded = new Uint8Array(40); - for (let i2 = 0; i2 < 40; i2++) { - expanded[i2] = chars[i2].charCodeAt(0); + for (let i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); } const hashed = arrayify(keccak256$2(expanded)); - for (let i2 = 0; i2 < 40; i2 += 2) { - if (hashed[i2 >> 1] >> 4 >= 8) { - chars[i2] = chars[i2].toUpperCase(); + for (let i = 0; i < 40; i += 2) { + if (hashed[i >> 1] >> 4 >= 8) { + chars[i] = chars[i].toUpperCase(); } - if ((hashed[i2 >> 1] & 15) >= 8) { - chars[i2 + 1] = chars[i2 + 1].toUpperCase(); + if ((hashed[i >> 1] & 15) >= 8) { + chars[i + 1] = chars[i + 1].toUpperCase(); } } return "0x" + chars.join(""); @@ -35315,11 +35315,11 @@ function log10(x) { return Math.log(x) / Math.LN10; } const ibanLookup = {}; -for (let i2 = 0; i2 < 10; i2++) { - ibanLookup[String(i2)] = String(i2); +for (let i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); } -for (let i2 = 0; i2 < 26; i2++) { - ibanLookup[String.fromCharCode(65 + i2)] = String(10 + i2); +for (let i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); } const safeDigits = Math.floor(log10(MAX_SAFE_INTEGER)); function ibanChecksum(address) { @@ -35441,7 +35441,7 @@ class AnonymousCoder extends Coder { return this.coder.decode(reader2); } } -const logger$s = new Logger$3(version$s); +const logger$s = new Logger$1(version$s); function pack$1(writer, coders2, values) { let arrayValues = null; if (Array.isArray(values)) { @@ -35451,14 +35451,14 @@ function pack$1(writer, coders2, values) { arrayValues = coders2.map((coder) => { const name2 = coder.localName; if (!name2) { - logger$s.throwError("cannot encode object for signature with missing names", Logger$3.errors.INVALID_ARGUMENT, { + logger$s.throwError("cannot encode object for signature with missing names", Logger$1.errors.INVALID_ARGUMENT, { argument: "values", coder, value: values }); } if (unique[name2]) { - logger$s.throwError("cannot encode object for signature with duplicate names", Logger$3.errors.INVALID_ARGUMENT, { + logger$s.throwError("cannot encode object for signature with duplicate names", Logger$1.errors.INVALID_ARGUMENT, { argument: "values", coder, value: values @@ -35507,7 +35507,7 @@ function unpack(reader2, coders2) { try { value = coder.decode(offsetReader); } catch (error) { - if (error.code === Logger$3.errors.BUFFER_OVERRUN) { + if (error.code === Logger$1.errors.BUFFER_OVERRUN) { throw error; } value = error; @@ -35519,7 +35519,7 @@ function unpack(reader2, coders2) { try { value = coder.decode(reader2); } catch (error) { - if (error.code === Logger$3.errors.BUFFER_OVERRUN) { + if (error.code === Logger$1.errors.BUFFER_OVERRUN) { throw error; } value = error; @@ -35565,10 +35565,10 @@ function unpack(reader2, coders2) { values[name2] = value; } }); - for (let i2 = 0; i2 < values.length; i2++) { - const value = values[i2]; + for (let i = 0; i < values.length; i++) { + const value = values[i]; if (value instanceof Error) { - Object.defineProperty(values, i2, { + Object.defineProperty(values, i, { enumerable: true, get: () => { throw value; @@ -35589,7 +35589,7 @@ class ArrayCoder extends Coder { defaultValue() { const defaultChild = this.coder.defaultValue(); const result = []; - for (let i2 = 0; i2 < this.length; i2++) { + for (let i = 0; i < this.length; i++) { result.push(defaultChild); } return result; @@ -35605,7 +35605,7 @@ class ArrayCoder extends Coder { } logger$s.checkArgumentCount(value.length, count2, "coder array" + (this.localName ? " " + this.localName : "")); let coders2 = []; - for (let i2 = 0; i2 < value.length; i2++) { + for (let i = 0; i < value.length; i++) { coders2.push(this.coder); } return pack$1(writer, coders2, value); @@ -35615,14 +35615,14 @@ class ArrayCoder extends Coder { if (count2 === -1) { count2 = reader2.readValue().toNumber(); if (count2 * 32 > reader2._data.length) { - logger$s.throwError("insufficient data length", Logger$3.errors.BUFFER_OVERRUN, { + logger$s.throwError("insufficient data length", Logger$1.errors.BUFFER_OVERRUN, { length: reader2._data.length, count: count2 }); } } let coders2 = []; - for (let i2 = 0; i2 < count2; i2++) { + for (let i = 0; i < count2; i++) { coders2.push(new AnonymousCoder(this.coder)); } return reader2.coerce(this.name, unpack(reader2, coders2)); @@ -35748,7 +35748,7 @@ class NumberCoder extends Coder { } } const version$p = "strings/5.7.0"; -const logger$r = new Logger$3(version$p); +const logger$r = new Logger$1(version$p); var UnicodeNormalizationForm; (function(UnicodeNormalizationForm2) { UnicodeNormalizationForm2["current"] = ""; @@ -35772,14 +35772,14 @@ function errorFunc(reason, offset2, bytes3, output2, badCodepoint) { } function ignoreFunc(reason, offset2, bytes3, output2, badCodepoint) { if (reason === Utf8ErrorReason.BAD_PREFIX || reason === Utf8ErrorReason.UNEXPECTED_CONTINUE) { - let i2 = 0; + let i = 0; for (let o2 = offset2 + 1; o2 < bytes3.length; o2++) { if (bytes3[o2] >> 6 !== 2) { break; } - i2++; + i++; } - return i2; + return i; } if (reason === Utf8ErrorReason.OVERRUN) { return bytes3.length - offset2 - 1; @@ -35805,9 +35805,9 @@ function getUtf8CodePoints(bytes3, onError) { } bytes3 = arrayify(bytes3); const result = []; - let i2 = 0; - while (i2 < bytes3.length) { - const c2 = bytes3[i2++]; + let i = 0; + while (i < bytes3.length) { + const c2 = bytes3[i++]; if (c2 >> 7 === 0) { result.push(c2); continue; @@ -35825,40 +35825,40 @@ function getUtf8CodePoints(bytes3, onError) { overlongMask = 65535; } else { if ((c2 & 192) === 128) { - i2 += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i2 - 1, bytes3, result); + i += onError(Utf8ErrorReason.UNEXPECTED_CONTINUE, i - 1, bytes3, result); } else { - i2 += onError(Utf8ErrorReason.BAD_PREFIX, i2 - 1, bytes3, result); + i += onError(Utf8ErrorReason.BAD_PREFIX, i - 1, bytes3, result); } continue; } - if (i2 - 1 + extraLength >= bytes3.length) { - i2 += onError(Utf8ErrorReason.OVERRUN, i2 - 1, bytes3, result); + if (i - 1 + extraLength >= bytes3.length) { + i += onError(Utf8ErrorReason.OVERRUN, i - 1, bytes3, result); continue; } let res = c2 & (1 << 8 - extraLength - 1) - 1; for (let j2 = 0; j2 < extraLength; j2++) { - let nextChar = bytes3[i2]; + let nextChar = bytes3[i]; if ((nextChar & 192) != 128) { - i2 += onError(Utf8ErrorReason.MISSING_CONTINUE, i2, bytes3, result); + i += onError(Utf8ErrorReason.MISSING_CONTINUE, i, bytes3, result); res = null; break; } res = res << 6 | nextChar & 63; - i2++; + i++; } if (res === null) { continue; } if (res > 1114111) { - i2 += onError(Utf8ErrorReason.OUT_OF_RANGE, i2 - 1 - extraLength, bytes3, result, res); + i += onError(Utf8ErrorReason.OUT_OF_RANGE, i - 1 - extraLength, bytes3, result, res); continue; } if (res >= 55296 && res <= 57343) { - i2 += onError(Utf8ErrorReason.UTF16_SURROGATE, i2 - 1 - extraLength, bytes3, result, res); + i += onError(Utf8ErrorReason.UTF16_SURROGATE, i - 1 - extraLength, bytes3, result, res); continue; } if (res <= overlongMask) { - i2 += onError(Utf8ErrorReason.OVERLONG, i2 - 1 - extraLength, bytes3, result, res); + i += onError(Utf8ErrorReason.OVERLONG, i - 1 - extraLength, bytes3, result, res); continue; } result.push(res); @@ -35871,17 +35871,17 @@ function toUtf8Bytes(str, form = UnicodeNormalizationForm.current) { str = str.normalize(form); } let result = []; - for (let i2 = 0; i2 < str.length; i2++) { - const c2 = str.charCodeAt(i2); + for (let i = 0; i < str.length; i++) { + const c2 = str.charCodeAt(i); if (c2 < 128) { result.push(c2); } else if (c2 < 2048) { result.push(c2 >> 6 | 192); result.push(c2 & 63 | 128); } else if ((c2 & 64512) == 55296) { - i2++; - const c22 = str.charCodeAt(i2); - if (i2 >= str.length || (c22 & 64512) !== 56320) { + i++; + const c22 = str.charCodeAt(i); + if (i >= str.length || (c22 & 64512) !== 56320) { throw new Error("invalid utf-8 string"); } const pair = 65536 + ((c2 & 1023) << 10) + (c22 & 1023); @@ -35970,8 +35970,8 @@ function bytes2(data) { throw new Error("bad data"); } let result = []; - for (let i2 = 0; i2 < data.length; i2 += 4) { - result.push(parseInt(data.substring(i2, i2 + 4), 16)); + for (let i = 0; i < data.length; i += 4) { + result.push(parseInt(data.substring(i, i + 4), 16)); } return result; } @@ -36006,8 +36006,8 @@ function createRangeTable(data) { } function matchMap(value, ranges) { let lo = 0; - for (let i2 = 0; i2 < ranges.length; i2++) { - let range2 = ranges[i2]; + for (let i = 0; i < ranges.length; i++) { + let range2 = ranges[i]; lo += range2.l; if (value >= lo && value <= lo + range2.h && (value - lo) % (range2.d || 1) === 0) { if (range2.e && range2.e.indexOf(value - lo) !== -1) { @@ -36218,7 +36218,7 @@ class TupleCoder extends Coder { return reader2.coerce(this.name, unpack(reader2, this.coders)); } } -const logger$q = new Logger$3(version$s); +const logger$q = new Logger$1(version$s); const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); class AbiCoder { @@ -36278,7 +36278,7 @@ class AbiCoder { } encode(types2, values) { if (types2.length !== values.length) { - logger$q.throwError("types/values length mismatch", Logger$3.errors.INVALID_ARGUMENT, { + logger$q.throwError("types/values length mismatch", Logger$1.errors.INVALID_ARGUMENT, { count: { types: types2.length, values: values.length }, value: { types: types2, values } }); @@ -36303,16 +36303,16 @@ const version$o = "hash/5.7.0"; function decode$2(textData) { textData = atob(textData); const data = []; - for (let i2 = 0; i2 < textData.length; i2++) { - data.push(textData.charCodeAt(i2)); + for (let i = 0; i < textData.length; i++) { + data.push(textData.charCodeAt(i)); } return arrayify(data); } function encode$2(data) { data = arrayify(data); let textData = ""; - for (let i2 = 0; i2 < data.length; i2++) { - textData += String.fromCharCode(data[i2]); + for (let i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); } return btoa(textData); } @@ -36341,8 +36341,8 @@ function flat(array, depth) { } function fromEntries(array) { const result = {}; - for (let i2 = 0; i2 < array.length; i2++) { - const value = array[i2]; + for (let i = 0; i < array.length; i++) { + const value = array[i]; result[value[0]] = value[1]; } return result; @@ -36355,7 +36355,7 @@ function decode_arithmetic(bytes3) { let symbol_count = u16(); let total = 1; let acc = [0, 1]; - for (let i2 = 1; i2 < symbol_count; i2++) { + for (let i = 1; i < symbol_count; i++) { acc.push(total += u16()); } let skip = u16(); @@ -36376,7 +36376,7 @@ function decode_arithmetic(bytes3) { const QRTR = HALF >> 1; const MASK = FULL - 1; let register2 = 0; - for (let i2 = 0; i2 < N2; i2++) + for (let i = 0; i < N2; i++) register2 = register2 << 1 | read_bit(); let symbols = []; let low = 0; @@ -36432,25 +36432,25 @@ function read_payload(v3) { function read_compressed_payload(bytes3) { return read_payload(decode_arithmetic(bytes3)); } -function signed(i2) { - return i2 & 1 ? ~i2 >> 1 : i2 >> 1; +function signed(i) { + return i & 1 ? ~i >> 1 : i >> 1; } function read_counts(n2, next) { let v3 = Array(n2); - for (let i2 = 0; i2 < n2; i2++) - v3[i2] = 1 + next(); + for (let i = 0; i < n2; i++) + v3[i] = 1 + next(); return v3; } function read_ascending(n2, next) { let v3 = Array(n2); - for (let i2 = 0, x = -1; i2 < n2; i2++) - v3[i2] = x += 1 + next(); + for (let i = 0, x = -1; i < n2; i++) + v3[i] = x += 1 + next(); return v3; } function read_deltas(n2, next) { let v3 = Array(n2); - for (let i2 = 0, x = 0; i2 < n2; i2++) - v3[i2] = x += signed(next()); + for (let i = 0, x = 0; i < n2; i++) + v3[i] = x += signed(next()); return v3; } function read_member_array(next, lookup2) { @@ -36458,9 +36458,9 @@ function read_member_array(next, lookup2) { let n2 = next(); let vX = read_ascending(n2, next); let vN = read_counts(n2, next); - for (let i2 = 0; i2 < n2; i2++) { - for (let j2 = 0; j2 < vN[i2]; j2++) { - v3.push(vX[i2] + j2); + for (let i = 0; i < n2; i++) { + for (let j2 = 0; j2 < vN[i]; j2++) { + v3.push(vX[i] + j2); } } return lookup2 ? v3.map((x) => lookup2[x]) : v3; @@ -36484,16 +36484,16 @@ function read_mapped_map(next) { function read_zero_terminated_array(next) { let v3 = []; while (true) { - let i2 = next(); - if (i2 == 0) + let i = next(); + if (i == 0) break; - v3.push(i2); + v3.push(i); } return v3; } function read_transposed(n2, w2, next) { let m2 = Array(n2).fill(void 0).map(() => []); - for (let i2 = 0; i2 < w2; i2++) { + for (let i = 0; i < w2; i++) { read_deltas(n2, next).forEach((x, j2) => m2[j2].push(x)); } return m2; @@ -36503,9 +36503,9 @@ function read_linear_table(w2, next) { let dy = next(); let vN = read_zero_terminated_array(next); let m2 = read_transposed(vN.length, 1 + w2, next); - return flat(m2.map((v3, i2) => { + return flat(m2.map((v3, i) => { const x = v3[0], ys = v3.slice(1); - return Array(vN[i2]).fill(void 0).map((_, j2) => { + return Array(vN[i]).fill(void 0).map((_, j2) => { let j_dy = j2 * dy; return [x + j2 * dx, ys.map((y2) => y2 + j_dy)]; }); @@ -36558,8 +36558,8 @@ function ens_normalize_post_check(name2) { for (let label of name2.split(".")) { let cps = explode_cp(label); try { - for (let i2 = cps.lastIndexOf(UNDERSCORE) - 1; i2 >= 0; i2--) { - if (cps[i2] !== UNDERSCORE) { + for (let i = cps.lastIndexOf(UNDERSCORE) - 1; i >= 0; i--) { + if (cps[i] !== UNDERSCORE) { throw new Error(`underscore only allowed at start`); } } @@ -36637,7 +36637,7 @@ function consume_emoji_reversed(cps, eaten) { } return emoji; } -const logger$p = new Logger$3(version$o); +const logger$p = new Logger$1(version$o); const Zeros$1 = new Uint8Array(32); Zeros$1.fill(0); function checkComponent(comp) { @@ -36653,11 +36653,11 @@ function ensNameSplit(name2) { return comps; } let last = 0; - for (let i2 = 0; i2 < bytes3.length; i2++) { - const d2 = bytes3[i2]; + for (let i = 0; i < bytes3.length; i++) { + const d2 = bytes3[i]; if (d2 === 46) { - comps.push(checkComponent(bytes3.slice(last, i2))); - last = i2 + 1; + comps.push(checkComponent(bytes3.slice(last, i))); + last = i + 1; } } if (last >= bytes3.length) { @@ -36736,7 +36736,7 @@ var __awaiter$d = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$o = new Logger$3(version$o); +const logger$o = new Logger$1(version$o); const padding = new Uint8Array(32); padding.fill(0); const NegativeOne = BigNumber.from(-1); @@ -37143,7 +37143,7 @@ const lib_esm$c = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro messagePrefix, namehash: namehash$1 }, Symbol.toStringTag, { value: "Module" })); -const logger$n = new Logger$3(version$s); +const logger$n = new Logger$1(version$s); class LogDescription extends Description { } class TransactionDescription extends Description { @@ -37449,7 +37449,7 @@ class Interface { break; } } - return logger$n.throwError("call revert exception" + message, Logger$3.errors.CALL_EXCEPTION, { + return logger$n.throwError("call revert exception" + message, Logger$1.errors.CALL_EXCEPTION, { method: functionFragment.format(), data: hexlify(data), errorArgs, @@ -37471,7 +37471,7 @@ class Interface { eventFragment = this.getEvent(eventFragment); } if (values.length > eventFragment.inputs.length) { - logger$n.throwError("too many arguments for " + eventFragment.format(), Logger$3.errors.UNEXPECTED_ARGUMENT, { + logger$n.throwError("too many arguments for " + eventFragment.format(), Logger$1.errors.UNEXPECTED_ARGUMENT, { argument: "values", value: values }); @@ -37563,7 +37563,7 @@ class Interface { if (topics != null && !eventFragment.anonymous) { let topicHash = this.getEventTopic(eventFragment); if (!isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) { - logger$n.throwError("fragment/topic mismatch", Logger$3.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] }); + logger$n.throwError("fragment/topic mismatch", Logger$1.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] }); } topics = topics.slice(1); } @@ -37622,13 +37622,13 @@ class Interface { } } }); - for (let i2 = 0; i2 < result.length; i2++) { - const value = result[i2]; + for (let i = 0; i < result.length; i++) { + const value = result[i]; if (value instanceof Error) { - Object.defineProperty(result, i2, { + Object.defineProperty(result, i, { enumerable: true, get: () => { - throw wrapAccessError(`index ${i2}`, value); + throw wrapAccessError(`index ${i}`, value); } }); } @@ -37742,7 +37742,7 @@ var __awaiter$c = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$m = new Logger$3(version$n); +const logger$m = new Logger$1(version$n); class ForkEvent extends Description { static isForkEvent(value) { return !!(value && value._isForkEvent); @@ -37810,7 +37810,7 @@ var __awaiter$b = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$l = new Logger$3(version$m); +const logger$l = new Logger$1(version$m); const allowedTransactionKeys$2 = [ "accessList", "ccipReadEnabled", @@ -37828,9 +37828,9 @@ const allowedTransactionKeys$2 = [ "value" ]; const forwardErrors = [ - Logger$3.errors.INSUFFICIENT_FUNDS, - Logger$3.errors.NONCE_EXPIRED, - Logger$3.errors.REPLACEMENT_UNDERPRICED + Logger$1.errors.INSUFFICIENT_FUNDS, + Logger$1.errors.NONCE_EXPIRED, + Logger$1.errors.REPLACEMENT_UNDERPRICED ]; let Signer$1 = class Signer { /////////////////// @@ -37990,7 +37990,7 @@ let Signer$1 = class Signer { } } else if (feeData.gasPrice != null) { if (hasEip1559) { - logger$l.throwError("network does not support EIP-1559", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$l.throwError("network does not support EIP-1559", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "populateTransaction" }); } @@ -37999,7 +37999,7 @@ let Signer$1 = class Signer { } tx.type = 0; } else { - logger$l.throwError("failed to get consistent fee data", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$l.throwError("failed to get consistent fee data", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "signer.getFeeData" }); } @@ -38020,7 +38020,7 @@ let Signer$1 = class Signer { if (forwardErrors.indexOf(error.code) >= 0) { throw error; } - return logger$l.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$3.errors.UNPREDICTABLE_GAS_LIMIT, { + return logger$l.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$1.errors.UNPREDICTABLE_GAS_LIMIT, { error, tx }); @@ -38046,7 +38046,7 @@ let Signer$1 = class Signer { // Sub-classes SHOULD leave these alone _checkProvider(operation) { if (!this.provider) { - logger$l.throwError("missing provider", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$l.throwError("missing provider", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: operation || "_checkProvider" }); } @@ -38066,7 +38066,7 @@ class VoidSigner extends Signer$1 { } _fail(message, operation) { return Promise.resolve().then(() => { - logger$l.throwError(message, Logger$3.errors.UNSUPPORTED_OPERATION, { operation }); + logger$l.throwError(message, Logger$1.errors.UNSUPPORTED_OPERATION, { operation }); }); } signMessage(message) { @@ -38124,14 +38124,14 @@ var inherits_browserExports = inherits_browser$1.exports; var assert$a = minimalisticAssert$1; var inherits = inherits_browserExports; utils$c.inherits = inherits; -function isSurrogatePair(msg, i2) { - if ((msg.charCodeAt(i2) & 64512) !== 55296) { +function isSurrogatePair(msg, i) { + if ((msg.charCodeAt(i) & 64512) !== 55296) { return false; } - if (i2 < 0 || i2 + 1 >= msg.length) { + if (i < 0 || i + 1 >= msg.length) { return false; } - return (msg.charCodeAt(i2 + 1) & 64512) === 56320; + return (msg.charCodeAt(i + 1) & 64512) === 56320; } function toArray(msg, enc) { if (Array.isArray(msg)) @@ -38142,15 +38142,15 @@ function toArray(msg, enc) { if (typeof msg === "string") { if (!enc) { var p2 = 0; - for (var i2 = 0; i2 < msg.length; i2++) { - var c2 = msg.charCodeAt(i2); + for (var i = 0; i < msg.length; i++) { + var c2 = msg.charCodeAt(i); if (c2 < 128) { res[p2++] = c2; } else if (c2 < 2048) { res[p2++] = c2 >> 6 | 192; res[p2++] = c2 & 63 | 128; - } else if (isSurrogatePair(msg, i2)) { - c2 = 65536 + ((c2 & 1023) << 10) + (msg.charCodeAt(++i2) & 1023); + } else if (isSurrogatePair(msg, i)) { + c2 = 65536 + ((c2 & 1023) << 10) + (msg.charCodeAt(++i) & 1023); res[p2++] = c2 >> 18 | 240; res[p2++] = c2 >> 12 & 63 | 128; res[p2++] = c2 >> 6 & 63 | 128; @@ -38165,20 +38165,20 @@ function toArray(msg, enc) { msg = msg.replace(/[^a-z0-9]+/ig, ""); if (msg.length % 2 !== 0) msg = "0" + msg; - for (i2 = 0; i2 < msg.length; i2 += 2) - res.push(parseInt(msg[i2] + msg[i2 + 1], 16)); + for (i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); } } else { - for (i2 = 0; i2 < msg.length; i2++) - res[i2] = msg[i2] | 0; + for (i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; } return res; } utils$c.toArray = toArray; function toHex$2(msg) { var res = ""; - for (var i2 = 0; i2 < msg.length; i2++) - res += zero2(msg[i2].toString(16)); + for (var i = 0; i < msg.length; i++) + res += zero2(msg[i].toString(16)); return res; } utils$c.toHex = toHex$2; @@ -38189,8 +38189,8 @@ function htonl(w2) { utils$c.htonl = htonl; function toHex32(msg, endian) { var res = ""; - for (var i2 = 0; i2 < msg.length; i2++) { - var w2 = msg[i2]; + for (var i = 0; i < msg.length; i++) { + var w2 = msg[i]; if (endian === "little") w2 = htonl(w2); res += zero8(w2.toString(16)); @@ -38228,21 +38228,21 @@ function join32(msg, start, end, endian) { var len = end - start; assert$a(len % 4 === 0); var res = new Array(len / 4); - for (var i2 = 0, k2 = start; i2 < res.length; i2++, k2 += 4) { + for (var i = 0, k2 = start; i < res.length; i++, k2 += 4) { var w2; if (endian === "big") w2 = msg[k2] << 24 | msg[k2 + 1] << 16 | msg[k2 + 2] << 8 | msg[k2 + 3]; else w2 = msg[k2 + 3] << 24 | msg[k2 + 2] << 16 | msg[k2 + 1] << 8 | msg[k2]; - res[i2] = w2 >>> 0; + res[i] = w2 >>> 0; } return res; } utils$c.join32 = join32; function split32(msg, endian) { var res = new Array(msg.length * 4); - for (var i2 = 0, k2 = 0; i2 < msg.length; i2++, k2 += 4) { - var m2 = msg[i2]; + for (var i = 0, k2 = 0; i < msg.length; i++, k2 += 4) { + var m2 = msg[i]; if (endian === "big") { res[k2] = m2 >>> 24; res[k2 + 1] = m2 >>> 16 & 255; @@ -38388,8 +38388,8 @@ BlockHash$4.prototype.update = function update(msg, enc) { if (this.pending.length === 0) this.pending = null; msg = utils$b.join32(msg, 0, msg.length - r2, this.endian); - for (var i2 = 0; i2 < msg.length; i2 += this._delta32) - this._update(msg, i2, i2 + this._delta32); + for (var i = 0; i < msg.length; i += this._delta32) + this._update(msg, i, i + this._delta32); } return this; }; @@ -38404,31 +38404,31 @@ BlockHash$4.prototype._pad = function pad() { var k2 = bytes3 - (len + this.padLength) % bytes3; var res = new Array(k2 + this.padLength); res[0] = 128; - for (var i2 = 1; i2 < k2; i2++) - res[i2] = 0; + for (var i = 1; i < k2; i++) + res[i] = 0; len <<= 3; if (this.endian === "big") { for (var t2 = 8; t2 < this.padLength; t2++) - res[i2++] = 0; - res[i2++] = 0; - res[i2++] = 0; - res[i2++] = 0; - res[i2++] = 0; - res[i2++] = len >>> 24 & 255; - res[i2++] = len >>> 16 & 255; - res[i2++] = len >>> 8 & 255; - res[i2++] = len & 255; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = len >>> 24 & 255; + res[i++] = len >>> 16 & 255; + res[i++] = len >>> 8 & 255; + res[i++] = len & 255; } else { - res[i2++] = len & 255; - res[i2++] = len >>> 8 & 255; - res[i2++] = len >>> 16 & 255; - res[i2++] = len >>> 24 & 255; - res[i2++] = 0; - res[i2++] = 0; - res[i2++] = 0; - res[i2++] = 0; + res[i++] = len & 255; + res[i++] = len >>> 8 & 255; + res[i++] = len >>> 16 & 255; + res[i++] = len >>> 24 & 255; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; + res[i++] = 0; for (t2 = 8; t2 < this.padLength; t2++) - res[i2++] = 0; + res[i++] = 0; } return res; }; @@ -38508,18 +38508,18 @@ SHA1.hmacStrength = 80; SHA1.padLength = 64; SHA1.prototype._update = function _update(msg, start) { var W2 = this.W; - for (var i2 = 0; i2 < 16; i2++) - W2[i2] = msg[start + i2]; - for (; i2 < W2.length; i2++) - W2[i2] = rotl32$1(W2[i2 - 3] ^ W2[i2 - 8] ^ W2[i2 - 14] ^ W2[i2 - 16], 1); + for (var i = 0; i < 16; i++) + W2[i] = msg[start + i]; + for (; i < W2.length; i++) + W2[i] = rotl32$1(W2[i - 3] ^ W2[i - 8] ^ W2[i - 14] ^ W2[i - 16], 1); var a2 = this.h[0]; var b2 = this.h[1]; var c2 = this.h[2]; var d2 = this.h[3]; var e2 = this.h[4]; - for (i2 = 0; i2 < W2.length; i2++) { - var s2 = ~~(i2 / 20); - var t2 = sum32_5$1(rotl32$1(a2, 5), ft_1(s2, b2, c2, d2), e2, W2[i2], sha1_K[s2]); + for (i = 0; i < W2.length; i++) { + var s2 = ~~(i / 20); + var t2 = sum32_5$1(rotl32$1(a2, 5), ft_1(s2, b2, c2, d2), e2, W2[i], sha1_K[s2]); e2 = d2; d2 = c2; c2 = rotl32$1(b2, 30); @@ -38643,10 +38643,10 @@ SHA256$3.hmacStrength = 192; SHA256$3.padLength = 64; SHA256$3.prototype._update = function _update2(msg, start) { var W2 = this.W; - for (var i2 = 0; i2 < 16; i2++) - W2[i2] = msg[start + i2]; - for (; i2 < W2.length; i2++) - W2[i2] = sum32_4$1(g1_256(W2[i2 - 2]), W2[i2 - 7], g0_256(W2[i2 - 15]), W2[i2 - 16]); + for (var i = 0; i < 16; i++) + W2[i] = msg[start + i]; + for (; i < W2.length; i++) + W2[i] = sum32_4$1(g1_256(W2[i - 2]), W2[i - 7], g0_256(W2[i - 15]), W2[i - 16]); var a2 = this.h[0]; var b2 = this.h[1]; var c2 = this.h[2]; @@ -38656,8 +38656,8 @@ SHA256$3.prototype._update = function _update2(msg, start) { var g2 = this.h[6]; var h2 = this.h[7]; assert$8(this.k.length === W2.length); - for (i2 = 0; i2 < W2.length; i2++) { - var T1 = sum32_5(h2, s1_256(e2), ch32(e2, f2, g2), this.k[i2], W2[i2]); + for (i = 0; i < W2.length; i++) { + var T1 = sum32_5(h2, s1_256(e2), ch32(e2, f2, g2), this.k[i], W2[i]); var T2 = sum32$1(s0_256(a2), maj32(a2, b2, c2)); h2 = g2; g2 = f2; @@ -38922,18 +38922,18 @@ SHA512$1.hmacStrength = 192; SHA512$1.padLength = 128; SHA512$1.prototype._prepareBlock = function _prepareBlock(msg, start) { var W2 = this.W; - for (var i2 = 0; i2 < 32; i2++) - W2[i2] = msg[start + i2]; - for (; i2 < W2.length; i2 += 2) { - var c0_hi = g1_512_hi(W2[i2 - 4], W2[i2 - 3]); - var c0_lo = g1_512_lo(W2[i2 - 4], W2[i2 - 3]); - var c1_hi = W2[i2 - 14]; - var c1_lo = W2[i2 - 13]; - var c2_hi = g0_512_hi(W2[i2 - 30], W2[i2 - 29]); - var c2_lo = g0_512_lo(W2[i2 - 30], W2[i2 - 29]); - var c3_hi = W2[i2 - 32]; - var c3_lo = W2[i2 - 31]; - W2[i2] = sum64_4_hi( + for (var i = 0; i < 32; i++) + W2[i] = msg[start + i]; + for (; i < W2.length; i += 2) { + var c0_hi = g1_512_hi(W2[i - 4], W2[i - 3]); + var c0_lo = g1_512_lo(W2[i - 4], W2[i - 3]); + var c1_hi = W2[i - 14]; + var c1_lo = W2[i - 13]; + var c2_hi = g0_512_hi(W2[i - 30], W2[i - 29]); + var c2_lo = g0_512_lo(W2[i - 30], W2[i - 29]); + var c3_hi = W2[i - 32]; + var c3_lo = W2[i - 31]; + W2[i] = sum64_4_hi( c0_hi, c0_lo, c1_hi, @@ -38943,7 +38943,7 @@ SHA512$1.prototype._prepareBlock = function _prepareBlock(msg, start) { c3_hi, c3_lo ); - W2[i2 + 1] = sum64_4_lo( + W2[i + 1] = sum64_4_lo( c0_hi, c0_lo, c1_hi, @@ -38975,17 +38975,17 @@ SHA512$1.prototype._update = function _update3(msg, start) { var hh2 = this.h[14]; var hl2 = this.h[15]; assert$7(this.k.length === W2.length); - for (var i2 = 0; i2 < W2.length; i2 += 2) { + for (var i = 0; i < W2.length; i += 2) { var c0_hi = hh2; var c0_lo = hl2; var c1_hi = s1_512_hi(eh2, el2); var c1_lo = s1_512_lo(eh2, el2); var c2_hi = ch64_hi(eh2, el2, fh2, fl2, gh2); var c2_lo = ch64_lo(eh2, el2, fh2, fl2, gh2, gl2); - var c3_hi = this.k[i2]; - var c3_lo = this.k[i2 + 1]; - var c4_hi = W2[i2]; - var c4_lo = W2[i2 + 1]; + var c3_hi = this.k[i]; + var c3_lo = this.k[i + 1]; + var c4_hi = W2[i]; + var c4_lo = W2[i + 1]; var T1_hi = sum64_5_hi( c0_hi, c0_lo, @@ -39638,13 +39638,13 @@ Hmac.prototype._init = function init(key2) { if (key2.length > this.blockSize) key2 = new this.Hash().update(key2).digest(); assert$6(key2.length <= this.blockSize); - for (var i2 = key2.length; i2 < this.blockSize; i2++) + for (var i = key2.length; i < this.blockSize; i++) key2.push(0); - for (i2 = 0; i2 < key2.length; i2++) - key2[i2] ^= 54; + for (i = 0; i < key2.length; i++) + key2[i] ^= 54; this.inner = new this.Hash().update(key2); - for (i2 = 0; i2 < key2.length; i2++) - key2[i2] ^= 106; + for (i = 0; i < key2.length; i++) + key2[i] ^= 106; this.outer = new this.Hash().update(key2); }; Hmac.prototype.update = function update3(msg, enc) { @@ -39700,19 +39700,19 @@ var utils_1 = createCommonjsModule(function(module2, exports) { return []; var res = []; if (typeof msg !== "string") { - for (var i2 = 0; i2 < msg.length; i2++) - res[i2] = msg[i2] | 0; + for (var i = 0; i < msg.length; i++) + res[i] = msg[i] | 0; return res; } if (enc === "hex") { msg = msg.replace(/[^a-z0-9]+/ig, ""); if (msg.length % 2 !== 0) msg = "0" + msg; - for (var i2 = 0; i2 < msg.length; i2 += 2) - res.push(parseInt(msg[i2] + msg[i2 + 1], 16)); + for (var i = 0; i < msg.length; i += 2) + res.push(parseInt(msg[i] + msg[i + 1], 16)); } else { - for (var i2 = 0; i2 < msg.length; i2++) { - var c2 = msg.charCodeAt(i2); + for (var i = 0; i < msg.length; i++) { + var c2 = msg.charCodeAt(i); var hi2 = c2 >> 8; var lo = c2 & 255; if (hi2) @@ -39733,8 +39733,8 @@ var utils_1 = createCommonjsModule(function(module2, exports) { utils2.zero2 = zero22; function toHex2(msg) { var res = ""; - for (var i2 = 0; i2 < msg.length; i2++) - res += zero22(msg[i2].toString(16)); + for (var i = 0; i < msg.length; i++) + res += zero22(msg[i].toString(16)); return res; } utils2.toHex = toHex2; @@ -39757,7 +39757,7 @@ var utils_1$1 = createCommonjsModule(function(module2, exports) { naf.fill(0); var ws = 1 << w2 + 1; var k2 = num.clone(); - for (var i2 = 0; i2 < naf.length; i2++) { + for (var i = 0; i < naf.length; i++) { var z; var mod2 = k2.andln(ws - 1); if (k2.isOdd()) { @@ -39769,7 +39769,7 @@ var utils_1$1 = createCommonjsModule(function(module2, exports) { } else { z = 0; } - naf[i2] = z; + naf[i] = z; k2.iushrn(1); } return naf; @@ -39889,12 +39889,12 @@ BaseCurve.prototype._fixedNafMul = function _fixedNafMul(p2, k2) { } var a2 = this.jpoint(null, null, null); var b2 = this.jpoint(null, null, null); - for (var i2 = I2; i2 > 0; i2--) { + for (var i = I2; i > 0; i--) { for (j2 = 0; j2 < repr.length; j2++) { nafW = repr[j2]; - if (nafW === i2) + if (nafW === i) b2 = b2.mixedAdd(doubles.points[j2]); - else if (nafW === -i2) + else if (nafW === -i) b2 = b2.mixedAdd(doubles.points[j2].neg()); } a2 = a2.add(b2); @@ -39908,15 +39908,15 @@ BaseCurve.prototype._wnafMul = function _wnafMul(p2, k2) { var wnd = nafPoints.points; var naf = getNAF(k2, w2, this._bitLength); var acc = this.jpoint(null, null, null); - for (var i2 = naf.length - 1; i2 >= 0; i2--) { - for (var l2 = 0; i2 >= 0 && naf[i2] === 0; i2--) + for (var i = naf.length - 1; i >= 0; i--) { + for (var l2 = 0; i >= 0 && naf[i] === 0; i--) l2++; - if (i2 >= 0) + if (i >= 0) l2++; acc = acc.dblp(l2); - if (i2 < 0) + if (i < 0) break; - var z = naf[i2]; + var z = naf[i]; assert$1(z !== 0); if (p2.type === "affine") { if (z > 0) @@ -39937,18 +39937,18 @@ BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, points, coeffs, len var wnd = this._wnafT2; var naf = this._wnafT3; var max2 = 0; - var i2; + var i; var j2; var p2; - for (i2 = 0; i2 < len; i2++) { - p2 = points[i2]; + for (i = 0; i < len; i++) { + p2 = points[i]; var nafPoints = p2._getNAFPoints(defW); - wndWidth[i2] = nafPoints.wnd; - wnd[i2] = nafPoints.points; + wndWidth[i] = nafPoints.wnd; + wnd[i] = nafPoints.points; } - for (i2 = len - 1; i2 >= 1; i2 -= 2) { - var a2 = i2 - 1; - var b2 = i2; + for (i = len - 1; i >= 1; i -= 2) { + var a2 = i - 1; + var b2 = i; if (wndWidth[a2] !== 1 || wndWidth[b2] !== 1) { naf[a2] = getNAF(coeffs[a2], wndWidth[a2], this._bitLength); naf[b2] = getNAF(coeffs[b2], wndWidth[b2], this._bitLength); @@ -40010,24 +40010,24 @@ BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, points, coeffs, len } var acc = this.jpoint(null, null, null); var tmp = this._wnafT4; - for (i2 = max2; i2 >= 0; i2--) { + for (i = max2; i >= 0; i--) { var k2 = 0; - while (i2 >= 0) { + while (i >= 0) { var zero3 = true; for (j2 = 0; j2 < len; j2++) { - tmp[j2] = naf[j2][i2] | 0; + tmp[j2] = naf[j2][i] | 0; if (tmp[j2] !== 0) zero3 = false; } if (!zero3) break; k2++; - i2--; + i--; } - if (i2 >= 0) + if (i >= 0) k2++; acc = acc.dblp(k2); - if (i2 < 0) + if (i < 0) break; for (j2 = 0; j2 < len; j2++) { var z = tmp[j2]; @@ -40043,8 +40043,8 @@ BaseCurve.prototype._wnafMulAdd = function _wnafMulAdd(defW, points, coeffs, len acc = acc.add(p2); } } - for (i2 = 0; i2 < len; i2++) - wnd[i2] = null; + for (i = 0; i < len; i++) + wnd[i] = null; if (jacobianResult) return acc; else @@ -40120,7 +40120,7 @@ BasePoint.prototype._getDoubles = function _getDoubles(step, power) { return this.precomputed.doubles; var doubles = [this]; var acc = this; - for (var i2 = 0; i2 < power; i2 += step) { + for (var i = 0; i < power; i += step) { for (var j2 = 0; j2 < step; j2++) acc = acc.dbl(); doubles.push(acc); @@ -40136,8 +40136,8 @@ BasePoint.prototype._getNAFPoints = function _getNAFPoints(wnd) { var res = [this]; var max2 = (1 << wnd) - 1; var dbl3 = max2 === 1 ? null : this.dbl(); - for (var i2 = 1; i2 < max2; i2++) - res[i2] = res[i2 - 1].add(dbl3); + for (var i = 1; i < max2; i++) + res[i] = res[i - 1].add(dbl3); return { wnd, points: res @@ -40148,7 +40148,7 @@ BasePoint.prototype._getBeta = function _getBeta() { }; BasePoint.prototype.dblp = function dblp(k2) { var r2 = this; - for (var i2 = 0; i2 < k2; i2++) + for (var i = 0; i < k2; i++) r2 = r2.dbl(); return r2; }; @@ -40258,7 +40258,7 @@ ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { var a2; var b2; var prevR; - var i2 = 0; + var i = 0; var r2; var x; while (u2.cmpn(0) !== 0) { @@ -40271,7 +40271,7 @@ ShortCurve.prototype._getEndoBasis = function _getEndoBasis(lambda) { b0 = x1; a1 = r2.neg(); b1 = x; - } else if (a1 && ++i2 === 2) { + } else if (a1 && ++i === 2) { break; } prevR = r2; @@ -40342,9 +40342,9 @@ ShortCurve.prototype.validate = function validate3(point3) { ShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs, jacobianResult) { var npoints = this._endoWnafT1; var ncoeffs = this._endoWnafT2; - for (var i2 = 0; i2 < points.length; i2++) { - var split2 = this._endoSplit(coeffs[i2]); - var p2 = points[i2]; + for (var i = 0; i < points.length; i++) { + var split2 = this._endoSplit(coeffs[i]); + var p2 = points[i]; var beta = p2._getBeta(); if (split2.k1.negative) { split2.k1.ineg(); @@ -40354,13 +40354,13 @@ ShortCurve.prototype._endoWnafMulAdd = function _endoWnafMulAdd(points, coeffs, split2.k2.ineg(); beta = beta.neg(true); } - npoints[i2 * 2] = p2; - npoints[i2 * 2 + 1] = beta; - ncoeffs[i2 * 2] = split2.k1; - ncoeffs[i2 * 2 + 1] = split2.k2; + npoints[i * 2] = p2; + npoints[i * 2 + 1] = beta; + ncoeffs[i * 2] = split2.k1; + ncoeffs[i * 2 + 1] = split2.k2; } - var res = this._wnafMulAdd(1, npoints, ncoeffs, i2 * 2, jacobianResult); - for (var j2 = 0; j2 < i2 * 2; j2++) { + var res = this._wnafMulAdd(1, npoints, ncoeffs, i * 2, jacobianResult); + for (var j2 = 0; j2 < i * 2; j2++) { npoints[j2] = null; ncoeffs[j2] = null; } @@ -40656,10 +40656,10 @@ JPoint.prototype.dblp = function dblp2(pow3) { return this; if (!pow3) return this.dbl(); - var i2; + var i; if (this.curve.zeroA || this.curve.threeA) { var r2 = this; - for (i2 = 0; i2 < pow3; i2++) + for (i = 0; i < pow3; i++) r2 = r2.dbl(); return r2; } @@ -40670,7 +40670,7 @@ JPoint.prototype.dblp = function dblp2(pow3) { var jz = this.z; var jz4 = jz.redSqr().redSqr(); var jyd = jy.redAdd(jy); - for (i2 = 0; i2 < pow3; i2++) { + for (i = 0; i < pow3; i++) { var jx2 = jx.redSqr(); var jyd2 = jyd.redSqr(); var jyd4 = jyd2.redSqr(); @@ -40681,7 +40681,7 @@ JPoint.prototype.dblp = function dblp2(pow3) { var dny = c2.redMul(t2); dny = dny.redIAdd(dny).redISub(jyd4); var nz = jyd.redMul(jz); - if (i2 + 1 < pow3) + if (i + 1 < pow3) jz4 = jz4.redMul(jyd4); jx = nx; jz = nz; @@ -41070,9 +41070,9 @@ HmacDRBG.prototype._init = function init2(entropy, nonce, pers) { var seed = entropy.concat(nonce).concat(pers); this.K = new Array(this.outLen / 8); this.V = new Array(this.outLen / 8); - for (var i2 = 0; i2 < this.V.length; i2++) { - this.K[i2] = 0; - this.V[i2] = 1; + for (var i = 0; i < this.V.length; i++) { + this.K[i] = 0; + this.V[i] = 1; } this._update(seed); this._reseed = 1; @@ -41242,7 +41242,7 @@ function getLength(buf, p2) { return false; } var val = 0; - for (var i2 = 0, off = p2.place; i2 < octetLen; i2++, off++) { + for (var i = 0, off = p2.place; i < octetLen; i++, off++) { val <<= 8; val |= buf[off]; val >>>= 0; @@ -41254,15 +41254,15 @@ function getLength(buf, p2) { return val; } function rmPadding(buf) { - var i2 = 0; + var i = 0; var len = buf.length - 1; - while (!buf[i2] && !(buf[i2 + 1] & 128) && i2 < len) { - i2++; + while (!buf[i] && !(buf[i + 1] & 128) && i < len) { + i++; } - if (i2 === 0) { + if (i === 0) { return buf; } - return buf.slice(i2); + return buf.slice(i); } Signature.prototype._importDER = function _importDER(data, enc) { data = utils_1$1.toArray(data, enc); @@ -41511,15 +41511,15 @@ EC.prototype.getKeyRecoveryParam = function(e2, signature$12, Q2, enc) { signature$12 = new signature$3(signature$12, enc); if (signature$12.recoveryParam !== null) return signature$12.recoveryParam; - for (var i2 = 0; i2 < 4; i2++) { + for (var i = 0; i < 4; i++) { var Qprime; try { - Qprime = this.recoverPubKey(e2, signature$12, i2); + Qprime = this.recoverPubKey(e2, signature$12, i); } catch (e3) { continue; } if (Qprime.eq(Q2)) - return i2; + return i; } throw new Error("Unable to find valid recovery factor"); }; @@ -41540,7 +41540,7 @@ var elliptic_1 = createCommonjsModule(function(module2, exports) { }); var EC$1 = elliptic_1.ec; const version$l = "signing-key/5.7.0"; -const logger$k = new Logger$3(version$l); +const logger$k = new Logger$1(version$l); let _curve = null; function getCurve() { if (!_curve) { @@ -41620,7 +41620,7 @@ const lib_esm$a = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro recoverPublicKey }, Symbol.toStringTag, { value: "Module" })); const version$k = "transactions/5.7.0"; -const logger$j = new Logger$3(version$k); +const logger$j = new Logger$1(version$k); var TransactionTypes; (function(TransactionTypes2) { TransactionTypes2[TransactionTypes2["legacy"] = 0] = "legacy"; @@ -41825,7 +41825,7 @@ function serialize$2(transaction2, signature2) { case 2: return _serializeEip1559(transaction2, signature2); } - return logger$j.throwError(`unsupported transaction type: ${transaction2.type}`, Logger$3.errors.UNSUPPORTED_OPERATION, { + return logger$j.throwError(`unsupported transaction type: ${transaction2.type}`, Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "serializeTransaction", transactionType: transaction2.type }); @@ -41959,7 +41959,7 @@ function parse$2(rawTransaction) { case 2: return _parseEip1559(payload); } - return logger$j.throwError(`unsupported transaction type: ${payload[0]}`, Logger$3.errors.UNSUPPORTED_OPERATION, { + return logger$j.throwError(`unsupported transaction type: ${payload[0]}`, Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "parseTransaction", transactionType: payload[0] }); @@ -42003,7 +42003,7 @@ var __awaiter$a = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$i = new Logger$3(version$j); +const logger$i = new Logger$1(version$j); function resolveName(resolver, nameOrPromise) { return __awaiter$a(this, void 0, void 0, function* () { const name2 = yield nameOrPromise; @@ -42015,7 +42015,7 @@ function resolveName(resolver, nameOrPromise) { } catch (error) { } if (!resolver) { - logger$i.throwError("a provider or signer is needed to resolve ENS names", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$i.throwError("a provider or signer is needed to resolve ENS names", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "resolveName" }); } @@ -42041,7 +42041,7 @@ function resolveAddresses(resolver, value, paramType) { } if (paramType.baseType === "array") { if (!Array.isArray(value)) { - return Promise.reject(logger$i.makeError("invalid value for array", Logger$3.errors.INVALID_ARGUMENT, { + return Promise.reject(logger$i.makeError("invalid value for array", Logger$1.errors.INVALID_ARGUMENT, { argument: "value", value })); @@ -42065,7 +42065,7 @@ function populateTransaction(contract, fragment, args) { signer: contract.signer.getAddress() }).then((check) => __awaiter$a(this, void 0, void 0, function* () { if (getAddress$1(check.signer) !== check.override) { - logger$i.throwError("Contract with a Signer cannot override from", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$i.throwError("Contract with a Signer cannot override from", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "overrides.from" }); } @@ -42115,9 +42115,9 @@ function populateTransaction(contract, fragment, args) { if (tx.gasLimit == null && fragment.gas != null) { let intrinsic = 21e3; const bytes3 = arrayify(data); - for (let i2 = 0; i2 < bytes3.length; i2++) { + for (let i = 0; i < bytes3.length; i++) { intrinsic += 4; - if (bytes3[i2]) { + if (bytes3[i]) { intrinsic += 64; } } @@ -42126,7 +42126,7 @@ function populateTransaction(contract, fragment, args) { if (ro.value) { const roValue = BigNumber.from(ro.value); if (!roValue.isZero() && !fragment.payable) { - logger$i.throwError("non-payable method cannot override value", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$i.throwError("non-payable method cannot override value", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "overrides.value", value: overrides.value }); @@ -42152,7 +42152,7 @@ function populateTransaction(contract, fragment, args) { delete overrides.ccipReadEnabled; const leftovers = Object.keys(overrides).filter((key2) => overrides[key2] != null); if (leftovers.length) { - logger$i.throwError(`cannot override ${leftovers.map((l2) => JSON.stringify(l2)).join(",")}`, Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$i.throwError(`cannot override ${leftovers.map((l2) => JSON.stringify(l2)).join(",")}`, Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "overrides", overrides: leftovers }); @@ -42170,7 +42170,7 @@ function buildEstimate(contract, fragment) { return function(...args) { return __awaiter$a(this, void 0, void 0, function* () { if (!signerOrProvider) { - logger$i.throwError("estimate require a provider or signer", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$i.throwError("estimate require a provider or signer", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" }); } @@ -42241,7 +42241,7 @@ function buildCall(contract, fragment, collapseSimple) { } return value; } catch (error) { - if (error.code === Logger$3.errors.CALL_EXCEPTION) { + if (error.code === Logger$1.errors.CALL_EXCEPTION) { error.address = contract.address; error.args = args; error.transaction = tx; @@ -42255,7 +42255,7 @@ function buildSend(contract, fragment) { return function(...args) { return __awaiter$a(this, void 0, void 0, function* () { if (!contract.signer) { - logger$i.throwError("sending a transaction requires a signer", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$i.throwError("sending a transaction requires a signer", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" }); } @@ -42309,7 +42309,7 @@ class RunningEvent { this._listeners = []; } listeners() { - return this._listeners.map((i2) => i2.listener); + return this._listeners.map((i) => i.listener); } listenerCount() { return this._listeners.length; @@ -42456,7 +42456,7 @@ class BaseContract { try { defineReadOnly$1(this, "resolvedAddress", Promise.resolve(getAddress$1(addressOrName))); } catch (error) { - logger$i.throwError("provider is required to use ENS name as contract address", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$i.throwError("provider is required to use ENS name as contract address", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "new Contract" }); } @@ -42544,7 +42544,7 @@ class BaseContract { } else { this._deployedPromise = this.provider.getCode(this.address, blockTag).then((code2) => { if (code2 === "0x") { - logger$i.throwError("contract not deployed", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$i.throwError("contract not deployed", Logger$1.errors.UNSUPPORTED_OPERATION, { contractAddress: this.address, operation: "getDeployed" }); @@ -42561,14 +42561,14 @@ class BaseContract { // estimateDeploy(bytecode: string, ...args): Promise fallback(overrides) { if (!this.signer) { - logger$i.throwError("sending a transactions require a signer", Logger$3.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); + logger$i.throwError("sending a transactions require a signer", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" }); } const tx = shallowCopy$1(overrides || {}); ["from", "to"].forEach(function(key2) { if (tx[key2] == null) { return; } - logger$i.throwError("cannot override " + key2, Logger$3.errors.UNSUPPORTED_OPERATION, { operation: key2 }); + logger$i.throwError("cannot override " + key2, Logger$1.errors.UNSUPPORTED_OPERATION, { operation: key2 }); }); tx.to = this.resolvedAddress; return this.deployed().then(() => { @@ -42666,7 +42666,7 @@ class BaseContract { } _addEventListener(runningEvent, listener, once) { if (!this.provider) { - logger$i.throwError("events require a provider or a signer with a provider", Logger$3.errors.UNSUPPORTED_OPERATION, { operation: "once" }); + logger$i.throwError("events require a provider or a signer with a provider", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "once" }); } runningEvent.addListener(listener, once); this._runningEvents[runningEvent.tag] = runningEvent; @@ -42791,8 +42791,8 @@ class BaseX { defineReadOnly$1(this, "base", alphabet.length); defineReadOnly$1(this, "_alphabetMap", {}); defineReadOnly$1(this, "_leader", alphabet.charAt(0)); - for (let i2 = 0; i2 < alphabet.length; i2++) { - this._alphabetMap[alphabet.charAt(i2)] = i2; + for (let i = 0; i < alphabet.length; i++) { + this._alphabetMap[alphabet.charAt(i)] = i; } } encode(value) { @@ -42801,8 +42801,8 @@ class BaseX { return ""; } let digits = [0]; - for (let i2 = 0; i2 < source.length; ++i2) { - let carry = source[i2]; + for (let i = 0; i < source.length; ++i) { + let carry = source[i]; for (let j2 = 0; j2 < digits.length; ++j2) { carry += digits[j2] << 8; digits[j2] = carry % this.base; @@ -42831,8 +42831,8 @@ class BaseX { return new Uint8Array(bytes3); } bytes3.push(0); - for (let i2 = 0; i2 < value.length; i2++) { - let byte = this._alphabetMap[value[i2]]; + for (let i = 0; i < value.length; i++) { + let byte = this._alphabetMap[value[i]]; if (byte === void 0) { throw new Error("Non-base" + this.base + " character"); } @@ -42867,7 +42867,7 @@ var SupportedAlgorithm; SupportedAlgorithm2["sha512"] = "sha512"; })(SupportedAlgorithm || (SupportedAlgorithm = {})); const version$i = "sha2/5.7.0"; -const logger$h = new Logger$3(version$i); +const logger$h = new Logger$1(version$i); function ripemd160(data) { return "0x" + hash$2.ripemd160().update(arrayify(data)).digest("hex"); } @@ -42879,7 +42879,7 @@ function sha512(data) { } function computeHmac(algorithm, key2, data) { if (!SupportedAlgorithm[algorithm]) { - logger$h.throwError("unsupported algorithm " + algorithm, Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$h.throwError("unsupported algorithm " + algorithm, Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "hmac", algorithm }); @@ -42906,11 +42906,11 @@ function pbkdf2$1(password, salt, iterations, keylen, hashAlgorithm) { block1.set(salt); let r2; let T2; - for (let i2 = 1; i2 <= l2; i2++) { - block1[salt.length] = i2 >> 24 & 255; - block1[salt.length + 1] = i2 >> 16 & 255; - block1[salt.length + 2] = i2 >> 8 & 255; - block1[salt.length + 3] = i2 & 255; + for (let i = 1; i <= l2; i++) { + block1[salt.length] = i >> 24 & 255; + block1[salt.length + 1] = i >> 16 & 255; + block1[salt.length + 2] = i >> 8 & 255; + block1[salt.length + 3] = i & 255; let U2 = arrayify(computeHmac(hashAlgorithm, password, block1)); if (!hLen) { hLen = U2.length; @@ -42924,14 +42924,14 @@ function pbkdf2$1(password, salt, iterations, keylen, hashAlgorithm) { for (let k2 = 0; k2 < hLen; k2++) T2[k2] ^= U2[k2]; } - const destPos = (i2 - 1) * hLen; - const len = i2 === l2 ? r2 : hLen; + const destPos = (i - 1) * hLen; + const len = i === l2 ? r2 : hLen; DK.set(arrayify(T2).slice(0, len), destPos); } return hexlify(DK); } const version$h = "wordlists/5.7.0"; -const logger$g = new Logger$3(version$h); +const logger$g = new Logger$1(version$h); class Wordlist { constructor(locale) { logger$g.checkAbstract(new.target, Wordlist); @@ -42947,9 +42947,9 @@ class Wordlist { } static check(wordlist2) { const words2 = []; - for (let i2 = 0; i2 < 2048; i2++) { - const word = wordlist2.getWord(i2); - if (i2 !== wordlist2.getWordIndex(word)) { + for (let i = 0; i < 2048; i++) { + const word = wordlist2.getWord(i); + if (i !== wordlist2.getWordIndex(word)) { return "0x"; } words2.push(word); @@ -42993,7 +42993,7 @@ const wordlists = { en: langEn }; const version$g = "hdnode/5.7.0"; -const logger$f = new Logger$3(version$g); +const logger$f = new Logger$1(version$g); const N = BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); const MasterSecret = toUtf8Bytes("Bitcoin seed"); const HardenedBit = 2147483648; @@ -43097,8 +43097,8 @@ class HDNode { } else { data.set(arrayify(this.publicKey)); } - for (let i2 = 24; i2 >= 0; i2 -= 8) { - data[33 + (i2 >> 3)] = index2 >> 24 - i2 & 255; + for (let i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = index2 >> 24 - i & 255; } const I2 = arrayify(computeHmac(SupportedAlgorithm.sha512, this.chainCode, data)); const IL = I2.slice(0, 32); @@ -43131,8 +43131,8 @@ class HDNode { components.shift(); } let result = this; - for (let i2 = 0; i2 < components.length; i2++) { - const component = components[i2]; + for (let i = 0; i < components.length; i++) { + const component = components[i]; if (component.match(/^[0-9]+'$/)) { const index2 = parseInt(component.substring(0, component.length - 1)); if (index2 >= HardenedBit) { @@ -43211,8 +43211,8 @@ function mnemonicToEntropy(mnemonic, wordlist2) { } const entropy = arrayify(new Uint8Array(Math.ceil(11 * words2.length / 8))); let offset2 = 0; - for (let i2 = 0; i2 < words2.length; i2++) { - let index2 = wordlist2.getWordIndex(words2[i2].normalize("NFKD")); + for (let i = 0; i < words2.length; i++) { + let index2 = wordlist2.getWordIndex(words2[i].normalize("NFKD")); if (index2 === -1) { throw new Error("invalid mnemonic"); } @@ -43240,15 +43240,15 @@ function entropyToMnemonic(entropy, wordlist2) { } const indices = [0]; let remainingBits = 11; - for (let i2 = 0; i2 < entropy.length; i2++) { + for (let i = 0; i < entropy.length; i++) { if (remainingBits > 8) { indices[indices.length - 1] <<= 8; - indices[indices.length - 1] |= entropy[i2]; + indices[indices.length - 1] |= entropy[i]; remainingBits -= 8; } else { indices[indices.length - 1] <<= remainingBits; - indices[indices.length - 1] |= entropy[i2] >> 8 - remainingBits; - indices.push(entropy[i2] & getLowerMask(8 - remainingBits)); + indices[indices.length - 1] |= entropy[i] >> 8 - remainingBits; + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); remainingBits += 3; } } @@ -43283,7 +43283,7 @@ const lib_esm$6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro mnemonicToSeed }, Symbol.toStringTag, { value: "Module" })); const version$f = "random/5.7.0"; -const logger$e = new Logger$3(version$f); +const logger$e = new Logger$1(version$f); function getGlobal() { if (typeof self !== "undefined") { return self; @@ -43302,7 +43302,7 @@ if (!crypto$2 || !crypto$2.getRandomValues) { logger$e.warn("WARNING: Missing strong random number source"); crypto$2 = { getRandomValues: function(buffer2) { - return logger$e.throwError("no secure random source avaialble", Logger$3.errors.UNSUPPORTED_OPERATION, { + return logger$e.throwError("no secure random source avaialble", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "crypto.getRandomValues" }); } @@ -43318,10 +43318,10 @@ function randomBytes$1(length) { } function shuffled(array) { array = array.slice(); - for (let i2 = array.length - 1; i2 > 0; i2--) { - const j2 = Math.floor(Math.random() * (i2 + 1)); - const tmp = array[i2]; - array[i2] = array[j2]; + for (let i = array.length - 1; i > 0; i--) { + const j2 = Math.floor(Math.random() * (i + 1)); + const tmp = array[i]; + array[i] = array[j2]; array[j2] = tmp; } return array; @@ -43341,8 +43341,8 @@ var aesJs = { exports: {} }; if (!checkInt(arrayish.length)) { return false; } - for (var i2 = 0; i2 < arrayish.length; i2++) { - if (!checkInt(arrayish[i2]) || arrayish[i2] < 0 || arrayish[i2] > 255) { + for (var i = 0; i < arrayish.length; i++) { + if (!checkInt(arrayish[i]) || arrayish[i] < 0 || arrayish[i] > 255) { return false; } } @@ -43385,13 +43385,13 @@ var aesJs = { exports: {} }; } var convertUtf8 = /* @__PURE__ */ function() { function toBytes2(text2) { - var result = [], i2 = 0; + var result = [], i = 0; text2 = encodeURI(text2); - while (i2 < text2.length) { - var c2 = text2.charCodeAt(i2++); + while (i < text2.length) { + var c2 = text2.charCodeAt(i++); if (c2 === 37) { - result.push(parseInt(text2.substr(i2, 2), 16)); - i2 += 2; + result.push(parseInt(text2.substr(i, 2), 16)); + i += 2; } else { result.push(c2); } @@ -43399,18 +43399,18 @@ var aesJs = { exports: {} }; return coerceArray(result); } function fromBytes(bytes3) { - var result = [], i2 = 0; - while (i2 < bytes3.length) { - var c2 = bytes3[i2]; + var result = [], i = 0; + while (i < bytes3.length) { + var c2 = bytes3[i]; if (c2 < 128) { result.push(String.fromCharCode(c2)); - i2++; + i++; } else if (c2 > 191 && c2 < 224) { - result.push(String.fromCharCode((c2 & 31) << 6 | bytes3[i2 + 1] & 63)); - i2 += 2; + result.push(String.fromCharCode((c2 & 31) << 6 | bytes3[i + 1] & 63)); + i += 2; } else { - result.push(String.fromCharCode((c2 & 15) << 12 | (bytes3[i2 + 1] & 63) << 6 | bytes3[i2 + 2] & 63)); - i2 += 3; + result.push(String.fromCharCode((c2 & 15) << 12 | (bytes3[i + 1] & 63) << 6 | bytes3[i + 2] & 63)); + i += 3; } } return result.join(""); @@ -43423,16 +43423,16 @@ var aesJs = { exports: {} }; var convertHex = /* @__PURE__ */ function() { function toBytes2(text2) { var result = []; - for (var i2 = 0; i2 < text2.length; i2 += 2) { - result.push(parseInt(text2.substr(i2, 2), 16)); + for (var i = 0; i < text2.length; i += 2) { + result.push(parseInt(text2.substr(i, 2), 16)); } return result; } var Hex = "0123456789abcdef"; function fromBytes(bytes3) { var result = []; - for (var i2 = 0; i2 < bytes3.length; i2++) { - var v3 = bytes3[i2]; + for (var i = 0; i < bytes3.length; i++) { + var v3 = bytes3[i]; result.push(Hex[(v3 & 240) >> 4] + Hex[v3 & 15]); } return result.join(""); @@ -43460,9 +43460,9 @@ var aesJs = { exports: {} }; var U4 = [0, 151849742, 303699484, 454499602, 607398968, 758720310, 908999204, 1059270954, 1214797936, 1097159550, 1517440620, 1400849762, 1817998408, 1699839814, 2118541908, 2001430874, 2429595872, 2581445614, 2194319100, 2345119218, 3034881240, 3186202582, 2801699524, 2951971274, 3635996816, 3518358430, 3399679628, 3283088770, 4237083816, 4118925222, 4002861748, 3885750714, 1002142683, 850817237, 698445255, 548169417, 529487843, 377642221, 227885567, 77089521, 1943217067, 2061379749, 1640576439, 1757691577, 1474760595, 1592394909, 1174215055, 1290801793, 2875968315, 2724642869, 3111247143, 2960971305, 2405426947, 2253581325, 2638606623, 2487810577, 3808662347, 3926825029, 4044981591, 4162096729, 3342319475, 3459953789, 3576539503, 3693126241, 1986918061, 2137062819, 1685577905, 1836772287, 1381620373, 1532285339, 1078185097, 1229899655, 1040559837, 923313619, 740276417, 621982671, 439452389, 322734571, 137073913, 19308535, 3871163981, 4021308739, 4104605777, 4255800159, 3263785589, 3414450555, 3499326569, 3651041127, 2933202493, 2815956275, 3167684641, 3049390895, 2330014213, 2213296395, 2566595609, 2448830231, 1305906550, 1155237496, 1607244650, 1455525988, 1776460110, 1626319424, 2079897426, 1928707164, 96392454, 213114376, 396673818, 514443284, 562755902, 679998e3, 865136418, 983426092, 3708173718, 3557504664, 3474729866, 3323011204, 4180808110, 4030667424, 3945269170, 3794078908, 2507040230, 2623762152, 2272556026, 2390325492, 2975484382, 3092726480, 2738905026, 2857194700, 3973773121, 3856137295, 4274053469, 4157467219, 3371096953, 3252932727, 3673476453, 3556361835, 2763173681, 2915017791, 3064510765, 3215307299, 2156299017, 2307622919, 2459735317, 2610011675, 2081048481, 1963412655, 1846563261, 1729977011, 1480485785, 1362321559, 1243905413, 1126790795, 878845905, 1030690015, 645401037, 796197571, 274084841, 425408743, 38544885, 188821243, 3613494426, 3731654548, 3313212038, 3430322568, 4082475170, 4200115116, 3780097726, 3896688048, 2668221674, 2516901860, 2366882550, 2216610296, 3141400786, 2989552604, 2837966542, 2687165888, 1202797690, 1320957812, 1437280870, 1554391400, 1669664834, 1787304780, 1906247262, 2022837584, 265905162, 114585348, 499347990, 349075736, 736970802, 585122620, 972512814, 821712160, 2595684844, 2478443234, 2293045232, 2174754046, 3196267988, 3079546586, 2895723464, 2777952454, 3537852828, 3687994002, 3234156416, 3385345166, 4142626212, 4293295786, 3841024952, 3992742070, 174567692, 57326082, 410887952, 292596766, 777231668, 660510266, 1011452712, 893681702, 1108339068, 1258480242, 1343618912, 1494807662, 1715193156, 1865862730, 1948373848, 2100090966, 2701949495, 2818666809, 3004591147, 3122358053, 2235061775, 2352307457, 2535604243, 2653899549, 3915653703, 3764988233, 4219352155, 4067639125, 3444575871, 3294430577, 3746175075, 3594982253, 836553431, 953270745, 600235211, 718002117, 367585007, 484830689, 133361907, 251657213, 2041877159, 1891211689, 1806599355, 1654886325, 1568718495, 1418573201, 1335535747, 1184342925]; function convertToInt32(bytes3) { var result = []; - for (var i2 = 0; i2 < bytes3.length; i2 += 4) { + for (var i = 0; i < bytes3.length; i += 4) { result.push( - bytes3[i2] << 24 | bytes3[i2 + 1] << 16 | bytes3[i2 + 2] << 8 | bytes3[i2 + 3] + bytes3[i] << 24 | bytes3[i + 1] << 16 | bytes3[i + 2] << 8 | bytes3[i + 3] ); } return result; @@ -43483,7 +43483,7 @@ var aesJs = { exports: {} }; } this._Ke = []; this._Kd = []; - for (var i2 = 0; i2 <= rounds; i2++) { + for (var i = 0; i <= rounds; i++) { this._Ke.push([0, 0, 0, 0]); this._Kd.push([0, 0, 0, 0]); } @@ -43491,10 +43491,10 @@ var aesJs = { exports: {} }; var KC = this.key.length / 4; var tk2 = convertToInt32(this.key); var index2; - for (var i2 = 0; i2 < KC; i2++) { - index2 = i2 >> 2; - this._Ke[index2][i2 % 4] = tk2[i2]; - this._Kd[rounds - index2][i2 % 4] = tk2[i2]; + for (var i = 0; i < KC; i++) { + index2 = i >> 2; + this._Ke[index2][i % 4] = tk2[i]; + this._Kd[rounds - index2][i % 4] = tk2[i]; } var rconpointer = 0; var t2 = KC, tt; @@ -43503,25 +43503,25 @@ var aesJs = { exports: {} }; tk2[0] ^= S2[tt >> 16 & 255] << 24 ^ S2[tt >> 8 & 255] << 16 ^ S2[tt & 255] << 8 ^ S2[tt >> 24 & 255] ^ rcon[rconpointer] << 24; rconpointer += 1; if (KC != 8) { - for (var i2 = 1; i2 < KC; i2++) { - tk2[i2] ^= tk2[i2 - 1]; + for (var i = 1; i < KC; i++) { + tk2[i] ^= tk2[i - 1]; } } else { - for (var i2 = 1; i2 < KC / 2; i2++) { - tk2[i2] ^= tk2[i2 - 1]; + for (var i = 1; i < KC / 2; i++) { + tk2[i] ^= tk2[i - 1]; } tt = tk2[KC / 2 - 1]; tk2[KC / 2] ^= S2[tt & 255] ^ S2[tt >> 8 & 255] << 8 ^ S2[tt >> 16 & 255] << 16 ^ S2[tt >> 24 & 255] << 24; - for (var i2 = KC / 2 + 1; i2 < KC; i2++) { - tk2[i2] ^= tk2[i2 - 1]; + for (var i = KC / 2 + 1; i < KC; i++) { + tk2[i] ^= tk2[i - 1]; } } - var i2 = 0, r2, c2; - while (i2 < KC && t2 < roundKeyCount) { + var i = 0, r2, c2; + while (i < KC && t2 < roundKeyCount) { r2 = t2 >> 2; c2 = t2 % 4; - this._Ke[r2][c2] = tk2[i2]; - this._Kd[rounds - r2][c2] = tk2[i2++]; + this._Ke[r2][c2] = tk2[i]; + this._Kd[rounds - r2][c2] = tk2[i++]; t2++; } } @@ -43539,22 +43539,22 @@ var aesJs = { exports: {} }; var rounds = this._Ke.length - 1; var a2 = [0, 0, 0, 0]; var t2 = convertToInt32(plaintext); - for (var i2 = 0; i2 < 4; i2++) { - t2[i2] ^= this._Ke[0][i2]; + for (var i = 0; i < 4; i++) { + t2[i] ^= this._Ke[0][i]; } for (var r2 = 1; r2 < rounds; r2++) { - for (var i2 = 0; i2 < 4; i2++) { - a2[i2] = T1[t2[i2] >> 24 & 255] ^ T2[t2[(i2 + 1) % 4] >> 16 & 255] ^ T3[t2[(i2 + 2) % 4] >> 8 & 255] ^ T4[t2[(i2 + 3) % 4] & 255] ^ this._Ke[r2][i2]; + for (var i = 0; i < 4; i++) { + a2[i] = T1[t2[i] >> 24 & 255] ^ T2[t2[(i + 1) % 4] >> 16 & 255] ^ T3[t2[(i + 2) % 4] >> 8 & 255] ^ T4[t2[(i + 3) % 4] & 255] ^ this._Ke[r2][i]; } t2 = a2.slice(); } var result = createArray(16), tt; - for (var i2 = 0; i2 < 4; i2++) { - tt = this._Ke[rounds][i2]; - result[4 * i2] = (S2[t2[i2] >> 24 & 255] ^ tt >> 24) & 255; - result[4 * i2 + 1] = (S2[t2[(i2 + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255; - result[4 * i2 + 2] = (S2[t2[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; - result[4 * i2 + 3] = (S2[t2[(i2 + 3) % 4] & 255] ^ tt) & 255; + for (var i = 0; i < 4; i++) { + tt = this._Ke[rounds][i]; + result[4 * i] = (S2[t2[i] >> 24 & 255] ^ tt >> 24) & 255; + result[4 * i + 1] = (S2[t2[(i + 1) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result[4 * i + 2] = (S2[t2[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result[4 * i + 3] = (S2[t2[(i + 3) % 4] & 255] ^ tt) & 255; } return result; }; @@ -43565,22 +43565,22 @@ var aesJs = { exports: {} }; var rounds = this._Kd.length - 1; var a2 = [0, 0, 0, 0]; var t2 = convertToInt32(ciphertext); - for (var i2 = 0; i2 < 4; i2++) { - t2[i2] ^= this._Kd[0][i2]; + for (var i = 0; i < 4; i++) { + t2[i] ^= this._Kd[0][i]; } for (var r2 = 1; r2 < rounds; r2++) { - for (var i2 = 0; i2 < 4; i2++) { - a2[i2] = T5[t2[i2] >> 24 & 255] ^ T6[t2[(i2 + 3) % 4] >> 16 & 255] ^ T7[t2[(i2 + 2) % 4] >> 8 & 255] ^ T8[t2[(i2 + 1) % 4] & 255] ^ this._Kd[r2][i2]; + for (var i = 0; i < 4; i++) { + a2[i] = T5[t2[i] >> 24 & 255] ^ T6[t2[(i + 3) % 4] >> 16 & 255] ^ T7[t2[(i + 2) % 4] >> 8 & 255] ^ T8[t2[(i + 1) % 4] & 255] ^ this._Kd[r2][i]; } t2 = a2.slice(); } var result = createArray(16), tt; - for (var i2 = 0; i2 < 4; i2++) { - tt = this._Kd[rounds][i2]; - result[4 * i2] = (Si2[t2[i2] >> 24 & 255] ^ tt >> 24) & 255; - result[4 * i2 + 1] = (Si2[t2[(i2 + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255; - result[4 * i2 + 2] = (Si2[t2[(i2 + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; - result[4 * i2 + 3] = (Si2[t2[(i2 + 1) % 4] & 255] ^ tt) & 255; + for (var i = 0; i < 4; i++) { + tt = this._Kd[rounds][i]; + result[4 * i] = (Si2[t2[i] >> 24 & 255] ^ tt >> 24) & 255; + result[4 * i + 1] = (Si2[t2[(i + 3) % 4] >> 16 & 255] ^ tt >> 16) & 255; + result[4 * i + 2] = (Si2[t2[(i + 2) % 4] >> 8 & 255] ^ tt >> 8) & 255; + result[4 * i + 3] = (Si2[t2[(i + 1) % 4] & 255] ^ tt) & 255; } return result; }; @@ -43599,10 +43599,10 @@ var aesJs = { exports: {} }; } var ciphertext = createArray(plaintext.length); var block = createArray(16); - for (var i2 = 0; i2 < plaintext.length; i2 += 16) { - copyArray(plaintext, block, 0, i2, i2 + 16); + for (var i = 0; i < plaintext.length; i += 16) { + copyArray(plaintext, block, 0, i, i + 16); block = this._aes.encrypt(block); - copyArray(block, ciphertext, i2); + copyArray(block, ciphertext, i); } return ciphertext; }; @@ -43613,10 +43613,10 @@ var aesJs = { exports: {} }; } var plaintext = createArray(ciphertext.length); var block = createArray(16); - for (var i2 = 0; i2 < ciphertext.length; i2 += 16) { - copyArray(ciphertext, block, 0, i2, i2 + 16); + for (var i = 0; i < ciphertext.length; i += 16) { + copyArray(ciphertext, block, 0, i, i + 16); block = this._aes.decrypt(block); - copyArray(block, plaintext, i2); + copyArray(block, plaintext, i); } return plaintext; }; @@ -43641,13 +43641,13 @@ var aesJs = { exports: {} }; } var ciphertext = createArray(plaintext.length); var block = createArray(16); - for (var i2 = 0; i2 < plaintext.length; i2 += 16) { - copyArray(plaintext, block, 0, i2, i2 + 16); + for (var i = 0; i < plaintext.length; i += 16) { + copyArray(plaintext, block, 0, i, i + 16); for (var j2 = 0; j2 < 16; j2++) { block[j2] ^= this._lastCipherblock[j2]; } this._lastCipherblock = this._aes.encrypt(block); - copyArray(this._lastCipherblock, ciphertext, i2); + copyArray(this._lastCipherblock, ciphertext, i); } return ciphertext; }; @@ -43658,13 +43658,13 @@ var aesJs = { exports: {} }; } var plaintext = createArray(ciphertext.length); var block = createArray(16); - for (var i2 = 0; i2 < ciphertext.length; i2 += 16) { - copyArray(ciphertext, block, 0, i2, i2 + 16); + for (var i = 0; i < ciphertext.length; i += 16) { + copyArray(ciphertext, block, 0, i, i + 16); block = this._aes.decrypt(block); for (var j2 = 0; j2 < 16; j2++) { - plaintext[i2 + j2] = block[j2] ^ this._lastCipherblock[j2]; + plaintext[i + j2] = block[j2] ^ this._lastCipherblock[j2]; } - copyArray(ciphertext, this._lastCipherblock, 0, i2, i2 + 16); + copyArray(ciphertext, this._lastCipherblock, 0, i, i + 16); } return plaintext; }; @@ -43692,13 +43692,13 @@ var aesJs = { exports: {} }; } var encrypted = coerceArray(plaintext, true); var xorSegment; - for (var i2 = 0; i2 < encrypted.length; i2 += this.segmentSize) { + for (var i = 0; i < encrypted.length; i += this.segmentSize) { xorSegment = this._aes.encrypt(this._shiftRegister); for (var j2 = 0; j2 < this.segmentSize; j2++) { - encrypted[i2 + j2] ^= xorSegment[j2]; + encrypted[i + j2] ^= xorSegment[j2]; } copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); - copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize); + copyArray(encrypted, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); } return encrypted; }; @@ -43708,13 +43708,13 @@ var aesJs = { exports: {} }; } var plaintext = coerceArray(ciphertext, true); var xorSegment; - for (var i2 = 0; i2 < plaintext.length; i2 += this.segmentSize) { + for (var i = 0; i < plaintext.length; i += this.segmentSize) { xorSegment = this._aes.encrypt(this._shiftRegister); for (var j2 = 0; j2 < this.segmentSize; j2++) { - plaintext[i2 + j2] ^= xorSegment[j2]; + plaintext[i + j2] ^= xorSegment[j2]; } copyArray(this._shiftRegister, this._shiftRegister, 0, this.segmentSize); - copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i2, i2 + this.segmentSize); + copyArray(ciphertext, this._shiftRegister, 16 - this.segmentSize, i, i + this.segmentSize); } return plaintext; }; @@ -43735,12 +43735,12 @@ var aesJs = { exports: {} }; }; ModeOfOperationOFB.prototype.encrypt = function(plaintext) { var encrypted = coerceArray(plaintext, true); - for (var i2 = 0; i2 < encrypted.length; i2++) { + for (var i = 0; i < encrypted.length; i++) { if (this._lastPrecipherIndex === 16) { this._lastPrecipher = this._aes.encrypt(this._lastPrecipher); this._lastPrecipherIndex = 0; } - encrypted[i2] ^= this._lastPrecipher[this._lastPrecipherIndex++]; + encrypted[i] ^= this._lastPrecipher[this._lastPrecipherIndex++]; } return encrypted; }; @@ -43776,11 +43776,11 @@ var aesJs = { exports: {} }; this._counter = bytes3; }; Counter.prototype.increment = function() { - for (var i2 = 15; i2 >= 0; i2--) { - if (this._counter[i2] === 255) { - this._counter[i2] = 0; + for (var i = 15; i >= 0; i--) { + if (this._counter[i] === 255) { + this._counter[i] = 0; } else { - this._counter[i2]++; + this._counter[i]++; break; } } @@ -43801,13 +43801,13 @@ var aesJs = { exports: {} }; }; ModeOfOperationCTR.prototype.encrypt = function(plaintext) { var encrypted = coerceArray(plaintext, true); - for (var i2 = 0; i2 < encrypted.length; i2++) { + for (var i = 0; i < encrypted.length; i++) { if (this._remainingCounterIndex === 16) { this._remainingCounter = this._aes.encrypt(this._counter._counter); this._remainingCounterIndex = 0; this._counter.increment(); } - encrypted[i2] ^= this._remainingCounter[this._remainingCounterIndex++]; + encrypted[i] ^= this._remainingCounter[this._remainingCounterIndex++]; } return encrypted; }; @@ -43817,8 +43817,8 @@ var aesJs = { exports: {} }; var padder = 16 - data.length % 16; var result = createArray(data.length + padder); copyArray(data, result); - for (var i2 = data.length; i2 < result.length; i2++) { - result[i2] = padder; + for (var i = data.length; i < result.length; i++) { + result[i] = padder; } return result; } @@ -43832,8 +43832,8 @@ var aesJs = { exports: {} }; throw new Error("PKCS#7 padding byte out of range"); } var length = data.length - padder; - for (var i2 = 0; i2 < padder; i2++) { - if (data[length + i2] !== padder) { + for (var i = 0; i < padder; i++) { + if (data[length + i] !== padder) { throw new Error("PKCS#7 invalid padding byte"); } } @@ -43897,10 +43897,10 @@ function getPassword(password) { function searchPath(object, path) { let currentChild = object; const comps = path.toLowerCase().split("/"); - for (let i2 = 0; i2 < comps.length; i2++) { + for (let i = 0; i < comps.length; i++) { let matchingChild = null; for (const key2 in currentChild) { - if (key2.toLowerCase() === comps[i2]) { + if (key2.toLowerCase() === comps[i]) { matchingChild = currentChild[key2]; break; } @@ -43925,7 +43925,7 @@ function uuidV4(randomBytes2) { value.substring(22, 34) ].join("-"); } -const logger$d = new Logger$3(version$e); +const logger$d = new Logger$1(version$e); class CrowdsaleAccount extends Description { isCrowdsaleAccount(value) { return !!(value && value._isCrowdsaleAccount); @@ -43945,8 +43945,8 @@ function decrypt$1(json, password) { const aesCbc = new aes.ModeOfOperation.cbc(key2, iv); const seed = aes.padding.pkcs7.strip(arrayify(aesCbc.decrypt(encryptedSeed))); let seedHex = ""; - for (let i2 = 0; i2 < seed.length; i2++) { - seedHex += String.fromCharCode(seed[i2]); + for (let i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); } const seedHexBytes = toUtf8Bytes(seedHex); const privateKey = keccak256$2(seedHexBytes); @@ -44071,20 +44071,20 @@ var scrypt$1 = { exports: {} }; function blocks(p3) { let off = 0, len = p3.length; while (len >= 64) { - let a2 = h0, b2 = h1, c2 = h2, d2 = h3, e2 = h4, f2 = h5, g2 = h6, h8 = h7, u2, i3, j2, t1, t2; - for (i3 = 0; i3 < 16; i3++) { - j2 = off + i3 * 4; - w2[i3] = (p3[j2] & 255) << 24 | (p3[j2 + 1] & 255) << 16 | (p3[j2 + 2] & 255) << 8 | p3[j2 + 3] & 255; + let a2 = h0, b2 = h1, c2 = h2, d2 = h3, e2 = h4, f2 = h5, g2 = h6, h8 = h7, u2, i2, j2, t1, t2; + for (i2 = 0; i2 < 16; i2++) { + j2 = off + i2 * 4; + w2[i2] = (p3[j2] & 255) << 24 | (p3[j2 + 1] & 255) << 16 | (p3[j2 + 2] & 255) << 8 | p3[j2 + 3] & 255; } - for (i3 = 16; i3 < 64; i3++) { - u2 = w2[i3 - 2]; + for (i2 = 16; i2 < 64; i2++) { + u2 = w2[i2 - 2]; t1 = (u2 >>> 17 | u2 << 32 - 17) ^ (u2 >>> 19 | u2 << 32 - 19) ^ u2 >>> 10; - u2 = w2[i3 - 15]; + u2 = w2[i2 - 15]; t2 = (u2 >>> 7 | u2 << 32 - 7) ^ (u2 >>> 18 | u2 << 32 - 18) ^ u2 >>> 3; - w2[i3] = (t1 + w2[i3 - 7] | 0) + (t2 + w2[i3 - 16] | 0) | 0; + w2[i2] = (t1 + w2[i2 - 7] | 0) + (t2 + w2[i2 - 16] | 0) | 0; } - for (i3 = 0; i3 < 64; i3++) { - t1 = (((e2 >>> 6 | e2 << 32 - 6) ^ (e2 >>> 11 | e2 << 32 - 11) ^ (e2 >>> 25 | e2 << 32 - 25)) + (e2 & f2 ^ ~e2 & g2) | 0) + (h8 + (K2[i3] + w2[i3] | 0) | 0) | 0; + for (i2 = 0; i2 < 64; i2++) { + t1 = (((e2 >>> 6 | e2 << 32 - 6) ^ (e2 >>> 11 | e2 << 32 - 11) ^ (e2 >>> 25 | e2 << 32 - 25)) + (e2 & f2 ^ ~e2 & g2) | 0) + (h8 + (K2[i2] + w2[i2] | 0) | 0) | 0; t2 = ((a2 >>> 2 | a2 << 32 - 2) ^ (a2 >>> 13 | a2 << 32 - 13) ^ (a2 >>> 22 | a2 << 32 - 22)) + (a2 & b2 ^ a2 & c2 ^ b2 & c2) | 0; h8 = g2; g2 = f2; @@ -44108,9 +44108,9 @@ var scrypt$1 = { exports: {} }; } } blocks(m2); - let i2, bytesLeft = m2.length % 64, bitLenHi = m2.length / 536870912 | 0, bitLenLo = m2.length << 3, numZeros = bytesLeft < 56 ? 56 : 120, p2 = m2.slice(m2.length - bytesLeft, m2.length); + let i, bytesLeft = m2.length % 64, bitLenHi = m2.length / 536870912 | 0, bitLenLo = m2.length << 3, numZeros = bytesLeft < 56 ? 56 : 120, p2 = m2.slice(m2.length - bytesLeft, m2.length); p2.push(128); - for (i2 = bytesLeft + 1; i2 < numZeros; i2++) { + for (i = bytesLeft + 1; i < numZeros; i++) { p2.push(0); } p2.push(bitLenHi >>> 24 & 255); @@ -44162,30 +44162,30 @@ var scrypt$1 = { exports: {} }; const innerLen = 64 + salt.length + 4; const inner = new Array(innerLen); const outerKey = new Array(64); - let i2; + let i; let dk2 = []; - for (i2 = 0; i2 < 64; i2++) { - inner[i2] = 54; + for (i = 0; i < 64; i++) { + inner[i] = 54; } - for (i2 = 0; i2 < password.length; i2++) { - inner[i2] ^= password[i2]; + for (i = 0; i < password.length; i++) { + inner[i] ^= password[i]; } - for (i2 = 0; i2 < salt.length; i2++) { - inner[64 + i2] = salt[i2]; + for (i = 0; i < salt.length; i++) { + inner[64 + i] = salt[i]; } - for (i2 = innerLen - 4; i2 < innerLen; i2++) { - inner[i2] = 0; + for (i = innerLen - 4; i < innerLen; i++) { + inner[i] = 0; } - for (i2 = 0; i2 < 64; i2++) - outerKey[i2] = 92; - for (i2 = 0; i2 < password.length; i2++) - outerKey[i2] ^= password[i2]; + for (i = 0; i < 64; i++) + outerKey[i] = 92; + for (i = 0; i < password.length; i++) + outerKey[i] ^= password[i]; function incrementCounter() { - for (let i3 = innerLen - 1; i3 >= innerLen - 4; i3--) { - inner[i3]++; - if (inner[i3] <= 255) + for (let i2 = innerLen - 1; i2 >= innerLen - 4; i2--) { + inner[i2]++; + if (inner[i2] <= 255) return; - inner[i3] = 0; + inner[i2] = 0; } } while (dkLen >= 32) { @@ -44200,18 +44200,18 @@ var scrypt$1 = { exports: {} }; return dk2; } function blockmix_salsa8(BY, Yi2, r2, x, _X) { - let i2; + let i; arraycopy(BY, (2 * r2 - 1) * 16, _X, 0, 16); - for (i2 = 0; i2 < 2 * r2; i2++) { - blockxor(BY, i2 * 16, _X, 16); + for (i = 0; i < 2 * r2; i++) { + blockxor(BY, i * 16, _X, 16); salsa20_8(_X, x); - arraycopy(_X, 0, BY, Yi2 + i2 * 16, 16); + arraycopy(_X, 0, BY, Yi2 + i * 16, 16); } - for (i2 = 0; i2 < r2; i2++) { - arraycopy(BY, Yi2 + i2 * 2 * 16, BY, i2 * 16, 16); + for (i = 0; i < r2; i++) { + arraycopy(BY, Yi2 + i * 2 * 16, BY, i * 16, 16); } - for (i2 = 0; i2 < r2; i2++) { - arraycopy(BY, Yi2 + (i2 * 2 + 1) * 16, BY, (i2 + r2) * 16, 16); + for (i = 0; i < r2; i++) { + arraycopy(BY, Yi2 + (i * 2 + 1) * 16, BY, (i + r2) * 16, 16); } } function R2(a2, b2) { @@ -44219,7 +44219,7 @@ var scrypt$1 = { exports: {} }; } function salsa20_8(B2, x) { arraycopy(B2, 0, x, 0, 16); - for (let i2 = 8; i2 > 0; i2 -= 2) { + for (let i = 8; i > 0; i -= 2) { x[4] ^= R2(x[0] + x[12], 7); x[8] ^= R2(x[4] + x[0], 9); x[12] ^= R2(x[8] + x[4], 13); @@ -44253,13 +44253,13 @@ var scrypt$1 = { exports: {} }; x[14] ^= R2(x[13] + x[12], 13); x[15] ^= R2(x[14] + x[13], 18); } - for (let i2 = 0; i2 < 16; ++i2) { - B2[i2] += x[i2]; + for (let i = 0; i < 16; ++i) { + B2[i] += x[i]; } } function blockxor(S2, Si2, D2, len) { - for (let i2 = 0; i2 < len; i2++) { - D2[i2] ^= S2[Si2 + i2]; + for (let i = 0; i < len; i++) { + D2[i] ^= S2[Si2 + i]; } } function arraycopy(src, srcPos, dest, destPos, length) { @@ -44271,8 +44271,8 @@ var scrypt$1 = { exports: {} }; if (!o2 || typeof o2.length !== "number") { return false; } - for (let i2 = 0; i2 < o2.length; i2++) { - const v3 = o2[i2]; + for (let i = 0; i < o2.length; i++) { + const v3 = o2[i]; if (typeof v3 !== "number" || v3 % 1 || v3 < 0 || v3 >= 256) { return false; } @@ -44309,9 +44309,9 @@ var scrypt$1 = { exports: {} }; salt = Array.prototype.slice.call(salt); let b2 = PBKDF2_HMAC_SHA256_OneIter(password, salt, p2 * 128 * r2); const B2 = new Uint32Array(p2 * 32 * r2); - for (let i2 = 0; i2 < B2.length; i2++) { - const j2 = i2 * 4; - B2[i2] = (b2[j2 + 3] & 255) << 24 | (b2[j2 + 2] & 255) << 16 | (b2[j2 + 1] & 255) << 8 | (b2[j2 + 0] & 255) << 0; + for (let i = 0; i < B2.length; i++) { + const j2 = i * 4; + B2[i] = (b2[j2 + 3] & 255) << 24 | (b2[j2 + 2] & 255) << 16 | (b2[j2 + 1] & 255) << 8 | (b2[j2 + 0] & 255) << 0; } const XY = new Uint32Array(64 * r2); const V2 = new Uint32Array(32 * r2 * N2); @@ -44343,8 +44343,8 @@ var scrypt$1 = { exports: {} }; if (steps2 > limit) { steps2 = limit; } - for (let i2 = 0; i2 < steps2; i2++) { - arraycopy(XY, 0, V2, (i1 + i2) * Yi2, Yi2); + for (let i = 0; i < steps2; i++) { + arraycopy(XY, 0, V2, (i1 + i) * Yi2, Yi2); blockmix_salsa8(XY, Yi2, r2, x, _X); } i1 += steps2; @@ -44369,7 +44369,7 @@ var scrypt$1 = { exports: {} }; if (steps2 > limit) { steps2 = limit; } - for (let i2 = 0; i2 < steps2; i2++) { + for (let i = 0; i < steps2; i++) { const offset2 = (2 * r2 - 1) * 16; const j2 = XY[offset2] & N2 - 1; blockxor(V2, j2 * Yi2, XY, Yi2); @@ -44397,11 +44397,11 @@ var scrypt$1 = { exports: {} }; break; } b2 = []; - for (let i2 = 0; i2 < B2.length; i2++) { - b2.push(B2[i2] >> 0 & 255); - b2.push(B2[i2] >> 8 & 255); - b2.push(B2[i2] >> 16 & 255); - b2.push(B2[i2] >> 24 & 255); + for (let i = 0; i < B2.length; i++) { + b2.push(B2[i] >> 0 & 255); + b2.push(B2[i] >> 8 & 255); + b2.push(B2[i] >> 16 & 255); + b2.push(B2[i] >> 24 & 255); } const derivedKey = PBKDF2_HMAC_SHA256_OneIter(password, b2, dkLen); if (callback) { @@ -44483,7 +44483,7 @@ var __awaiter$9 = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$c = new Logger$3(version$e); +const logger$c = new Logger$1(version$e); function hasMnemonic$1(value) { return value != null && value.mnemonic && value.mnemonic.phrase; } @@ -44510,7 +44510,7 @@ function _getAccount(data, key2) { } const privateKey = _decrypt(data, key2.slice(0, 16), ciphertext); if (!privateKey) { - logger$c.throwError("unsupported cipher", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$c.throwError("unsupported cipher", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "decrypt" }); } @@ -44546,7 +44546,7 @@ function _getAccount(data, key2) { } account2.mnemonic = node.mnemonic; } catch (error) { - if (error.code !== Logger$3.errors.INVALID_ARGUMENT || error.argument !== "wordlist") { + if (error.code !== Logger$1.errors.INVALID_ARGUMENT || error.argument !== "wordlist") { throw error; } } @@ -44803,7 +44803,7 @@ var __awaiter$8 = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$b = new Logger$3(version$d); +const logger$b = new Logger$1(version$d); function isAccount$1(value) { return value != null && isHexString(value.privateKey, 32) && value.address != null; } @@ -44895,7 +44895,7 @@ let Wallet$1 = class Wallet extends Signer$1 { return __awaiter$8(this, void 0, void 0, function* () { const populated = yield TypedDataEncoder.resolveNames(domain2, types2, value, (name2) => { if (this.provider == null) { - logger$b.throwError("cannot resolve ENS names without a provider", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$b.throwError("cannot resolve ENS names without a provider", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "resolveName", value: name2 }); @@ -44960,7 +44960,7 @@ const lib_esm$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro verifyTypedData: verifyTypedData$1 }, Symbol.toStringTag, { value: "Module" })); const version$c = "networks/5.7.1"; -const logger$a = new Logger$3(version$c); +const logger$a = new Logger$1(version$c); function isRenetworkable(value) { return value && typeof value.renetwork === "function"; } @@ -45062,7 +45062,7 @@ const classicMordor = { name: "classicMordor", _defaultProvider: etcDefaultProvider("https://www.ethercluster.com/mordor", "classicMordor") }; -const networks$4 = { +const networks$2 = { unspecified: { chainId: 0, name: "unspecified" }, homestead, mainnet: homestead, @@ -45131,8 +45131,8 @@ function getNetwork$1(network2) { return null; } if (typeof network2 === "number") { - for (const name2 in networks$4) { - const standard2 = networks$4[name2]; + for (const name2 in networks$2) { + const standard2 = networks$2[name2]; if (standard2.chainId === network2) { return { name: standard2.name, @@ -45148,7 +45148,7 @@ function getNetwork$1(network2) { }; } if (typeof network2 === "string") { - const standard2 = networks$4[network2]; + const standard2 = networks$2[network2]; if (standard2 == null) { return null; } @@ -45159,7 +45159,7 @@ function getNetwork$1(network2) { _defaultProvider: standard2._defaultProvider || null }; } - const standard = networks$4[network2.name]; + const standard = networks$2[network2.name]; if (!standard) { if (typeof network2.chainId !== "number") { logger$a.throwArgumentError("invalid network chainId", "network", network2); @@ -45294,7 +45294,7 @@ var __awaiter$6 = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$9 = new Logger$3(version$b); +const logger$9 = new Logger$1(version$b); function staller(duration) { return new Promise((resolve) => { setTimeout(resolve, duration); @@ -45358,7 +45358,7 @@ function _fetchData(connection, body, processFunc) { options.allowGzip = !!connection.allowGzip; if (connection.user != null && connection.password != null) { if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) { - logger$9.throwError("basic authentication requires a secure https url", Logger$3.errors.INVALID_ARGUMENT, { argument: "url", url, user: connection.user, password: "[REDACTED]" }); + logger$9.throwError("basic authentication requires a secure https url", Logger$1.errors.INVALID_ARGUMENT, { argument: "url", url, user: connection.user, password: "[REDACTED]" }); } const authorization = connection.user + ":" + connection.password; headers["authorization"] = { @@ -45389,7 +45389,7 @@ function _fetchData(connection, body, processFunc) { } return Promise.resolve(result); } catch (error) { - logger$9.throwError("processing response error", Logger$3.errors.SERVER_ERROR, { + logger$9.throwError("processing response error", Logger$1.errors.SERVER_ERROR, { body: bodyify(dataMatch[1], dataMatch[2]), error, requestBody: null, @@ -45423,7 +45423,7 @@ function _fetchData(connection, body, processFunc) { return; } timer2 = null; - reject(logger$9.makeError("timeout", Logger$3.errors.TIMEOUT, { + reject(logger$9.makeError("timeout", Logger$1.errors.TIMEOUT, { requestBody: bodyify(options.body, flatHeaders["content-type"]), requestMethod: options.method, timeout, @@ -45476,7 +45476,7 @@ function _fetchData(connection, body, processFunc) { response = error.response; if (response == null) { runningTimeout.cancel(); - logger$9.throwError("missing response", Logger$3.errors.SERVER_ERROR, { + logger$9.throwError("missing response", Logger$1.errors.SERVER_ERROR, { requestBody: bodyify(options.body, flatHeaders["content-type"]), requestMethod: options.method, serverError: error, @@ -45489,7 +45489,7 @@ function _fetchData(connection, body, processFunc) { body2 = null; } else if (!errorPassThrough && (response.statusCode < 200 || response.statusCode >= 300)) { runningTimeout.cancel(); - logger$9.throwError("bad response", Logger$3.errors.SERVER_ERROR, { + logger$9.throwError("bad response", Logger$1.errors.SERVER_ERROR, { status: response.statusCode, headers: response.headers, body: bodyify(body2, response.headers ? response.headers["content-type"] : null), @@ -45516,7 +45516,7 @@ function _fetchData(connection, body, processFunc) { } } runningTimeout.cancel(); - logger$9.throwError("processing response error", Logger$3.errors.SERVER_ERROR, { + logger$9.throwError("processing response error", Logger$1.errors.SERVER_ERROR, { body: bodyify(body2, response.headers ? response.headers["content-type"] : null), error, requestBody: bodyify(options.body, flatHeaders["content-type"]), @@ -45528,7 +45528,7 @@ function _fetchData(connection, body, processFunc) { runningTimeout.cancel(); return body2; } - return logger$9.throwError("failed response", Logger$3.errors.SERVER_ERROR, { + return logger$9.throwError("failed response", Logger$1.errors.SERVER_ERROR, { requestBody: bodyify(options.body, flatHeaders["content-type"]), requestMethod: options.method, url @@ -45544,7 +45544,7 @@ function fetchJson(connection, json, processFunc) { try { result = JSON.parse(toUtf8String(value)); } catch (error) { - logger$9.throwError("invalid JSON", Logger$3.errors.SERVER_ERROR, { + logger$9.throwError("invalid JSON", Logger$1.errors.SERVER_ERROR, { body: value, error }); @@ -45665,15 +45665,15 @@ function polymodStep(pre) { } function prefixChk(prefix) { var chk = 1; - for (var i2 = 0; i2 < prefix.length; ++i2) { - var c2 = prefix.charCodeAt(i2); + for (var i = 0; i < prefix.length; ++i) { + var c2 = prefix.charCodeAt(i); if (c2 < 33 || c2 > 126) return "Invalid prefix (" + prefix + ")"; chk = polymodStep(chk) ^ c2 >> 5; } chk = polymodStep(chk); - for (i2 = 0; i2 < prefix.length; ++i2) { - var v3 = prefix.charCodeAt(i2); + for (i = 0; i < prefix.length; ++i) { + var v3 = prefix.charCodeAt(i); chk = polymodStep(chk) ^ v3 & 31; } return chk; @@ -45687,19 +45687,19 @@ function encode$1(prefix, words2, LIMIT) { if (typeof chk === "string") throw new Error(chk); var result = prefix + "1"; - for (var i2 = 0; i2 < words2.length; ++i2) { - var x = words2[i2]; + for (var i = 0; i < words2.length; ++i) { + var x = words2[i]; if (x >> 5 !== 0) throw new Error("Non 5-bit word"); chk = polymodStep(chk) ^ x; result += ALPHABET.charAt(x); } - for (i2 = 0; i2 < 6; ++i2) { + for (i = 0; i < 6; ++i) { chk = polymodStep(chk); } chk ^= 1; - for (i2 = 0; i2 < 6; ++i2) { - var v3 = chk >> (5 - i2) * 5 & 31; + for (i = 0; i < 6; ++i) { + var v3 = chk >> (5 - i) * 5 & 31; result += ALPHABET.charAt(v3); } return result; @@ -45728,13 +45728,13 @@ function __decode(str, LIMIT) { if (typeof chk === "string") return chk; var words2 = []; - for (var i2 = 0; i2 < wordChars.length; ++i2) { - var c2 = wordChars.charAt(i2); + for (var i = 0; i < wordChars.length; ++i) { + var c2 = wordChars.charAt(i); var v3 = ALPHABET_MAP[c2]; if (v3 === void 0) return "Unknown character " + c2; chk = polymodStep(chk) ^ v3; - if (i2 + 6 >= wordChars.length) + if (i + 6 >= wordChars.length) continue; words2.push(v3); } @@ -45758,8 +45758,8 @@ function convert(data, inBits, outBits, pad3) { var bits = 0; var maxV = (1 << outBits) - 1; var result = []; - for (var i2 = 0; i2 < data.length; ++i2) { - value = value << inBits | data[i2]; + for (var i = 0; i < data.length; ++i) { + value = value << inBits | data[i]; bits += inBits; while (bits >= outBits) { bits -= outBits; @@ -45811,7 +45811,7 @@ var bech32 = { }; const bech32$1 = /* @__PURE__ */ getDefaultExportFromCjs$1(bech32); const version$a = "providers/5.7.2"; -const logger$8 = new Logger$3(version$a); +const logger$8 = new Logger$1(version$a); class Formatter { constructor() { this.formats = this.getDefaultFormats(); @@ -46241,7 +46241,7 @@ var __awaiter$5 = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$7 = new Logger$3(version$a); +const logger$7 = new Logger$1(version$a); const MAX_CCIP_REDIRECTS = 10; function checkTopic(topic) { if (topic == null) { @@ -46426,13 +46426,13 @@ function bytesPad(value) { function encodeBytes$1(datas) { const result = []; let byteCount = 0; - for (let i2 = 0; i2 < datas.length; i2++) { + for (let i = 0; i < datas.length; i++) { result.push(null); byteCount += 32; } - for (let i2 = 0; i2 < datas.length; i2++) { - const data = arrayify(datas[i2]); - result[i2] = numPad(byteCount); + for (let i = 0; i < datas.length; i++) { + const data = arrayify(datas[i]); + result[i] = numPad(byteCount); result.push(numPad(data.length)); result.push(bytesPad(data)); byteCount += 32 + Math.ceil(data.length / 32) * 32; @@ -46455,7 +46455,7 @@ class Resolver { }).then((result) => { return BigNumber.from(result).eq(1); }).catch((error) => { - if (error.code === Logger$3.errors.CALL_EXCEPTION) { + if (error.code === Logger$1.errors.CALL_EXCEPTION) { return false; } this._supportsEip2544 = null; @@ -46479,7 +46479,7 @@ class Resolver { try { let result = yield this.provider.call(tx); if (arrayify(result).length % 32 === 4) { - logger$7.throwError("resolver threw error", Logger$3.errors.CALL_EXCEPTION, { + logger$7.throwError("resolver threw error", Logger$1.errors.CALL_EXCEPTION, { transaction: tx, data: result }); @@ -46489,7 +46489,7 @@ class Resolver { } return result; } catch (error) { - if (error.code === Logger$3.errors.CALL_EXCEPTION) { + if (error.code === Logger$1.errors.CALL_EXCEPTION) { return null; } throw error; @@ -46508,7 +46508,7 @@ class Resolver { _getAddress(coinType, hexBytes) { const coinInfo = coinInfos[String(coinType)]; if (coinInfo == null) { - logger$7.throwError(`unsupported coin type: ${coinType}`, Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$7.throwError(`unsupported coin type: ${coinType}`, Logger$1.errors.UNSUPPORTED_OPERATION, { operation: `getAddress(${coinType})` }); } @@ -46565,7 +46565,7 @@ class Resolver { } return this.provider.formatter.callAddress(result); } catch (error) { - if (error.code === Logger$3.errors.CALL_EXCEPTION) { + if (error.code === Logger$1.errors.CALL_EXCEPTION) { return null; } throw error; @@ -46577,7 +46577,7 @@ class Resolver { } const address = this._getAddress(coinType, hexBytes); if (address == null) { - logger$7.throwError(`invalid or unsupported coin data`, Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$7.throwError(`invalid or unsupported coin data`, Logger$1.errors.UNSUPPORTED_OPERATION, { operation: `getAddress(${coinType})`, coinType, data: hexBytes @@ -46594,8 +46594,8 @@ class Resolver { if (avatar2 == null) { return null; } - for (let i2 = 0; i2 < matchers.length; i2++) { - const match = avatar2.match(matchers[i2]); + for (let i = 0; i < matchers.length; i++) { + const match = avatar2.match(matchers[i]); if (match == null) { continue; } @@ -46719,7 +46719,7 @@ class Resolver { return "sia://" + hash2; } } - return logger$7.throwError(`invalid or unsupported content hash data`, Logger$3.errors.UNSUPPORTED_OPERATION, { + return logger$7.throwError(`invalid or unsupported content hash data`, Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "getContentHash()", data: hexBytes }); @@ -46797,7 +46797,7 @@ class BaseProvider extends Provider { network2 = yield this.detectNetwork(); } if (!network2) { - logger$7.throwError("no network detected", Logger$3.errors.UNKNOWN_ERROR, {}); + logger$7.throwError("no network detected", Logger$1.errors.UNKNOWN_ERROR, {}); } if (this._network == null) { if (this.anyNetwork) { @@ -46819,7 +46819,7 @@ class BaseProvider extends Provider { return this._ready().then((network2) => { return network2; }, (error) => { - if (error.code === Logger$3.errors.NETWORK_ERROR && error.event === "noNetwork") { + if (error.code === Logger$1.errors.NETWORK_ERROR && error.event === "noNetwork") { return void 0; } throw error; @@ -46845,8 +46845,8 @@ class BaseProvider extends Provider { const sender = tx.to.toLowerCase(); const data = calldata.toLowerCase(); const errorMessages = []; - for (let i2 = 0; i2 < urls.length; i2++) { - const url = urls[i2]; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; const href = url.replace("{sender}", sender).replace("{data}", data); const json = url.indexOf("{data}") >= 0 ? null : JSON.stringify({ data, sender }); const result = yield fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { @@ -46858,11 +46858,11 @@ class BaseProvider extends Provider { } const errorMessage = result.message || "unknown error"; if (result.status >= 400 && result.status < 500) { - return logger$7.throwError(`response not found during CCIP fetch: ${errorMessage}`, Logger$3.errors.SERVER_ERROR, { url, errorMessage }); + return logger$7.throwError(`response not found during CCIP fetch: ${errorMessage}`, Logger$1.errors.SERVER_ERROR, { url, errorMessage }); } errorMessages.push(errorMessage); } - return logger$7.throwError(`error encountered during CCIP fetch: ${errorMessages.map((m2) => JSON.stringify(m2)).join(", ")}`, Logger$3.errors.SERVER_ERROR, { + return logger$7.throwError(`error encountered during CCIP fetch: ${errorMessages.map((m2) => JSON.stringify(m2)).join(", ")}`, Logger$1.errors.SERVER_ERROR, { urls, errorMessages }); @@ -46940,15 +46940,15 @@ class BaseProvider extends Provider { } if (Math.abs(this._emitted.block - blockNumber) > 1e3) { logger$7.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${blockNumber})`); - this.emit("error", logger$7.makeError("network block skew detected", Logger$3.errors.NETWORK_ERROR, { + this.emit("error", logger$7.makeError("network block skew detected", Logger$1.errors.NETWORK_ERROR, { blockNumber, event: "blockSkew", previousBlockNumber: this._emitted.block })); this.emit("block", blockNumber); } else { - for (let i2 = this._emitted.block + 1; i2 <= blockNumber; i2++) { - this.emit("block", i2); + for (let i = this._emitted.block + 1; i <= blockNumber; i++) { + this.emit("block", i); } } if (this._emitted.block !== blockNumber) { @@ -47048,7 +47048,7 @@ class BaseProvider extends Provider { // can change, such as when connected to a JSON-RPC backend detectNetwork() { return __awaiter$5(this, void 0, void 0, function* () { - return logger$7.throwError("provider does not support network detection", Logger$3.errors.UNSUPPORTED_OPERATION, { + return logger$7.throwError("provider does not support network detection", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "provider.detectNetwork" }); }); @@ -47071,7 +47071,7 @@ class BaseProvider extends Provider { yield stall$1(0); return this._network; } - const error = logger$7.makeError("underlying network changed", Logger$3.errors.NETWORK_ERROR, { + const error = logger$7.makeError("underlying network changed", Logger$1.errors.NETWORK_ERROR, { event: "changed", network: network2, detectedNetwork: currentNetwork @@ -47239,7 +47239,7 @@ class BaseProvider extends Provider { } else if (tx.data === "0x" && tx.from === tx.to && tx.value.isZero()) { reason = "cancelled"; } - reject(logger$7.makeError("transaction was replaced", Logger$3.errors.TRANSACTION_REPLACED, { + reject(logger$7.makeError("transaction was replaced", Logger$1.errors.TRANSACTION_REPLACED, { cancelled: reason === "replaced" || reason === "cancelled", reason, replacement: this._wrapTransaction(tx), @@ -47276,7 +47276,7 @@ class BaseProvider extends Provider { if (alreadyDone()) { return; } - reject(logger$7.makeError("timeout exceeded", Logger$3.errors.TIMEOUT, { timeout })); + reject(logger$7.makeError("timeout exceeded", Logger$1.errors.TIMEOUT, { timeout })); }, timeout); if (timer2.unref) { timer2.unref(); @@ -47300,7 +47300,7 @@ class BaseProvider extends Provider { try { return BigNumber.from(result); } catch (error) { - return logger$7.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, { + return logger$7.throwError("bad result from backend", Logger$1.errors.SERVER_ERROR, { method: "getGasPrice", result, error @@ -47319,7 +47319,7 @@ class BaseProvider extends Provider { try { return BigNumber.from(result); } catch (error) { - return logger$7.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, { + return logger$7.throwError("bad result from backend", Logger$1.errors.SERVER_ERROR, { method: "getBalance", params, result, @@ -47339,7 +47339,7 @@ class BaseProvider extends Provider { try { return BigNumber.from(result).toNumber(); } catch (error) { - return logger$7.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, { + return logger$7.throwError("bad result from backend", Logger$1.errors.SERVER_ERROR, { method: "getTransactionCount", params, result, @@ -47359,7 +47359,7 @@ class BaseProvider extends Provider { try { return hexlify(result); } catch (error) { - return logger$7.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, { + return logger$7.throwError("bad result from backend", Logger$1.errors.SERVER_ERROR, { method: "getCode", params, result, @@ -47380,7 +47380,7 @@ class BaseProvider extends Provider { try { return hexlify(result); } catch (error) { - return logger$7.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, { + return logger$7.throwError("bad result from backend", Logger$1.errors.SERVER_ERROR, { method: "getStorageAt", params, result, @@ -47396,7 +47396,7 @@ class BaseProvider extends Provider { } const result = tx; if (hash2 != null && tx.hash !== hash2) { - logger$7.throwError("Transaction hash mismatch from Provider.sendTransaction.", Logger$3.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash2 }); + logger$7.throwError("Transaction hash mismatch from Provider.sendTransaction.", Logger$1.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash2 }); } result.wait = (confirms, timeout) => __awaiter$5(this, void 0, void 0, function* () { if (confirms == null) { @@ -47422,7 +47422,7 @@ class BaseProvider extends Provider { } this._emitted["t:" + tx.hash] = receipt.blockNumber; if (receipt.status === 0) { - logger$7.throwError("transaction failed", Logger$3.errors.CALL_EXCEPTION, { + logger$7.throwError("transaction failed", Logger$1.errors.CALL_EXCEPTION, { transactionHash: tx.hash, transaction: tx, receipt @@ -47510,7 +47510,7 @@ class BaseProvider extends Provider { _call(transaction2, blockTag, attempt) { return __awaiter$5(this, void 0, void 0, function* () { if (attempt >= MAX_CCIP_REDIRECTS) { - logger$7.throwError("CCIP read exceeded maximum redirections", Logger$3.errors.SERVER_ERROR, { + logger$7.throwError("CCIP read exceeded maximum redirections", Logger$1.errors.SERVER_ERROR, { redirects: attempt, transaction: transaction2 }); @@ -47522,7 +47522,7 @@ class BaseProvider extends Provider { const data = hexDataSlice(result, 4); const sender = hexDataSlice(data, 0, 32); if (!BigNumber.from(sender).eq(txSender)) { - logger$7.throwError("CCIP Read sender did not match", Logger$3.errors.CALL_EXCEPTION, { + logger$7.throwError("CCIP Read sender did not match", Logger$1.errors.CALL_EXCEPTION, { name: "OffchainLookup", signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", transaction: transaction2, @@ -47536,7 +47536,7 @@ class BaseProvider extends Provider { for (let u2 = 0; u2 < urlsLength; u2++) { const url = _parseString(urlsData, u2 * 32); if (url == null) { - logger$7.throwError("CCIP Read contained corrupt URL string", Logger$3.errors.CALL_EXCEPTION, { + logger$7.throwError("CCIP Read contained corrupt URL string", Logger$1.errors.CALL_EXCEPTION, { name: "OffchainLookup", signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", transaction: transaction2, @@ -47547,7 +47547,7 @@ class BaseProvider extends Provider { } const calldata = _parseBytes(data, 64); if (!BigNumber.from(hexDataSlice(data, 100, 128)).isZero()) { - logger$7.throwError("CCIP Read callback selector included junk", Logger$3.errors.CALL_EXCEPTION, { + logger$7.throwError("CCIP Read callback selector included junk", Logger$1.errors.CALL_EXCEPTION, { name: "OffchainLookup", signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", transaction: transaction2, @@ -47558,7 +47558,7 @@ class BaseProvider extends Provider { const extraData = _parseBytes(data, 128); const ccipResult = yield this.ccipReadFetch(transaction2, calldata, urls); if (ccipResult == null) { - logger$7.throwError("CCIP Read disabled or provided no URLs", Logger$3.errors.CALL_EXCEPTION, { + logger$7.throwError("CCIP Read disabled or provided no URLs", Logger$1.errors.CALL_EXCEPTION, { name: "OffchainLookup", signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", transaction: transaction2, @@ -47571,7 +47571,7 @@ class BaseProvider extends Provider { }; return this._call(tx, blockTag, attempt + 1); } catch (error) { - if (error.code === Logger$3.errors.SERVER_ERROR) { + if (error.code === Logger$1.errors.SERVER_ERROR) { throw error; } } @@ -47579,7 +47579,7 @@ class BaseProvider extends Provider { try { return hexlify(result); } catch (error) { - return logger$7.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, { + return logger$7.throwError("bad result from backend", Logger$1.errors.SERVER_ERROR, { method: "call", params: { transaction: transaction2, blockTag }, result, @@ -47609,7 +47609,7 @@ class BaseProvider extends Provider { try { return BigNumber.from(result); } catch (error) { - return logger$7.throwError("bad result from backend", Logger$3.errors.SERVER_ERROR, { + return logger$7.throwError("bad result from backend", Logger$1.errors.SERVER_ERROR, { method: "estimateGas", params, result, @@ -47626,7 +47626,7 @@ class BaseProvider extends Provider { } const address = yield this.resolveName(addressOrName); if (address == null) { - logger$7.throwError("ENS name not configured", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$7.throwError("ENS name not configured", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: `resolveName(${JSON.stringify(addressOrName)})` }); } @@ -47670,8 +47670,8 @@ class BaseProvider extends Provider { } if (includeTransactions) { let blockNumber2 = null; - for (let i2 = 0; i2 < block.transactions.length; i2++) { - const tx = block.transactions[i2]; + for (let i = 0; i < block.transactions.length; i++) { + const tx = block.transactions[i]; if (tx.blockNumber == null) { tx.confirmations = 0; } else if (tx.confirmations == null) { @@ -47823,7 +47823,7 @@ class BaseProvider extends Provider { } const network2 = yield this.getNetwork(); if (!network2.ensAddress) { - logger$7.throwError("network does not support ENS", Logger$3.errors.UNSUPPORTED_OPERATION, { operation, network: network2.name }); + logger$7.throwError("network does not support ENS", Logger$1.errors.UNSUPPORTED_OPERATION, { operation, network: network2.name }); } try { const addrData = yield this.call({ @@ -47893,7 +47893,7 @@ class BaseProvider extends Provider { return avatar3.url; } } catch (error) { - if (error.code !== Logger$3.errors.CALL_EXCEPTION) { + if (error.code !== Logger$1.errors.CALL_EXCEPTION) { throw error; } } @@ -47904,7 +47904,7 @@ class BaseProvider extends Provider { }), 0); resolver = yield this.getResolver(name2); } catch (error) { - if (error.code !== Logger$3.errors.CALL_EXCEPTION) { + if (error.code !== Logger$1.errors.CALL_EXCEPTION) { throw error; } return null; @@ -47923,7 +47923,7 @@ class BaseProvider extends Provider { }); } perform(method, params) { - return logger$7.throwError(method + " not implemented", Logger$3.errors.NOT_IMPLEMENTED, { operation: method }); + return logger$7.throwError(method + " not implemented", Logger$1.errors.NOT_IMPLEMENTED, { operation: method }); } _startEvent(event) { this.polling = this._events.filter((e2) => e2.pollable()).length > 0; @@ -48053,7 +48053,7 @@ var __awaiter$4 = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$6 = new Logger$3(version$a); +const logger$6 = new Logger$1(version$a); const errorGas = ["call", "estimateGas"]; function spelunk(value, requireData) { if (value == null) { @@ -48089,7 +48089,7 @@ function checkError(method, error, params) { if (result) { return result.data; } - logger$6.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger$3.errors.CALL_EXCEPTION, { + logger$6.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger$1.errors.CALL_EXCEPTION, { data: "0x", transaction: transaction2, error @@ -48101,7 +48101,7 @@ function checkError(method, error, params) { result = spelunk(error, false); } if (result) { - logger$6.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$3.errors.UNPREDICTABLE_GAS_LIMIT, { + logger$6.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$1.errors.UNPREDICTABLE_GAS_LIMIT, { reason: result.message, method, transaction: transaction2, @@ -48110,7 +48110,7 @@ function checkError(method, error, params) { } } let message = error.message; - if (error.code === Logger$3.errors.SERVER_ERROR && error.error && typeof error.error.message === "string") { + if (error.code === Logger$1.errors.SERVER_ERROR && error.error && typeof error.error.message === "string") { message = error.error.message; } else if (typeof error.body === "string") { message = error.body; @@ -48119,35 +48119,35 @@ function checkError(method, error, params) { } message = (message || "").toLowerCase(); if (message.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)) { - logger$6.throwError("insufficient funds for intrinsic transaction cost", Logger$3.errors.INSUFFICIENT_FUNDS, { + logger$6.throwError("insufficient funds for intrinsic transaction cost", Logger$1.errors.INSUFFICIENT_FUNDS, { error, method, transaction: transaction2 }); } if (message.match(/nonce (is )?too low/i)) { - logger$6.throwError("nonce has already been used", Logger$3.errors.NONCE_EXPIRED, { + logger$6.throwError("nonce has already been used", Logger$1.errors.NONCE_EXPIRED, { error, method, transaction: transaction2 }); } if (message.match(/replacement transaction underpriced|transaction gas price.*too low/i)) { - logger$6.throwError("replacement fee too low", Logger$3.errors.REPLACEMENT_UNDERPRICED, { + logger$6.throwError("replacement fee too low", Logger$1.errors.REPLACEMENT_UNDERPRICED, { error, method, transaction: transaction2 }); } if (message.match(/only replay-protected/i)) { - logger$6.throwError("legacy pre-eip-155 transactions not supported", Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$6.throwError("legacy pre-eip-155 transactions not supported", Logger$1.errors.UNSUPPORTED_OPERATION, { error, method, transaction: transaction2 }); } if (errorGas.indexOf(method) >= 0 && message.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)) { - logger$6.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$3.errors.UNPREDICTABLE_GAS_LIMIT, { + logger$6.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger$1.errors.UNPREDICTABLE_GAS_LIMIT, { error, method, transaction: transaction2 @@ -48197,7 +48197,7 @@ class JsonRpcSigner extends Signer$1 { } } connect(provider2) { - return logger$6.throwError("cannot alter JSON-RPC Signer connection", Logger$3.errors.UNSUPPORTED_OPERATION, { + return logger$6.throwError("cannot alter JSON-RPC Signer connection", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "connect" }); } @@ -48210,7 +48210,7 @@ class JsonRpcSigner extends Signer$1 { } return this.provider.send("eth_accounts", []).then((accounts) => { if (accounts.length <= this._index) { - logger$6.throwError("unknown account #" + this._index, Logger$3.errors.UNSUPPORTED_OPERATION, { + logger$6.throwError("unknown account #" + this._index, Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "getAddress" }); } @@ -48258,7 +48258,7 @@ class JsonRpcSigner extends Signer$1 { return hash2; }, (error) => { if (typeof error.message === "string" && error.message.match(/user denied/i)) { - logger$6.throwError("user rejected transaction", Logger$3.errors.ACTION_REJECTED, { + logger$6.throwError("user rejected transaction", Logger$1.errors.ACTION_REJECTED, { action: "sendTransaction", transaction: tx }); @@ -48268,7 +48268,7 @@ class JsonRpcSigner extends Signer$1 { }); } signTransaction(transaction2) { - return logger$6.throwError("signing transactions is unsupported", Logger$3.errors.UNSUPPORTED_OPERATION, { + return logger$6.throwError("signing transactions is unsupported", Logger$1.errors.UNSUPPORTED_OPERATION, { operation: "signTransaction" }); } @@ -48298,7 +48298,7 @@ class JsonRpcSigner extends Signer$1 { return yield this.provider.send("personal_sign", [hexlify(data), address.toLowerCase()]); } catch (error) { if (typeof error.message === "string" && error.message.match(/user denied/i)) { - logger$6.throwError("user rejected signing", Logger$3.errors.ACTION_REJECTED, { + logger$6.throwError("user rejected signing", Logger$1.errors.ACTION_REJECTED, { action: "signMessage", from: address, messageData: message @@ -48316,7 +48316,7 @@ class JsonRpcSigner extends Signer$1 { return yield this.provider.send("eth_sign", [address.toLowerCase(), hexlify(data)]); } catch (error) { if (typeof error.message === "string" && error.message.match(/user denied/i)) { - logger$6.throwError("user rejected signing", Logger$3.errors.ACTION_REJECTED, { + logger$6.throwError("user rejected signing", Logger$1.errors.ACTION_REJECTED, { action: "_legacySignMessage", from: address, messageData: message @@ -48339,7 +48339,7 @@ class JsonRpcSigner extends Signer$1 { ]); } catch (error) { if (typeof error.message === "string" && error.message.match(/user denied/i)) { - logger$6.throwError("user rejected signing", Logger$3.errors.ACTION_REJECTED, { + logger$6.throwError("user rejected signing", Logger$1.errors.ACTION_REJECTED, { action: "_signTypedData", from: address, messageData: { domain: populated.domain, types: types2, value: populated.value } @@ -48452,14 +48452,14 @@ let JsonRpcProvider$1 = class JsonRpcProvider extends BaseProvider { try { return getNetwork2(BigNumber.from(chainId).toNumber()); } catch (error) { - return logger$6.throwError("could not detect network", Logger$3.errors.NETWORK_ERROR, { + return logger$6.throwError("could not detect network", Logger$1.errors.NETWORK_ERROR, { chainId, event: "invalidNetwork", serverError: error }); } } - return logger$6.throwError("could not detect network", Logger$3.errors.NETWORK_ERROR, { + return logger$6.throwError("could not detect network", Logger$1.errors.NETWORK_ERROR, { event: "noNetwork" }); }); @@ -48576,7 +48576,7 @@ let JsonRpcProvider$1 = class JsonRpcProvider extends BaseProvider { } const args = this.prepareRequest(method, params); if (args == null) { - logger$6.throwError(method + " not implemented", Logger$3.errors.NOT_IMPLEMENTED, { operation: method }); + logger$6.throwError(method + " not implemented", Logger$1.errors.NOT_IMPLEMENTED, { operation: method }); } try { return yield this.send(args[0], args[1]); @@ -48709,7 +48709,7 @@ var __awaiter$3 = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$5 = new Logger$3(version$a); +const logger$5 = new Logger$1(version$a); class StaticJsonRpcProvider extends JsonRpcProvider$1 { detectNetwork() { const _super = Object.create(null, { @@ -48720,7 +48720,7 @@ class StaticJsonRpcProvider extends JsonRpcProvider$1 { if (network2 == null) { network2 = yield _super.detectNetwork.call(this); if (!network2) { - logger$5.throwError("no network detected", Logger$3.errors.UNKNOWN_ERROR, {}); + logger$5.throwError("no network detected", Logger$1.errors.UNKNOWN_ERROR, {}); } if (this._network == null) { defineReadOnly$1(this, "_network", network2); @@ -48758,14 +48758,14 @@ var __awaiter$2 = function(thisArg, _arguments, P2, generator) { step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; -const logger$4 = new Logger$3(version$a); +const logger$4 = new Logger$1(version$a); function now() { return (/* @__PURE__ */ new Date()).getTime(); } function checkNetworks(networks2) { let result = null; - for (let i2 = 0; i2 < networks2.length; i2++) { - const network2 = networks2[i2]; + for (let i = 0; i < networks2.length; i++) { + const network2 = networks2[i]; if (network2 == null) { return null; } @@ -48801,7 +48801,7 @@ function serialize$1(value) { } else if (BigNumber.isBigNumber(value)) { return value.toString(); } else if (Array.isArray(value)) { - return JSON.stringify(value.map((i2) => serialize$1(i2))); + return JSON.stringify(value.map((i) => serialize$1(i))); } else if (typeof value === "object") { const keys = Object.keys(value); keys.sort(); @@ -48841,11 +48841,11 @@ function stall(duration) { return { cancel, getPromise, wait: wait2 }; } const ForwardErrors = [ - Logger$3.errors.CALL_EXCEPTION, - Logger$3.errors.INSUFFICIENT_FUNDS, - Logger$3.errors.NONCE_EXPIRED, - Logger$3.errors.REPLACEMENT_UNDERPRICED, - Logger$3.errors.UNPREDICTABLE_GAS_LIMIT + Logger$1.errors.CALL_EXCEPTION, + Logger$1.errors.INSUFFICIENT_FUNDS, + Logger$1.errors.NONCE_EXPIRED, + Logger$1.errors.REPLACEMENT_UNDERPRICED, + Logger$1.errors.UNPREDICTABLE_GAS_LIMIT ]; const ForwardProperties = [ "address", @@ -48886,8 +48886,8 @@ function normalizedTally(normalize2, quorum) { tally[value].count++; }); const keys = Object.keys(tally); - for (let i2 = 0; i2 < keys.length; i2++) { - const check = tally[keys[i2]]; + for (let i = 0; i < keys.length; i++) { + const check = tally[keys[i]]; if (check.count >= quorum) { return check.result; } @@ -49041,7 +49041,7 @@ function getRunner(config2, currentBlockNumber, method, params) { return provider2.getLogs(filter2); } } - return logger$4.throwError("unknown method error", Logger$3.errors.UNKNOWN_ERROR, { + return logger$4.throwError("unknown method error", Logger$1.errors.UNKNOWN_ERROR, { method, params }); @@ -49109,8 +49109,8 @@ class FallbackProvider extends BaseProvider { return error; }); })); - for (let i3 = 0; i3 < results2.length; i3++) { - const result = results2[i3]; + for (let i2 = 0; i2 < results2.length; i2++) { + const result = results2[i2]; if (typeof result === "string") { return result; } @@ -49124,13 +49124,13 @@ class FallbackProvider extends BaseProvider { const configs = shuffled(this.providerConfigs.map(shallowCopy$1)); configs.sort((a2, b2) => a2.priority - b2.priority); const currentBlockNumber = this._highestBlockNumber; - let i2 = 0; + let i = 0; let first = true; while (true) { const t0 = now(); let inflightWeight = configs.filter((c2) => c2.runner && t0 - c2.start < c2.stallTimeout).reduce((accum, c2) => accum + c2.weight, 0); - while (inflightWeight < this.quorum && i2 < configs.length) { - const config2 = configs[i2++]; + while (inflightWeight < this.quorum && i < configs.length) { + const config2 = configs[i++]; const rid = nextRid++; config2.start = now(); config2.staller = stall(config2.stallTimeout); @@ -49247,7 +49247,7 @@ class FallbackProvider extends BaseProvider { } c2.cancelled = true; }); - return logger$4.throwError("failed to meet quorum", Logger$3.errors.SERVER_ERROR, { + return logger$4.throwError("failed to meet quorum", Logger$1.errors.SERVER_ERROR, { method, params, //results: configs.map((c) => c.result), @@ -49258,7 +49258,7 @@ class FallbackProvider extends BaseProvider { }); } } -const logger$3 = new Logger$3(version$a); +const logger$3 = new Logger$1(version$a); let _nextId$1 = 1; function buildWeb3LegacyFetcher(provider2, sendFunc) { const fetcher = "Web3LegacyFetcher"; @@ -49384,7 +49384,7 @@ const regexBytes = new RegExp("^bytes([0-9]+)$"); const regexNumber = new RegExp("^(u?int)([0-9]*)$"); const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); const Zeros = "0000000000000000000000000000000000000000000000000000000000000000"; -const logger$2 = new Logger$3(version$9); +const logger$2 = new Logger$1(version$9); function _pack(type, value, isArray2) { switch (type) { case "address": @@ -49467,7 +49467,7 @@ const lib_esm$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro sha256: sha256$3 }, Symbol.toStringTag, { value: "Module" })); const version$8 = "units/5.7.0"; -const logger$1 = new Logger$3(version$8); +const logger$1 = new Logger$1(version$8); const names = [ "wei", "kwei", @@ -49562,7 +49562,7 @@ const utils$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope Indexed, Interface, LogDescription, - Logger: Logger$3, + Logger: Logger$1, ParamType, RLP: lib_esm$g, SigningKey, @@ -49668,7 +49668,7 @@ const b64ch = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/= const b64chs = Array.prototype.slice.call(b64ch); const b64tab = ((a2) => { let tab = {}; - a2.forEach((c2, i2) => tab[c2] = i2); + a2.forEach((c2, i) => tab[c2] = i); return tab; })(b64chs); const b64re = /^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/; @@ -49679,8 +49679,8 @@ const _tidyB64 = (s2) => s2.replace(/[^A-Za-z0-9\+\/]/g, ""); const btoaPolyfill = (bin) => { let u322, c0, c1, c2, asc = ""; const pad3 = bin.length % 3; - for (let i2 = 0; i2 < bin.length; ) { - if ((c0 = bin.charCodeAt(i2++)) > 255 || (c1 = bin.charCodeAt(i2++)) > 255 || (c2 = bin.charCodeAt(i2++)) > 255) + for (let i = 0; i < bin.length; ) { + if ((c0 = bin.charCodeAt(i++)) > 255 || (c1 = bin.charCodeAt(i++)) > 255 || (c2 = bin.charCodeAt(i++)) > 255) throw new TypeError("invalid character found"); u322 = c0 << 16 | c1 << 8 | c2; asc += b64chs[u322 >> 18 & 63] + b64chs[u322 >> 12 & 63] + b64chs[u322 >> 6 & 63] + b64chs[u322 & 63]; @@ -49691,8 +49691,8 @@ const _btoa = typeof btoa === "function" ? (bin) => btoa(bin) : _hasBuffer ? (bi const _fromUint8Array = _hasBuffer ? (u8a2) => Buffer2.from(u8a2).toString("base64") : (u8a2) => { const maxargs = 4096; let strs = []; - for (let i2 = 0, l2 = u8a2.length; i2 < l2; i2 += maxargs) { - strs.push(_fromCC.apply(null, u8a2.subarray(i2, i2 + maxargs))); + for (let i = 0, l2 = u8a2.length; i < l2; i += maxargs) { + strs.push(_fromCC.apply(null, u8a2.subarray(i, i + maxargs))); } return _btoa(strs.join("")); }; @@ -49730,8 +49730,8 @@ const atobPolyfill = (asc) => { throw new TypeError("malformed base64."); asc += "==".slice(2 - (asc.length & 3)); let u24, bin = "", r1, r2; - for (let i2 = 0; i2 < asc.length; ) { - u24 = b64tab[asc.charAt(i2++)] << 18 | b64tab[asc.charAt(i2++)] << 12 | (r1 = b64tab[asc.charAt(i2++)]) << 6 | (r2 = b64tab[asc.charAt(i2++)]); + for (let i = 0; i < asc.length; ) { + u24 = b64tab[asc.charAt(i++)] << 18 | b64tab[asc.charAt(i++)] << 12 | (r1 = b64tab[asc.charAt(i++)]) << 6 | (r2 = b64tab[asc.charAt(i++)]); bin += r1 === 64 ? _fromCC(u24 >> 16 & 255) : r2 === 64 ? _fromCC(u24 >> 16 & 255, u24 >> 8 & 255) : _fromCC(u24 >> 16 & 255, u24 >> 8 & 255, u24 & 255); } return bin; @@ -49814,8 +49814,8 @@ const gBase64 = { }; var __assign$1 = function() { __assign$1 = Object.assign || function __assign2(t2) { - for (var s2, i2 = 1, n2 = arguments.length; i2 < n2; i2++) { - s2 = arguments[i2]; + for (var s2, i = 1, n2 = arguments.length; i < n2; i++) { + s2 = arguments[i]; for (var p2 in s2) if (Object.prototype.hasOwnProperty.call(s2, p2)) t2[p2] = s2[p2]; @@ -50202,20 +50202,20 @@ var ETHAuth = ( }; this.validateProofSignature = function(proof) { return __awaiter$1(_this, void 0, void 0, function() { - var retIsValid, i2, validator, isValid2, i2; + var retIsValid, i, validator, isValid2, i; return __generator$1(this, function(_a2) { switch (_a2.label) { case 0: retIsValid = []; - i2 = 0; + i = 0; _a2.label = 1; case 1: - if (!(i2 < this.validators.length)) + if (!(i < this.validators.length)) return [3, 6]; _a2.label = 2; case 2: _a2.trys.push([2, 4, , 5]); - validator = this.validators[i2]; + validator = this.validators[i]; return [4, validator(this.provider, this.chainId, proof)]; case 3: isValid2 = _a2.sent().isValid; @@ -50229,11 +50229,11 @@ var ETHAuth = ( retIsValid.push(false); return [3, 5]; case 5: - i2++; + i++; return [3, 1]; case 6: - for (i2 = 0; i2 < retIsValid.length; i2++) { - if (retIsValid[i2]) { + for (i = 0; i < retIsValid.length; i++) { + if (retIsValid[i]) { return [2, true]; } } @@ -50254,7 +50254,7 @@ var ETHAuth = ( return ETHAuth2; }() ); -let ChainId$2 = /* @__PURE__ */ function(ChainId2) { +let ChainId = /* @__PURE__ */ function(ChainId2) { ChainId2[ChainId2["MAINNET"] = 1] = "MAINNET"; ChainId2[ChainId2["ROPSTEN"] = 3] = "ROPSTEN"; ChainId2[ChainId2["RINKEBY"] = 4] = "RINKEBY"; @@ -50293,30 +50293,30 @@ let ChainId$2 = /* @__PURE__ */ function(ChainId2) { ChainId2[ChainId2["HARDHAT_2"] = 31338] = "HARDHAT_2"; return ChainId2; }({}); -let NetworkType$2 = /* @__PURE__ */ function(NetworkType2) { +let NetworkType = /* @__PURE__ */ function(NetworkType2) { NetworkType2["MAINNET"] = "mainnet"; NetworkType2["TESTNET"] = "testnet"; return NetworkType2; }({}); -const networks$3 = { - [ChainId$2.MAINNET]: { - chainId: ChainId$2.MAINNET, - type: NetworkType$2.MAINNET, +const networks$1 = { + [ChainId.MAINNET]: { + chainId: ChainId.MAINNET, + type: NetworkType.MAINNET, name: "mainnet", title: "Ethereum", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.MAINNET}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.MAINNET}.webp`, blockExplorer: { name: "Etherscan", rootUrl: "https://etherscan.io/" }, ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e" }, - [ChainId$2.ROPSTEN]: { - chainId: ChainId$2.ROPSTEN, - type: NetworkType$2.TESTNET, + [ChainId.ROPSTEN]: { + chainId: ChainId.ROPSTEN, + type: NetworkType.TESTNET, name: "ropsten", title: "Ropsten", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.ROPSTEN}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.ROPSTEN}.webp`, testnet: true, blockExplorer: { name: "Etherscan (Ropsten)", @@ -50325,12 +50325,12 @@ const networks$3 = { ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", deprecated: true }, - [ChainId$2.RINKEBY]: { - chainId: ChainId$2.RINKEBY, - type: NetworkType$2.TESTNET, + [ChainId.RINKEBY]: { + chainId: ChainId.RINKEBY, + type: NetworkType.TESTNET, name: "rinkeby", title: "Rinkeby", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.RINKEBY}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.RINKEBY}.webp`, testnet: true, blockExplorer: { name: "Etherscan (Rinkeby)", @@ -50339,12 +50339,12 @@ const networks$3 = { ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", deprecated: true }, - [ChainId$2.GOERLI]: { - chainId: ChainId$2.GOERLI, - type: NetworkType$2.TESTNET, + [ChainId.GOERLI]: { + chainId: ChainId.GOERLI, + type: NetworkType.TESTNET, name: "goerli", title: "Goerli", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.GOERLI}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.GOERLI}.webp`, testnet: true, blockExplorer: { name: "Etherscan (Goerli)", @@ -50353,12 +50353,12 @@ const networks$3 = { ensAddress: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", deprecated: true }, - [ChainId$2.KOVAN]: { - chainId: ChainId$2.KOVAN, - type: NetworkType$2.TESTNET, + [ChainId.KOVAN]: { + chainId: ChainId.KOVAN, + type: NetworkType.TESTNET, name: "kovan", title: "Kovan", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.KOVAN}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.KOVAN}.webp`, testnet: true, blockExplorer: { name: "Etherscan (Kovan)", @@ -50366,35 +50366,35 @@ const networks$3 = { }, deprecated: true }, - [ChainId$2.SEPOLIA]: { - chainId: ChainId$2.SEPOLIA, - type: NetworkType$2.TESTNET, + [ChainId.SEPOLIA]: { + chainId: ChainId.SEPOLIA, + type: NetworkType.TESTNET, name: "sepolia", title: "Sepolia", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.SEPOLIA}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.SEPOLIA}.webp`, testnet: true, blockExplorer: { name: "Etherscan (Sepolia)", rootUrl: "https://sepolia.etherscan.io/" } }, - [ChainId$2.POLYGON]: { - chainId: ChainId$2.POLYGON, - type: NetworkType$2.MAINNET, + [ChainId.POLYGON]: { + chainId: ChainId.POLYGON, + type: NetworkType.MAINNET, name: "polygon", title: "Polygon", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.POLYGON}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.POLYGON}.webp`, blockExplorer: { name: "Polygonscan", rootUrl: "https://polygonscan.com/" } }, - [ChainId$2.POLYGON_MUMBAI]: { - chainId: ChainId$2.POLYGON_MUMBAI, - type: NetworkType$2.TESTNET, + [ChainId.POLYGON_MUMBAI]: { + chainId: ChainId.POLYGON_MUMBAI, + type: NetworkType.TESTNET, name: "mumbai", title: "Polygon Mumbai", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.POLYGON_MUMBAI}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.POLYGON_MUMBAI}.webp`, testnet: true, blockExplorer: { name: "Polygonscan (Mumbai)", @@ -50402,69 +50402,69 @@ const networks$3 = { }, deprecated: true }, - [ChainId$2.POLYGON_AMOY]: { - chainId: ChainId$2.POLYGON_AMOY, - type: NetworkType$2.TESTNET, + [ChainId.POLYGON_AMOY]: { + chainId: ChainId.POLYGON_AMOY, + type: NetworkType.TESTNET, name: "amoy", title: "Polygon Amoy", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.POLYGON_AMOY}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.POLYGON_AMOY}.webp`, testnet: true, blockExplorer: { name: "OKLink (Amoy)", rootUrl: "https://www.oklink.com/amoy/" } }, - [ChainId$2.POLYGON_ZKEVM]: { - chainId: ChainId$2.POLYGON_ZKEVM, - type: NetworkType$2.MAINNET, + [ChainId.POLYGON_ZKEVM]: { + chainId: ChainId.POLYGON_ZKEVM, + type: NetworkType.MAINNET, name: "polygon-zkevm", title: "Polygon zkEVM", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.POLYGON_ZKEVM}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.POLYGON_ZKEVM}.webp`, blockExplorer: { name: "Polygonscan (zkEVM)", rootUrl: "https://zkevm.polygonscan.com/" } }, - [ChainId$2.BSC]: { - chainId: ChainId$2.BSC, - type: NetworkType$2.MAINNET, + [ChainId.BSC]: { + chainId: ChainId.BSC, + type: NetworkType.MAINNET, name: "bsc", title: "BNB Smart Chain", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.BSC}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.BSC}.webp`, blockExplorer: { name: "BSCScan", rootUrl: "https://bscscan.com/" } }, - [ChainId$2.BSC_TESTNET]: { - chainId: ChainId$2.BSC_TESTNET, - type: NetworkType$2.TESTNET, + [ChainId.BSC_TESTNET]: { + chainId: ChainId.BSC_TESTNET, + type: NetworkType.TESTNET, name: "bsc-testnet", title: "BNB Smart Chain Testnet", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.BSC_TESTNET}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.BSC_TESTNET}.webp`, testnet: true, blockExplorer: { name: "BSCScan (Testnet)", rootUrl: "https://testnet.bscscan.com/" } }, - [ChainId$2.OPTIMISM]: { - chainId: ChainId$2.OPTIMISM, - type: NetworkType$2.MAINNET, + [ChainId.OPTIMISM]: { + chainId: ChainId.OPTIMISM, + type: NetworkType.MAINNET, name: "optimism", title: "Optimism", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.OPTIMISM}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.OPTIMISM}.webp`, blockExplorer: { name: "Etherscan (Optimism)", rootUrl: "https://optimistic.etherscan.io/" } }, - [ChainId$2.OPTIMISM_KOVAN]: { - chainId: ChainId$2.OPTIMISM_KOVAN, - type: NetworkType$2.TESTNET, + [ChainId.OPTIMISM_KOVAN]: { + chainId: ChainId.OPTIMISM_KOVAN, + type: NetworkType.TESTNET, name: "optimism-kovan", title: "Optimism Kovan", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.OPTIMISM_KOVAN}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.OPTIMISM_KOVAN}.webp`, testnet: true, blockExplorer: { name: "Etherscan (Optimism Kovan)", @@ -50472,12 +50472,12 @@ const networks$3 = { }, deprecated: true }, - [ChainId$2.OPTIMISM_GOERLI]: { - chainId: ChainId$2.OPTIMISM_GOERLI, - type: NetworkType$2.TESTNET, + [ChainId.OPTIMISM_GOERLI]: { + chainId: ChainId.OPTIMISM_GOERLI, + type: NetworkType.TESTNET, name: "optimism-goerli", title: "Optimism Goerli", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.OPTIMISM_GOERLI}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.OPTIMISM_GOERLI}.webp`, testnet: true, blockExplorer: { name: "Etherscan (Optimism Goerli)", @@ -50485,35 +50485,35 @@ const networks$3 = { }, deprecated: true }, - [ChainId$2.OPTIMISM_SEPOLIA]: { - chainId: ChainId$2.OPTIMISM_SEPOLIA, - type: NetworkType$2.TESTNET, + [ChainId.OPTIMISM_SEPOLIA]: { + chainId: ChainId.OPTIMISM_SEPOLIA, + type: NetworkType.TESTNET, name: "optimism-sepolia", title: "Optimism Sepolia", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.OPTIMISM_SEPOLIA}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.OPTIMISM_SEPOLIA}.webp`, testnet: true, blockExplorer: { name: "Etherscan (Optimism Sepolia)", rootUrl: "https://sepolia-optimistic.etherscan.io/" } }, - [ChainId$2.ARBITRUM]: { - chainId: ChainId$2.ARBITRUM, - type: NetworkType$2.MAINNET, + [ChainId.ARBITRUM]: { + chainId: ChainId.ARBITRUM, + type: NetworkType.MAINNET, name: "arbitrum", title: "Arbitrum One", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.ARBITRUM}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.ARBITRUM}.webp`, blockExplorer: { name: "Arbiscan", rootUrl: "https://arbiscan.io/" } }, - [ChainId$2.ARBITRUM_GOERLI]: { - chainId: ChainId$2.ARBITRUM_GOERLI, - type: NetworkType$2.TESTNET, + [ChainId.ARBITRUM_GOERLI]: { + chainId: ChainId.ARBITRUM_GOERLI, + type: NetworkType.TESTNET, name: "arbitrum-goerli", title: "Arbitrum Goerli", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.ARBITRUM_GOERLI}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.ARBITRUM_GOERLI}.webp`, testnet: true, blockExplorer: { name: "Arbiscan (Goerli Testnet)", @@ -50521,80 +50521,80 @@ const networks$3 = { }, deprecated: true }, - [ChainId$2.ARBITRUM_SEPOLIA]: { - chainId: ChainId$2.ARBITRUM_SEPOLIA, - type: NetworkType$2.TESTNET, + [ChainId.ARBITRUM_SEPOLIA]: { + chainId: ChainId.ARBITRUM_SEPOLIA, + type: NetworkType.TESTNET, name: "arbitrum-sepolia", title: "Arbitrum Sepolia", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.ARBITRUM_SEPOLIA}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.ARBITRUM_SEPOLIA}.webp`, testnet: true, blockExplorer: { name: "Arbiscan (Sepolia Testnet)", rootUrl: "https://sepolia.arbiscan.io/" } }, - [ChainId$2.ARBITRUM_NOVA]: { - chainId: ChainId$2.ARBITRUM_NOVA, - type: NetworkType$2.MAINNET, + [ChainId.ARBITRUM_NOVA]: { + chainId: ChainId.ARBITRUM_NOVA, + type: NetworkType.MAINNET, name: "arbitrum-nova", title: "Arbitrum Nova", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.ARBITRUM_NOVA}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.ARBITRUM_NOVA}.webp`, blockExplorer: { name: "Arbiscan Nova", rootUrl: "https://nova.arbiscan.io/" } }, - [ChainId$2.AVALANCHE]: { - chainId: ChainId$2.AVALANCHE, - type: NetworkType$2.MAINNET, + [ChainId.AVALANCHE]: { + chainId: ChainId.AVALANCHE, + type: NetworkType.MAINNET, name: "avalanche", title: "Avalanche", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.AVALANCHE}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.AVALANCHE}.webp`, blockExplorer: { name: "Snowtrace", rootUrl: "https://subnets.avax.network/c-chain/" } }, - [ChainId$2.AVALANCHE_TESTNET]: { - chainId: ChainId$2.AVALANCHE_TESTNET, - type: NetworkType$2.TESTNET, + [ChainId.AVALANCHE_TESTNET]: { + chainId: ChainId.AVALANCHE_TESTNET, + type: NetworkType.TESTNET, name: "avalanche-testnet", title: "Avalanche Testnet", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.AVALANCHE_TESTNET}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.AVALANCHE_TESTNET}.webp`, testnet: true, blockExplorer: { name: "Snowtrace (Testnet)", rootUrl: "https://subnets-test.avax.network/c-chain/" } }, - [ChainId$2.GNOSIS]: { - chainId: ChainId$2.GNOSIS, - type: NetworkType$2.MAINNET, + [ChainId.GNOSIS]: { + chainId: ChainId.GNOSIS, + type: NetworkType.MAINNET, name: "gnosis", title: "Gnosis Chain", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.GNOSIS}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.GNOSIS}.webp`, blockExplorer: { name: "Gnosis Chain Explorer", rootUrl: "https://blockscout.com/xdai/mainnet/" } }, - [ChainId$2.BASE]: { - chainId: ChainId$2.BASE, - type: NetworkType$2.MAINNET, + [ChainId.BASE]: { + chainId: ChainId.BASE, + type: NetworkType.MAINNET, name: "base", title: "Base (Coinbase)", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.BASE}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.BASE}.webp`, blockExplorer: { name: "Base Explorer", rootUrl: "https://basescan.org/" } }, - [ChainId$2.BASE_GOERLI]: { - chainId: ChainId$2.BASE_GOERLI, - type: NetworkType$2.TESTNET, + [ChainId.BASE_GOERLI]: { + chainId: ChainId.BASE_GOERLI, + type: NetworkType.TESTNET, name: "base-goerli", title: "Base Goerli", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.BASE_GOERLI}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.BASE_GOERLI}.webp`, testnet: true, blockExplorer: { name: "Base Goerli Explorer", @@ -50602,117 +50602,117 @@ const networks$3 = { }, deprecated: true }, - [ChainId$2.BASE_SEPOLIA]: { - chainId: ChainId$2.BASE_SEPOLIA, - type: NetworkType$2.TESTNET, + [ChainId.BASE_SEPOLIA]: { + chainId: ChainId.BASE_SEPOLIA, + type: NetworkType.TESTNET, name: "base-sepolia", title: "Base Sepolia", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.BASE_SEPOLIA}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.BASE_SEPOLIA}.webp`, testnet: true, blockExplorer: { name: "Base Sepolia Explorer", rootUrl: "https://base-sepolia.blockscout.com/" } }, - [ChainId$2.HOMEVERSE]: { - chainId: ChainId$2.HOMEVERSE, - type: NetworkType$2.MAINNET, + [ChainId.HOMEVERSE]: { + chainId: ChainId.HOMEVERSE, + type: NetworkType.MAINNET, name: "homeverse", title: "Oasys Homeverse", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.HOMEVERSE}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.HOMEVERSE}.webp`, blockExplorer: { name: "Oasys Homeverse Explorer", rootUrl: "https://explorer.oasys.homeverse.games/" } }, - [ChainId$2.HOMEVERSE_TESTNET]: { - chainId: ChainId$2.HOMEVERSE_TESTNET, - type: NetworkType$2.TESTNET, + [ChainId.HOMEVERSE_TESTNET]: { + chainId: ChainId.HOMEVERSE_TESTNET, + type: NetworkType.TESTNET, name: "homeverse-testnet", title: "Oasys Homeverse Testnet", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.HOMEVERSE_TESTNET}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.HOMEVERSE_TESTNET}.webp`, testnet: true, blockExplorer: { name: "Oasys Homeverse Explorer (Testnet)", rootUrl: "https://explorer.testnet.oasys.homeverse.games/" } }, - [ChainId$2.XAI]: { - chainId: ChainId$2.XAI, - type: NetworkType$2.MAINNET, + [ChainId.XAI]: { + chainId: ChainId.XAI, + type: NetworkType.MAINNET, name: "xai", title: "Xai", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.XAI}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.XAI}.webp`, blockExplorer: { name: "Xai Explorer", rootUrl: "https://explorer.xai-chain.net/" } }, - [ChainId$2.XAI_SEPOLIA]: { - chainId: ChainId$2.XAI_SEPOLIA, - type: NetworkType$2.TESTNET, + [ChainId.XAI_SEPOLIA]: { + chainId: ChainId.XAI_SEPOLIA, + type: NetworkType.TESTNET, name: "xai-sepolia", title: "Xai Sepolia", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.XAI_SEPOLIA}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.XAI_SEPOLIA}.webp`, testnet: true, blockExplorer: { name: "Xai Sepolia Explorer", rootUrl: "https://testnet-explorer-v2.xai-chain.net/" } }, - [ChainId$2.ASTAR_ZKEVM]: { - chainId: ChainId$2.ASTAR_ZKEVM, - type: NetworkType$2.MAINNET, + [ChainId.ASTAR_ZKEVM]: { + chainId: ChainId.ASTAR_ZKEVM, + type: NetworkType.MAINNET, name: "astar-zkevm", title: "Astar zkEVM", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.ASTAR_ZKEVM}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.ASTAR_ZKEVM}.webp`, blockExplorer: { name: "Astar zkEVM Explorer", rootUrl: "https://astar-zkevm.explorer.startale.com/" } }, - [ChainId$2.ASTAR_ZKYOTO]: { - chainId: ChainId$2.ASTAR_ZKYOTO, - type: NetworkType$2.TESTNET, + [ChainId.ASTAR_ZKYOTO]: { + chainId: ChainId.ASTAR_ZKYOTO, + type: NetworkType.TESTNET, name: "astar-zkyoto", title: "Astar zKyoto Testnet", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.ASTAR_ZKYOTO}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.ASTAR_ZKYOTO}.webp`, testnet: true, blockExplorer: { name: "Astar zKyoto Explorer", rootUrl: "https://astar-zkyoto.blockscout.com/" } }, - [ChainId$2.XR_SEPOLIA]: { - chainId: ChainId$2.XR_SEPOLIA, - type: NetworkType$2.TESTNET, + [ChainId.XR_SEPOLIA]: { + chainId: ChainId.XR_SEPOLIA, + type: NetworkType.TESTNET, name: "xr-sepolia", title: "XR Sepolia", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.XR_SEPOLIA}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.XR_SEPOLIA}.webp`, testnet: true, blockExplorer: { name: "XR Sepolia Explorer", rootUrl: "https://xr-sepolia-testnet.explorer.caldera.xyz/" } }, - [ChainId$2.TELOS]: { - chainId: ChainId$2.TELOS, - type: NetworkType$2.MAINNET, + [ChainId.TELOS]: { + chainId: ChainId.TELOS, + type: NetworkType.MAINNET, name: "telos", title: "Telos", - logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId$2.TELOS}.webp`, + logoURI: `https://assets.sequence.info/images/networks/medium/${ChainId.TELOS}.webp`, blockExplorer: { name: "Telos Explorer", rootUrl: "https://explorer.telos.net/network/" } }, - [ChainId$2.HARDHAT]: { - chainId: ChainId$2.HARDHAT, + [ChainId.HARDHAT]: { + chainId: ChainId.HARDHAT, name: "hardhat", title: "Hardhat (local testnet)" }, - [ChainId$2.HARDHAT_2]: { - chainId: ChainId$2.HARDHAT_2, + [ChainId.HARDHAT_2]: { + chainId: ChainId.HARDHAT_2, name: "hardhat2", title: "Hardhat (local testnet)" } @@ -50767,10 +50767,10 @@ const jwtDecodeClaims = (jwt) => { const claims = JSON.parse(gBase64.decode(parts[1])); return claims; }; -function _extends$k() { - _extends$k = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$g() { + _extends$g = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -50779,42 +50779,42 @@ function _extends$k() { } return target; }; - return _extends$k.apply(this, arguments); + return _extends$g.apply(this, arguments); } -var logLevel$2 = /* @__PURE__ */ function(logLevel2) { +var logLevel = /* @__PURE__ */ function(logLevel2) { logLevel2[logLevel2["DEBUG"] = 1] = "DEBUG"; logLevel2[logLevel2["INFO"] = 2] = "INFO"; logLevel2[logLevel2["WARN"] = 3] = "WARN"; logLevel2[logLevel2["ERROR"] = 4] = "ERROR"; logLevel2[logLevel2["DISABLED"] = 5] = "DISABLED"; return logLevel2; -}(logLevel$2 || {}); -let Logger$2 = class Logger2 { +}(logLevel || {}); +class Logger2 { constructor(config2) { this.config = config2; this.logLevel = void 0; this.configure(config2); } configure(config2) { - this.config = _extends$k({}, this.config, config2); + this.config = _extends$g({}, this.config, config2); switch (this.config.logLevel) { case "DEBUG": - this.logLevel = logLevel$2.DEBUG; + this.logLevel = logLevel.DEBUG; break; case "INFO": - this.logLevel = logLevel$2.INFO; + this.logLevel = logLevel.INFO; break; case "WARN": - this.logLevel = logLevel$2.WARN; + this.logLevel = logLevel.WARN; break; case "ERROR": - this.logLevel = logLevel$2.ERROR; + this.logLevel = logLevel.ERROR; break; case "DISABLED": - this.logLevel = logLevel$2.DISABLED; + this.logLevel = logLevel.DISABLED; break; default: - this.logLevel = logLevel$2.INFO; + this.logLevel = logLevel.INFO; break; } if (this.config.silence === void 0) { @@ -50824,21 +50824,21 @@ let Logger$2 = class Logger2 { debug(message, ...optionalParams) { if (this.config.silence === true) return; - if (this.logLevel === logLevel$2.DEBUG) { + if (this.logLevel === logLevel.DEBUG) { console.log(message, ...optionalParams); } } info(message, ...optionalParams) { if (this.config.silence === true) return; - if (this.logLevel <= logLevel$2.INFO) { + if (this.logLevel <= logLevel.INFO) { console.log(message, ...optionalParams); } } warn(message, ...optionalParams) { if (this.config.silence === true) return; - if (this.logLevel <= logLevel$2.WARN) { + if (this.logLevel <= logLevel.WARN) { console.warn(message, ...optionalParams); if (this.config.onwarn) { this.config.onwarn(message, optionalParams); @@ -50848,15 +50848,15 @@ let Logger$2 = class Logger2 { error(message, ...optionalParams) { if (this.config.silence === true) return; - if (this.logLevel <= logLevel$2.ERROR) { + if (this.logLevel <= logLevel.ERROR) { console.error(message, ...optionalParams); if (this.config.onerror) { this.config.onerror(message, optionalParams); } } } -}; -const logger = new Logger$2({ +} +const logger = new Logger2({ logLevel: "INFO", // By default we silence the logger. In tests we should call `configureLogger` // below to set silence: false. @@ -50875,8 +50875,8 @@ class Base { if (buffer1.length !== buffer2.length) { return false; } - for (let i2 = 0; i2 < buffer1.length; i2++) { - if (buffer1[i2] !== buffer2[i2]) { + for (let i = 0; i < buffer1.length; i++) { + if (buffer1[i] !== buffer2[i]) { return false; } } @@ -50891,10 +50891,10 @@ class Base { const mid = Math.floor((start + end) / 2); const ordering = compareFunction(array[mid], element); if (ordering === 0) { - for (let i2 = mid - 1; i2 >= 0; i2--) { - if (compareFunction(array[i2], element) === 0) + for (let i = mid - 1; i >= 0; i--) { + if (compareFunction(array[i], element) === 0) continue; - return i2 + 1; + return i + 1; } return 0; } else if (ordering < 0) { @@ -50907,17 +50907,17 @@ class Base { } static compare(a2, b2) { const len = Math.min(a2.length, b2.length); - for (let i2 = 0; i2 < len; i2++) { - if (a2[i2] !== b2[i2]) { - return a2[i2] - b2[i2]; + for (let i = 0; i < len; i++) { + if (a2[i] !== b2[i]) { + return a2[i] - b2[i]; } } return a2.length - b2.length; } static linearSearch(array, element, eqChecker) { - for (let i2 = 0; i2 < array.length; i2++) { - if (eqChecker(array[i2], element)) { - return i2; + for (let i = 0; i < array.length; i++) { + if (eqChecker(array[i], element)) { + return i; } } return -1; @@ -50975,18 +50975,18 @@ class MerkleTree extends Base { const layerIndex = this.layers.length; this.layers.push([]); const layerLimit = nodes.length; - for (let i2 = 0; i2 < nodes.length; i2 += 2) { - if (i2 >= layerLimit) { + for (let i = 0; i < nodes.length; i += 2) { + if (i >= layerLimit) { this.layers[layerIndex].push(...nodes.slice(layerLimit)); break; - } else if (i2 + 1 === nodes.length) { + } else if (i + 1 === nodes.length) { if (nodes.length % 2 === 1) { - this.layers[layerIndex].push(nodes[i2]); + this.layers[layerIndex].push(nodes[i]); continue; } } - const left = nodes[i2]; - const right = i2 + 1 === nodes.length ? left : nodes[i2 + 1]; + const left = nodes[i]; + const right = i + 1 === nodes.length ? left : nodes[i + 1]; const combined = [left, right]; if (this.sortPairs) { combined.sort(Base.compare); @@ -51014,9 +51014,9 @@ class MerkleTree extends Base { const proof = []; if (!Number.isInteger(index2)) { index2 = -1; - for (let i2 = 0; i2 < this.leaves.length; i2++) { - if (Base.compare(leaf, this.leaves[i2]) === 0) { - index2 = i2; + for (let i = 0; i < this.leaves.length; i++) { + if (Base.compare(leaf, this.leaves[i]) === 0) { + index2 = i; } } } @@ -51024,8 +51024,8 @@ class MerkleTree extends Base { if (index2 <= -1) { return []; } - for (let i2 = 0; i2 < this.layers.length; i2++) { - const layer = this.layers[i2]; + for (let i = 0; i < this.layers.length; i++) { + const layer = this.layers[i]; const isRightNode = index2 % 2; const pairIndex = isRightNode ? index2 - 1 : index2 + 1; if (pairIndex < layer.length) { @@ -51047,8 +51047,8 @@ class MerkleTree extends Base { if (!Array.isArray(proof) || !targetNode || !root2) { return false; } - for (let i2 = 0; i2 < proof.length; i2++) { - const node = proof[i2]; + for (let i = 0; i < proof.length; i++) { + const node = proof[i]; let data; let isLeftNode; if (typeof node === "string") { @@ -51234,7 +51234,7 @@ const sleep$1 = (t2) => { }); }; const encodeTypedDataHash = (typedData) => { - const types2 = _extends$k({}, typedData.types); + const types2 = _extends$g({}, typedData.types); delete types2["EIP712Domain"]; return TypedDataEncoder.hash(typedData.domain, types2, typedData.message); }; @@ -51252,7 +51252,7 @@ const { const urlClean = (url) => url.replace(/([^:]\/)\/+/g, "$1"); const utils$1$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, - Logger: Logger$2, + Logger: Logger2, MerkleTreeGenerator, PromiseCache: PromiseCache$1, base64Decode, @@ -51288,10 +51288,10 @@ const utils$1$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro subDigestOf, urlClean }, Symbol.toStringTag, { value: "Module" })); -function _extends$j() { - _extends$j = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$f() { + _extends$f = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -51300,7 +51300,7 @@ function _extends$j() { } return target; }; - return _extends$j.apply(this, arguments); + return _extends$f.apply(this, arguments); } function isNetworkConfig(cand) { return cand && cand.chainId !== void 0 && cand.name !== void 0 && cand.rpcUrl !== void 0 && cand.relayer !== void 0; @@ -51319,7 +51319,7 @@ const maybeChainId = (chainId) => { return void 0; return getChainId$2(chainId); }; -const isValidNetworkConfig$2 = (networkConfig, raise = false, skipRelayerCheck = false) => { +const isValidNetworkConfig = (networkConfig, raise = false, skipRelayerCheck = false) => { if (!networkConfig) throw new Error(`invalid network config: empty config`); const configs = []; @@ -51334,7 +51334,7 @@ const isValidNetworkConfig$2 = (networkConfig, raise = false, skipRelayerCheck = return false; } const chainIds = configs.map((c2) => c2.chainId).sort(); - const dupes = chainIds.filter((c2, i2) => chainIds.indexOf(c2) !== i2); + const dupes = chainIds.filter((c2, i) => chainIds.indexOf(c2) !== i); if (dupes.length > 0) { if (raise) throw new Error(`invalid network config: duplicate chainIds ${dupes}`); @@ -51342,15 +51342,15 @@ const isValidNetworkConfig$2 = (networkConfig, raise = false, skipRelayerCheck = } configs.forEach((c2) => c2.name = c2.name.toLowerCase()); const names2 = configs.map((c2) => c2.name).sort(); - const nameDupes = names2.filter((c2, i2) => names2.indexOf(c2) !== i2); + const nameDupes = names2.filter((c2, i) => names2.indexOf(c2) !== i); if (nameDupes.length > 0) { if (raise) throw new Error(`invalid network config: duplicate network names ${nameDupes}`); return false; } let defaultChain = false; - for (let i2 = 0; i2 < configs.length; i2++) { - const c2 = configs[i2]; + for (let i = 0; i < configs.length; i++) { + const c2 = configs[i]; if ((!c2.rpcUrl || c2.rpcUrl === "") && !c2.provider) { if (raise) throw new Error(`invalid network config for chainId ${c2.chainId}: rpcUrl or provider must be provided`); @@ -51379,13 +51379,13 @@ const isValidNetworkConfig$2 = (networkConfig, raise = false, skipRelayerCheck = } return true; }; -const ensureValidNetworks$2 = (networks2, skipRelayerCheck = false) => { - isValidNetworkConfig$2(networks2, true, skipRelayerCheck); +const ensureValidNetworks = (networks2, skipRelayerCheck = false) => { + isValidNetworkConfig(networks2, true, skipRelayerCheck); return networks2; }; const ensureUniqueNetworks = (networks2, raise = true) => { const chainIds = networks2.map((c2) => c2.chainId).sort(); - const dupes = chainIds.filter((c2, i2) => chainIds.indexOf(c2) !== i2); + const dupes = chainIds.filter((c2, i) => chainIds.indexOf(c2) !== i); if (dupes.length > 0) { if (raise) throw new Error(`invalid network config: duplicate chainIds ${dupes}`); @@ -51413,8 +51413,8 @@ const updateNetworkConfig = (src, dest) => { dest.relayer = src.relayer; } }; -const validateAndSortNetworks$2 = (networks2) => { - return ensureValidNetworks$2(sortNetworks$2(networks2)); +const validateAndSortNetworks = (networks2) => { + return ensureValidNetworks(sortNetworks(networks2)); }; const findNetworkConfig = (networks2, chainId) => { if (typeof chainId === "string") { @@ -51446,12 +51446,12 @@ const checkNetworkConfig = (network2, chainId) => { }; const networksIndex = (networks2) => { const index2 = {}; - for (let i2 = 0; i2 < networks2.length; i2++) { - index2[networks2[i2].name] = networks2[i2]; + for (let i = 0; i < networks2.length; i++) { + index2[networks2[i].name] = networks2[i]; } return index2; }; -const sortNetworks$2 = (networks2) => { +const sortNetworks = (networks2) => { if (!networks2) { return []; } @@ -51465,7 +51465,7 @@ const sortNetworks$2 = (networks2) => { config2.splice(0, 0, config2.splice(defaultConfigIdx, 1)[0]); return config2; }; -const stringTemplate$2 = (sTemplate, mData) => { +const stringTemplate = (sTemplate, mData) => { if (typeof sTemplate === "string") { mData = mData ? mData : {}; return sTemplate.replace(/\$\{\s*([$#@\-\d\w]+)\s*\}/gim, function(fullMath, grp) { @@ -51484,13 +51484,13 @@ const stringTemplate$2 = (sTemplate, mData) => { } return ""; }; -const indexerURL$2 = (network2) => stringTemplate$2("https://${network}-indexer.sequence.app", { +const indexerURL = (network2) => stringTemplate("https://${network}-indexer.sequence.app", { network: network2 }); -const relayerURL$2 = (network2) => stringTemplate$2("https://${network}-relayer.sequence.app", { +const relayerURL = (network2) => stringTemplate("https://${network}-relayer.sequence.app", { network: network2 }); -const nodesURL$2 = (network2) => stringTemplate$2("https://nodes.sequence.app/${network}", { +const nodesURL = (network2) => stringTemplate("https://nodes.sequence.app/${network}", { network: network2 }); function findSupportedNetwork(chainIdOrName) { @@ -51505,29 +51505,29 @@ function toChainIdNumber(chainIdLike) { } return BigNumber.from(chainIdLike.chainId); } -const genUrls$2 = (network2) => { - const rpcUrl = nodesURL$2(network2); +const genUrls = (network2) => { + const rpcUrl = nodesURL(network2); return { rpcUrl, relayer: { - url: relayerURL$2(network2), + url: relayerURL(network2), provider: { url: rpcUrl } }, - indexerUrl: indexerURL$2(network2) + indexerUrl: indexerURL(network2) }; }; -const allNetworks = validateAndSortNetworks$2([_extends$j({}, networks$3[ChainId$2.POLYGON], genUrls$2("polygon"), { +const allNetworks = validateAndSortNetworks([_extends$f({}, networks$1[ChainId.POLYGON], genUrls("polygon"), { isDefaultChain: true, isAuthChain: true -}), _extends$j({}, networks$3[ChainId$2.MAINNET], genUrls$2("mainnet")), _extends$j({}, networks$3[ChainId$2.BSC], genUrls$2("bsc")), _extends$j({}, networks$3[ChainId$2.AVALANCHE], genUrls$2("avalanche")), _extends$j({}, networks$3[ChainId$2.ARBITRUM], genUrls$2("arbitrum")), _extends$j({}, networks$3[ChainId$2.ARBITRUM_NOVA], genUrls$2("arbitrum-nova")), _extends$j({}, networks$3[ChainId$2.OPTIMISM], genUrls$2("optimism")), _extends$j({}, networks$3[ChainId$2.OPTIMISM_SEPOLIA], genUrls$2("optimism-sepolia")), _extends$j({}, networks$3[ChainId$2.POLYGON_ZKEVM], genUrls$2("polygon-zkevm")), _extends$j({}, networks$3[ChainId$2.GNOSIS], genUrls$2("gnosis")), _extends$j({}, networks$3[ChainId$2.RINKEBY], genUrls$2("rinkeby"), { +}), _extends$f({}, networks$1[ChainId.MAINNET], genUrls("mainnet")), _extends$f({}, networks$1[ChainId.BSC], genUrls("bsc")), _extends$f({}, networks$1[ChainId.AVALANCHE], genUrls("avalanche")), _extends$f({}, networks$1[ChainId.ARBITRUM], genUrls("arbitrum")), _extends$f({}, networks$1[ChainId.ARBITRUM_NOVA], genUrls("arbitrum-nova")), _extends$f({}, networks$1[ChainId.OPTIMISM], genUrls("optimism")), _extends$f({}, networks$1[ChainId.OPTIMISM_SEPOLIA], genUrls("optimism-sepolia")), _extends$f({}, networks$1[ChainId.POLYGON_ZKEVM], genUrls("polygon-zkevm")), _extends$f({}, networks$1[ChainId.GNOSIS], genUrls("gnosis")), _extends$f({}, networks$1[ChainId.RINKEBY], genUrls("rinkeby"), { disabled: true -}), _extends$j({}, networks$3[ChainId$2.GOERLI], genUrls$2("goerli"), { +}), _extends$f({}, networks$1[ChainId.GOERLI], genUrls("goerli"), { disabled: true -}), _extends$j({}, networks$3[ChainId$2.SEPOLIA], genUrls$2("sepolia")), _extends$j({}, networks$3[ChainId$2.POLYGON_MUMBAI], genUrls$2("mumbai"), { +}), _extends$f({}, networks$1[ChainId.SEPOLIA], genUrls("sepolia")), _extends$f({}, networks$1[ChainId.POLYGON_MUMBAI], genUrls("mumbai"), { disabled: true -}), _extends$j({}, networks$3[ChainId$2.POLYGON_AMOY], genUrls$2("amoy")), _extends$j({}, networks$3[ChainId$2.BSC_TESTNET], genUrls$2("bsc-testnet")), _extends$j({}, networks$3[ChainId$2.ARBITRUM_SEPOLIA], genUrls$2("arbitrum-sepolia")), _extends$j({}, networks$3[ChainId$2.BASE], genUrls$2("base")), _extends$j({}, networks$3[ChainId$2.BASE_SEPOLIA], genUrls$2("base-sepolia")), _extends$j({}, networks$3[ChainId$2.HOMEVERSE], genUrls$2("homeverse")), _extends$j({}, networks$3[ChainId$2.HOMEVERSE_TESTNET], genUrls$2("homeverse-testnet")), _extends$j({}, networks$3[ChainId$2.XAI], genUrls$2("xai")), _extends$j({}, networks$3[ChainId$2.XAI_SEPOLIA], genUrls$2("xai-sepolia")), _extends$j({}, networks$3[ChainId$2.AVALANCHE_TESTNET], genUrls$2("avalanche-testnet")), _extends$j({}, networks$3[ChainId$2.ASTAR_ZKEVM], genUrls$2("astar-zkevm")), _extends$j({}, networks$3[ChainId$2.ASTAR_ZKYOTO], genUrls$2("astar-zkyoto")), _extends$j({}, networks$3[ChainId$2.XR_SEPOLIA], genUrls$2("xr-sepolia")), _extends$j({}, networks$3[ChainId$2.TELOS], genUrls$2("telos")), _extends$j({}, networks$3[ChainId$2.HARDHAT], { +}), _extends$f({}, networks$1[ChainId.POLYGON_AMOY], genUrls("amoy")), _extends$f({}, networks$1[ChainId.BSC_TESTNET], genUrls("bsc-testnet")), _extends$f({}, networks$1[ChainId.ARBITRUM_SEPOLIA], genUrls("arbitrum-sepolia")), _extends$f({}, networks$1[ChainId.BASE], genUrls("base")), _extends$f({}, networks$1[ChainId.BASE_SEPOLIA], genUrls("base-sepolia")), _extends$f({}, networks$1[ChainId.HOMEVERSE], genUrls("homeverse")), _extends$f({}, networks$1[ChainId.HOMEVERSE_TESTNET], genUrls("homeverse-testnet")), _extends$f({}, networks$1[ChainId.XAI], genUrls("xai")), _extends$f({}, networks$1[ChainId.XAI_SEPOLIA], genUrls("xai-sepolia")), _extends$f({}, networks$1[ChainId.AVALANCHE_TESTNET], genUrls("avalanche-testnet")), _extends$f({}, networks$1[ChainId.ASTAR_ZKEVM], genUrls("astar-zkevm")), _extends$f({}, networks$1[ChainId.ASTAR_ZKYOTO], genUrls("astar-zkyoto")), _extends$f({}, networks$1[ChainId.XR_SEPOLIA], genUrls("xr-sepolia")), _extends$f({}, networks$1[ChainId.TELOS], genUrls("telos")), _extends$f({}, networks$1[ChainId.HARDHAT], { rpcUrl: "http://localhost:8545", relayer: { url: "http://localhost:3000", @@ -51535,7 +51535,7 @@ const allNetworks = validateAndSortNetworks$2([_extends$j({}, networks$3[ChainId url: "http://localhost:8545" } } -}), _extends$j({}, networks$3[ChainId$2.HARDHAT_2], { +}), _extends$f({}, networks$1[ChainId.HARDHAT_2], { rpcUrl: "http://localhost:9545", relayer: { url: "http://localhost:3000", @@ -51577,8 +51577,8 @@ const createJsonRpcMiddlewareStack = (middlewares, handler) => { }; let chain; chain = toMiddleware(middlewares[middlewares.length - 1])(handler); - for (let i2 = middlewares.length - 2; i2 >= 0; i2--) { - chain = toMiddleware(middlewares[i2])(chain); + for (let i = middlewares.length - 2; i >= 0; i--) { + chain = toMiddleware(middlewares[i])(chain); } return chain; }; @@ -51999,8 +51999,8 @@ class SingleflightMiddleware { } next(request, (error, response, chainId2) => { callback(error, response); - for (let i2 = 0; i2 < this.inflight[key2].length; i2++) { - const sub = this.inflight[key2][i2]; + for (let i = 0; i < this.inflight[key2].length; i++) { + const sub = this.inflight[key2][i]; if (error) { sub.callback(error, response); } else if (response) { @@ -52072,7 +52072,7 @@ class JsonRpcProvider2 extends JsonRpcProvider$1 { async getNetwork() { const chainId = this._chainId; if (chainId) { - const network2 = networks$3[chainId]; + const network2 = networks$1[chainId]; const name2 = (network2 == null ? void 0 : network2.name) || ""; const ensAddress = network2 == null ? void 0 : network2.ensAddress; return { @@ -52100,14 +52100,14 @@ const network$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro __proto__: null, AllowProvider, CachedProvider, - ChainId: ChainId$2, + ChainId, EagerProvider, JsonRpcExternalProvider, JsonRpcProvider: JsonRpcProvider2, JsonRpcRouter, JsonRpcSender, JsonRpcVersion, - NetworkType: NetworkType$2, + NetworkType, PublicProvider, SigningProvider, SingleflightMiddleware, @@ -52116,33 +52116,33 @@ const network$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro checkNetworkConfig, createJsonRpcMiddlewareStack, ensureUniqueNetworks, - ensureValidNetworks: ensureValidNetworks$2, + ensureValidNetworks, exceptionProviderMiddleware, findNetworkConfig, findSupportedNetwork, getChainId: getChainId$2, - indexerURL: indexerURL$2, + indexerURL, isJsonRpcHandler, isJsonRpcProvider, isNetworkConfig, - isValidNetworkConfig: isValidNetworkConfig$2, + isValidNetworkConfig, loggingProviderMiddleware, maybeChainId, networkProviderMiddleware, - networks: networks$3, + networks: networks$1, networksIndex, - nodesURL: nodesURL$2, - relayerURL: relayerURL$2, - sortNetworks: sortNetworks$2, - stringTemplate: stringTemplate$2, + nodesURL, + relayerURL, + sortNetworks, + stringTemplate, toChainIdNumber, updateNetworkConfig, - validateAndSortNetworks: validateAndSortNetworks$2 + validateAndSortNetworks }, Symbol.toStringTag, { value: "Module" })); -function _extends$i() { - _extends$i = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$e() { + _extends$e = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -52151,7 +52151,7 @@ function _extends$i() { } return target; }; - return _extends$i.apply(this, arguments); + return _extends$e.apply(this, arguments); } var config$2 = /* @__PURE__ */ Object.freeze({ __proto__: null @@ -52272,39 +52272,39 @@ function decodeSignature$1(signature2) { const bytes3 = arrayify(signature2); const threshold = bytes3[0] << 8 | bytes3[1]; const signers = []; - for (let i2 = 2; i2 < bytes3.length; ) { - const type = bytes3[i2++]; - const weight = bytes3[i2++]; + for (let i = 2; i < bytes3.length; ) { + const type = bytes3[i++]; + const weight = bytes3[i++]; switch (type) { case SignaturePartType$1.EOASignature: signers.push({ unrecovered: true, weight, - signature: hexlify(bytes3.slice(i2, i2 + 66)), + signature: hexlify(bytes3.slice(i, i + 66)), isDynamic: false }); - i2 += 66; + i += 66; break; case SignaturePartType$1.Address: signers.push({ weight, - address: getAddress$1(hexlify(bytes3.slice(i2, i2 + 20))) + address: getAddress$1(hexlify(bytes3.slice(i, i + 20))) }); - i2 += 20; + i += 20; break; case SignaturePartType$1.DynamicSignature: - const address = getAddress$1(hexlify(bytes3.slice(i2, i2 + 20))); - i2 += 20; - const size2 = bytes3[i2] << 8 | bytes3[i2 + 1]; - i2 += 2; + const address = getAddress$1(hexlify(bytes3.slice(i, i + 20))); + i += 20; + const size2 = bytes3[i] << 8 | bytes3[i + 1]; + i += 2; signers.push({ unrecovered: true, weight, - signature: hexlify(bytes3.slice(i2, i2 + size2)), + signature: hexlify(bytes3.slice(i, i + size2)), address, isDynamic: true }); - i2 += size2; + i += size2; break; default: throw new Error(`Unknown signature part type: ${type}`); @@ -52385,13 +52385,13 @@ function encodeSigners$1(config2, signatures, subdigests, _) { const bytes3 = arrayify(signature2.signature); weight = weight.add(s2.weight); if (signature2.isDynamic || bytes3.length !== 66) { - return _extends$i({}, s2, { + return _extends$e({}, s2, { isDynamic: true, signature: signature2.signature, address: s2.address }); } - return _extends$i({}, s2, { + return _extends$e({}, s2, { isDynamic: false, signature: signature2.signature }); @@ -53069,7 +53069,7 @@ function decodeChainedSignature(signature2) { throw new Error(`Expected first link of chained signature to be a simple signature (not chained)`); } const suffix = chain.slice(1); - return _extends$i({}, main2, { + return _extends$e({}, main2, { suffix }); } @@ -53089,7 +53089,7 @@ async function recoverSignature(signature2, payload, provider2) { version: 2, type: signature2.type, subdigest, - config: _extends$i({ + config: _extends$e({ version: 2 }, signature2.decoded, { tree @@ -53101,20 +53101,20 @@ async function recoverSignature(signature2, payload, provider2) { } const result = []; let mutatedPayload = signedPayload; - for (const sig of [_extends$i({}, signature2, { + for (const sig of [_extends$e({}, signature2, { suffix: void 0 }), ...signature2.suffix]) { const recovered = await recoverSignature(sig, mutatedPayload, provider2); result.unshift(recovered); const nextMessage = setImageHashStruct(imageHash(deepestConfigOfSignature(recovered))); - mutatedPayload = _extends$i({}, mutatedPayload, { + mutatedPayload = _extends$e({}, mutatedPayload, { message: nextMessage, digest: keccak256$2(nextMessage) }); } const main2 = result[0]; const suffix = result.slice(1); - return _extends$i({}, main2, { + return _extends$e({}, main2, { suffix }); } @@ -53227,7 +53227,7 @@ function subdigestsOfDecoded(utopology) { async function trimSignature(signature2) { const decoded = typeof signature2 === "string" ? decodeSignature(signature2) : signature2; if (isUnrecoveredChainedSignature(decoded)) { - const _trimmed = await Promise.all([trimSignature(_extends$i({}, decoded, { + const _trimmed = await Promise.all([trimSignature(_extends$e({}, decoded, { suffix: void 0 })), ...decoded.suffix.map((s2) => trimSignature(s2))]); return encodeChain(_trimmed[0], _trimmed.slice(1)); @@ -53235,8 +53235,8 @@ async function trimSignature(signature2) { const { trimmed } = await trimUnrecoveredTree(decoded.decoded.tree); - return encodeSignature(_extends$i({}, decoded, { - decoded: _extends$i({}, decoded.decoded, { + return encodeSignature(_extends$e({}, decoded, { + decoded: _extends$e({}, decoded.decoded, { tree: trimmed }) })); @@ -53291,7 +53291,7 @@ async function trimUnrecoveredTree(tree, trimStaticDigest = true) { if (isNodeLeaf(tree) && isEncodedSignerLeaf(tree.nodeHash)) { return { weight: 0, - trimmed: _extends$i({}, decodeSignerLeaf(tree.nodeHash)) + trimmed: _extends$e({}, decodeSignerLeaf(tree.nodeHash)) }; } if (isUnrecoveredSignatureLeaf(tree) || isSignerLeaf(tree) && tree.signature !== void 0) { @@ -53571,13 +53571,13 @@ function merkleTopologyBuilder(members) { } const leaves = membersAsTopologies(members, merkleTopologyBuilder); for (let s2 = leaves.length; s2 > 1; s2 = s2 / 2) { - for (let i2 = 0; i2 < s2 / 2; i2++) { - const j1 = i2 * 2; + for (let i = 0; i < s2 / 2; i++) { + const j1 = i * 2; const j2 = j1 + 1; if (j2 >= s2) { - leaves[i2] = leaves[j1]; + leaves[i] = leaves[j1]; } else { - leaves[i2] = { + leaves[i] = { left: leaves[j1], right: leaves[j2] }; @@ -53652,7 +53652,7 @@ const ConfigCoder = { }, fromSimple: (config2) => { var _config$subdigests; - return toWalletConfig(_extends$i({}, config2, { + return toWalletConfig(_extends$e({}, config2, { members: [...config2.signers, ...((_config$subdigests = config2.subdigests) != null ? _config$subdigests : []).map((subdigest) => ({ subdigest }))] @@ -53898,9 +53898,9 @@ async function isValidCounterfactual(wallet, digest9, signature2, chainId, provi } function isValidVersionedContext(contexts) { const versions = Object.keys(contexts).length; - for (let i2 = 1; i2 <= versions; i2++) { - const context2 = contexts[i2]; - if (!context2 || context2.version !== i2) { + for (let i = 1; i <= versions; i++) { + const context2 = contexts[i]; + if (!context2 || context2.version !== i) { return false; } } @@ -53931,7 +53931,7 @@ const MetaTransactionsType = `tuple( bytes data )[]`; function intendTransactionBundle(bundle, wallet, chainId, id2) { - return _extends$i({}, bundle, { + return _extends$e({}, bundle, { chainId, intent: { id: id2, @@ -54094,13 +54094,13 @@ const unwind = (wallet, transactions2) => { if (tx.to === wallet && hexlify(txData.slice(0, 4)) === selfExecuteSelector) { const data = txData.slice(4); const decoded = defaultAbiCoder.decode([selfExecuteAbi], data)[0]; - unwound.push(...unwind(tx.to, decoded.map((d2) => _extends$i({}, d2, { + unwound.push(...unwind(tx.to, decoded.map((d2) => _extends$e({}, d2, { to: d2.target })))); } else { try { const innerTransactions = walletInterface.decodeFunctionData("execute", txData)[0]; - const unwoundTransactions = unwind(wallet, innerTransactions.map((tx2) => _extends$i({}, tx2, { + const unwoundTransactions = unwind(wallet, innerTransactions.map((tx2) => _extends$e({}, tx2, { to: tx2.target }))); unwound.push(...unwoundTransactions); @@ -54258,9 +54258,9 @@ const core$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper v2 }, Symbol.toStringTag, { value: "Module" })); function counterfactualVersion(address, firstImageHash, versions) { - for (let i2 = 0; i2 < versions.length; i2++) { - if (index$1$2.context.addressOf(versions[i2], firstImageHash) === address) { - return versions[i2].version; + for (let i = 0; i < versions.length; i++) { + if (index$1$2.context.addressOf(versions[i], firstImageHash) === address) { + return versions[i].version; } } throw new Error("Could not find version for counterfactual address"); @@ -54341,10 +54341,10 @@ var index$6 = /* @__PURE__ */ Object.freeze({ MIGRATION_NONCE_SPACE, v1v2 }); -function _extends$h() { - _extends$h = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$d() { + _extends$d = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -54353,7 +54353,7 @@ function _extends$h() { } return target; }; - return _extends$h.apply(this, arguments); + return _extends$d.apply(this, arguments); } function validateMigrations(migrations) { for (const [version2, migration2] of Object.entries(migrations)) { @@ -54392,7 +54392,7 @@ class Migrator { let fversion = fromVersion; const versions = Object.values(this.contexts); const migs = []; - for (let i2 = 1; i2 < versions.length; i2++) { + for (let i = 1; i < versions.length; i++) { const mig = await this.tracker.getMigration(address, fih, fversion, chainId); if (!mig) return { @@ -54427,7 +54427,7 @@ class Migrator { } const unsignedMigration = migration2.buildTransaction(address, this.contexts, nextConfig); const signedBundle = await wallet.signTransactionBundle(unsignedMigration.tx); - return _extends$h({}, unsignedMigration, { + return _extends$d({}, unsignedMigration, { tx: signedBundle }); } @@ -54450,10 +54450,10 @@ const migration$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP migrator, version: version$5 }, Symbol.toStringTag, { value: "Module" })); -function _extends$g() { - _extends$g = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$c() { + _extends$c = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -54462,7 +54462,7 @@ function _extends$g() { } return target; }; - return _extends$g.apply(this, arguments); + return _extends$c.apply(this, arguments); } const DEFAULT_GAS_LIMIT = BigNumber.from(8e5); const ProviderRelayerDefaults = { @@ -54479,7 +54479,7 @@ class ProviderRelayer { this.waitPollRate = void 0; this.deltaBlocksLog = void 0; this.fromBlockLog = void 0; - const opts = _extends$g({}, ProviderRelayerDefaults, options); + const opts = _extends$c({}, ProviderRelayerDefaults, options); this.provider = opts.provider; this.waitPollRate = opts.waitPollRate; this.deltaBlocksLog = opts.deltaBlocksLog; @@ -54578,7 +54578,7 @@ class ProviderRelayer { const found = txs.find((tx) => tx.logs.find((l2) => l2.topics.length === 0 && l2.data.replace("0x", "") === normalMetaTxnId || l2.topics.length === 1 && // TxFailed event topic l2.topics[0] === "0x3dbd1590ea96dd3253a91f24e64e3a502e1225d602a5731357bc12643070ccd7" && l2.data.length >= 64 && l2.data.replace("0x", "").startsWith(normalMetaTxnId))); if (found) { - return _extends$g({ + return _extends$c({ receipt: found }, await retry(() => _this2.provider.getTransaction(found.transactionHash), `unable to get transaction ${found.transactionHash}`)); } @@ -54605,7 +54605,7 @@ class LocalRelayer extends ProviderRelayer { constructor(options) { super(Signer$1.isSigner(options) ? { provider: options.provider - } : _extends$g({}, options, { + } : _extends$c({}, options, { provider: options.signer.provider })); this.signer = void 0; @@ -54638,7 +54638,7 @@ class LocalRelayer extends ProviderRelayer { logger.warn(`LocalRelayer doesn't accept fee quotes`); } const data = index$1$2.transaction.encodeBundleExecData(signedTxs); - const responsePromise = this.signer.sendTransaction(_extends$g({ + const responsePromise = this.signer.sendTransaction(_extends$c({ to: signedTxs.entrypoint, data }, this.txnOptions, { @@ -55106,7 +55106,7 @@ class Relayer { const createHTTPRequest$6 = (body = {}, headers = {}, signal = null) => { return { method: "POST", - headers: _extends$g({}, headers, { + headers: _extends$c({}, headers, { "Content-Type": "application/json" }), body: JSON.stringify(body || {}), @@ -55368,7 +55368,7 @@ class RpcRelayer { if (projectAccessKey2 && projectAccessKey2.length > 0) { headers["X-Access-Key"] = projectAccessKey2; } - init3.headers = _extends$g({}, init3.headers, headers); + init3.headers = _extends$c({}, init3.headers, headers); return fetch$4(input2, init3); }; this.service = new Relayer(options.url, this._fetch); @@ -55737,7 +55737,7 @@ class Orchestrator { const addresses = await Promise.all(_this.signers.map(async function(s2) { return s2.getAddress(); })); - signers = _this.signers.filter((_, i2) => candidates.includes(addresses[i2])); + signers = _this.signers.filter((_, i) => candidates.includes(addresses[i])); } const accepted = await Promise.allSettled(signers.map(async function(s2) { const saddr = await s2.getAddress(); @@ -55762,9 +55762,9 @@ class Orchestrator { }) }; })); - for (let i2 = 0; i2 < accepted.length; i2++) { - const signer2 = _this.signers[i2]; - const promise = accepted[i2]; + for (let i = 0; i < accepted.length; i++) { + const signer2 = _this.signers[i]; + const promise = accepted[i]; if (promise.status === "rejected") { const address = await signer2.getAddress(); console.warn(`signer ${address} rejected the request: ${promise.reason}`); @@ -55785,10 +55785,10 @@ const signhub$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro isSignerStatusPending, signers: index$5 }, Symbol.toStringTag, { value: "Module" })); -function _extends$f() { - _extends$f = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$b() { + _extends$b = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -55797,7 +55797,7 @@ function _extends$f() { } return target; }; - return _extends$f.apply(this, arguments); + return _extends$b.apply(this, arguments); } async function resolveArrayProperties$1(object) { if (Array.isArray(object)) { @@ -55847,7 +55847,7 @@ class Wallet2 extends Signer$1 { } static newWallet(options) { const address = index$1$2.context.addressOf(options.context, options.coders.config.imageHashOf(options.config)); - return new Wallet2(_extends$f({}, options, { + return new Wallet2(_extends$b({}, options, { address })); } @@ -55918,7 +55918,7 @@ class Wallet2 extends Signer$1 { } if (!this.relayer) throw new Error("Wallet deploy requires a relayer"); - return this.relayer.relay(_extends$f({}, deployTx, { + return this.relayer.relay(_extends$b({}, deployTx, { chainId: this.chainId, intent: { id: hexlify(randomBytes$1(32)), @@ -55959,7 +55959,7 @@ class Wallet2 extends Signer$1 { if (this.coders.config.hasSubdigest(this.config, subdigest)) { return this.coders.signature.encodeSigners(this.config, /* @__PURE__ */ new Map(), [subdigest], this.chainId).encoded; } - const childMetadata = _extends$f({}, metadata2, { + const childMetadata = _extends$b({}, metadata2, { // Keep other metadata fields digest: digest9, chainId: this.chainId, @@ -55973,7 +55973,7 @@ class Wallet2 extends Signer$1 { metadata: childMetadata, callback: (status, onNewMetadata) => { const parts2 = statusToSignatureParts(status); - const newMetadata = _extends$f({}, childMetadata, { + const newMetadata = _extends$b({}, childMetadata, { parts: parts2 }); onNewMetadata(newMetadata); @@ -56031,7 +56031,7 @@ class Wallet2 extends Signer$1 { } const defaultedNonce = await this.fetchNonceOrSpace(nonce); const digest9 = index$1$2.transaction.digestOfTransactions(defaultedNonce, transactions2); - const meta = _extends$f({ + const meta = _extends$b({ digest: digest9, transactions: transactions2 }, metadata2); @@ -56082,9 +56082,9 @@ class Wallet2 extends Signer$1 { if (!relayer2) throw new Error("Wallet fillGasLimits requires a relayer"); const simulations = await relayer2.simulate(this.address, ...transactions2); - return transactions2.map((tx, i2) => { - const gasLimit = tx.gasLimit ? BigNumber.from(tx.gasLimit).toNumber() : simulations[i2].gasLimit; - return _extends$f({}, tx, simulations[i2], { + return transactions2.map((tx, i) => { + const gasLimit = tx.gasLimit ? BigNumber.from(tx.gasLimit).toNumber() : simulations[i].gasLimit; + return _extends$b({}, tx, simulations[i], { gasLimit }); }); @@ -56098,10 +56098,10 @@ class Wallet2 extends Signer$1 { throw new Error("Method not implemented."); } } -function _extends$e() { - _extends$e = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$a() { + _extends$a = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -56110,7 +56110,7 @@ function _extends$e() { } return target; }; - return _extends$e.apply(this, arguments); + return _extends$a.apply(this, arguments); } function isPromise(value) { return !!value && typeof value.then === "function"; @@ -56372,7 +56372,7 @@ class Account { throw new Error(`Relayer not found for chainId ${chainId}`); if (isRelayer(found.relayer)) return found.relayer; - return new RpcRelayer(_extends$e({}, found.relayer, this.projectAccessKey ? { + return new RpcRelayer(_extends$a({}, found.relayer, this.projectAccessKey ? { projectAccessKey: this.projectAccessKey } : { jwtAuth: this.jwt @@ -56434,9 +56434,9 @@ class Account { if (!implementation) throw new Error(`Implementation not found for wallet ${_this.address}`); const versions = Object.values(_this.contexts); - for (let i2 = 0; i2 < versions.length; i2++) { - if (versions[i2].mainModule === implementation || versions[i2].mainModuleUpgradable === implementation) { - return versions[i2].version; + for (let i = 0; i < versions.length; i++) { + if (versions[i].mainModule === implementation || versions[i].mainModuleUpgradable === implementation) { + return versions[i].version; } } throw new Error(`Version not found for implementation ${implementation}`); @@ -56491,7 +56491,7 @@ class Account { const counterfactualImageHash = await counterfactualImageHashPromise; const checkpoint = index$7.coderFor(lastVersion).config.checkpointOf(config2); return { - original: _extends$e({}, counterfactualImageHash, { + original: _extends$a({}, counterfactualImageHash, { version: await counterFactualVersionPromise }), onChain: { @@ -56669,7 +56669,7 @@ class Account { } async editConfig(changes) { const currentConfig = await this.status(0).then((s2) => s2.config); - const newConfig = this.coders.config.editConfig(currentConfig, _extends$e({}, changes, { + const newConfig = this.coders.config.editConfig(currentConfig, _extends$a({}, changes, { checkpoint: this.coders.config.checkpointOf(currentConfig).add(1) })); return this.updateConfig(newConfig); @@ -56744,7 +56744,7 @@ class Account { } async doBootstrap(chainId, feeQuote, prestatus) { const bootstrapTxs = await this.bootstrapTransactions(chainId, prestatus); - return this.relayer(chainId).relay(_extends$e({}, bootstrapTxs, { + return this.relayer(chainId).relay(_extends$a({}, bootstrapTxs, { chainId }), feeQuote); } @@ -56772,7 +56772,7 @@ class Account { space: options.nonceSpace } : void 0; const signed2 = await wallet.signTransactions(txs, nonceOptions, metadata2); - return _extends$e({}, signed2, { + return _extends$a({}, signed2, { signature: await this.decorateSignature(signed2.signature, status) }); } @@ -56874,7 +56874,7 @@ class Account { const decoratedBundle = await this.decorateTransactions(signedBundle, wstatus); const data = index$1$2.transaction.encodeBundleExecData(decoratedBundle); const res = await this.relayer(chainId).getFeeOptionsRaw(decoratedBundle.entrypoint, data, options); - return _extends$e({}, res, { + return _extends$a({}, res, { decorated: decoratedBundle }); } @@ -56950,7 +56950,7 @@ class Account { } const coder = index$7.genericCoderFor(latestConfig.version); const signers = coder.config.signersOf(latestConfig); - return signers.map((signer2) => _extends$e({}, signer2, { + return signers.map((signer2) => _extends$a({}, signer2, { network: chainId })); } catch (error) { @@ -57005,10 +57005,10 @@ const account$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro Account, isAccount }, Symbol.toStringTag, { value: "Module" })); -function _extends$d() { - _extends$d = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$9() { + _extends$9 = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -57017,7 +57017,7 @@ function _extends$d() { } return target; }; - return _extends$d.apply(this, arguments); + return _extends$9.apply(this, arguments); } const WebRPCVersion$1 = "v1"; const WebRPCSchemaVersion$1 = "v0.4.0"; @@ -57486,13 +57486,13 @@ const sseResponse = async (res, options, retryFetch) => { return; } let lines = buffer2.split("\n"); - for (let i2 = 0; i2 < lines.length - 1; i2++) { - if (lines[i2].length == 0) { + for (let i = 0; i < lines.length - 1; i++) { + if (lines[i].length == 0) { continue; } let data; try { - data = JSON.parse(lines[i2]); + data = JSON.parse(lines[i]); if (data.hasOwnProperty("webrpcError")) { const error = data.webrpcError; const code2 = typeof error.code === "number" ? error.code : 0; @@ -57531,7 +57531,7 @@ const sseResponse = async (res, options, retryFetch) => { const createHTTPRequest$5 = (body = {}, headers = {}, signal = null) => { return { method: "POST", - headers: _extends$d({}, headers, { + headers: _extends$9({}, headers, { "Content-Type": "application/json" }), body: JSON.stringify(body || {}), @@ -57802,7 +57802,7 @@ class SequenceIndexer extends Indexer { if (projectAccessKey3 && projectAccessKey3.length > 0) { headers["X-Access-Key"] = projectAccessKey3; } - init3.headers = _extends$d({}, init3.headers, headers); + init3.headers = _extends$9({}, init3.headers, headers); return fetch$3(input2, init3); }; this.fetch = this._fetch; @@ -57851,10 +57851,10 @@ const indexer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro WebrpcStreamLostError: WebrpcStreamLostError$5, errors: errors$1 }, Symbol.toStringTag, { value: "Module" })); -function _extends$c() { - _extends$c = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$8() { + _extends$8 = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -57863,7 +57863,7 @@ function _extends$c() { } return target; }; - return _extends$c.apply(this, arguments); + return _extends$8.apply(this, arguments); } const WebRPCVersion = "v1"; const WebRPCSchemaVersion = "v0.4.0"; @@ -58544,7 +58544,7 @@ class Collections { const createHTTPRequest$4 = (body = {}, headers = {}, signal = null) => { return { method: "POST", - headers: _extends$c({}, headers, { + headers: _extends$8({}, headers, { "Content-Type": "application/json" }), body: JSON.stringify(body || {}), @@ -58799,7 +58799,7 @@ class SequenceMetadata extends Metadata { if (projectAccessKey3 && projectAccessKey3.length > 0) { headers["X-Access-Key"] = projectAccessKey3; } - init3.headers = _extends$c({}, init3.headers, headers); + init3.headers = _extends$8({}, init3.headers, headers); return fetch$2(input2, init3); }; this.fetch = this._fetch; @@ -58815,7 +58815,7 @@ class SequenceCollections extends Collections { if (jwtAuth2 && jwtAuth2.length > 0) { headers["Authorization"] = `BEARER ${jwtAuth2}`; } - init3.headers = _extends$c({}, init3.headers, headers); + init3.headers = _extends$8({}, init3.headers, headers); return fetch$2(input2, init3); }; this.fetch = this._fetch; @@ -59255,10 +59255,10 @@ var debug$1 = /* @__PURE__ */ Object.freeze({ __proto__: null, DebugConfigTracker }); -function _extends$b() { - _extends$b = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$7() { + _extends$7 = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -59267,7 +59267,7 @@ function _extends$b() { } return target; }; - return _extends$b.apply(this, arguments); + return _extends$7.apply(this, arguments); } class MemoryTrackerStore { constructor() { @@ -59672,7 +59672,7 @@ class LocalConfigTracker { const subdigestsOfSigner = await Promise.all(signers.map((s2) => _this.store.loadSubdigestsOfSigner(s2))); const subdigests = [...new Set(subdigestsOfSigner.flat())]; const payloads = await Promise.all([...new Set(subdigests)].map(async function(s2) { - return _extends$b({}, await _this.payloadOfSubdigest({ + return _extends$7({}, await _this.payloadOfSubdigest({ subdigest: s2 }), { subdigest: s2 @@ -60068,7 +60068,7 @@ class Sessions { const createHTTPRequest$3 = (body = {}, headers = {}, signal = null) => { return { method: "POST", - headers: _extends$b({}, headers, { + headers: _extends$7({}, headers, { "Content-Type": "application/json" }), body: JSON.stringify(body || {}), @@ -60475,17 +60475,17 @@ function encodeV2ConfigTree(tree) { node: tree.nodeHash }; } else { - return _extends$b({}, tree); + return _extends$7({}, tree); } } function decodeConfig(version2, config2) { switch (version2) { case 1: - return _extends$b({}, config2, { + return _extends$7({}, config2, { version: version2 }); case 2: - return _extends$b({}, config2, { + return _extends$7({}, config2, { version: version2, tree: decodeV2ConfigTree(config2.tree) }); @@ -60496,7 +60496,7 @@ function decodeConfig(version2, config2) { function decodeV2ConfigTree(tree) { switch (typeof tree) { case "object": - const tree_ = _extends$b({}, tree); + const tree_ = _extends$7({}, tree); if (tree_.left !== void 0) { tree_.left = decodeV2ConfigTree(tree_.left); } @@ -60566,10 +60566,10 @@ class MultipleTracker { this.trackers = trackers; } async configOfImageHash(args) { - const requests = this.trackers.map(async function(t2, i2) { + const requests = this.trackers.map(async function(t2, i) { return { res: await t2.configOfImageHash(args), - i: i2 + i }; }); const result1 = await raceUntil(requests, void 0, (val) => { @@ -60600,8 +60600,8 @@ class MultipleTracker { return result2; } async saveWalletConfig(args) { - await Promise.all(this.trackers.map((t2, i2) => { - if (i2 === args.skipTracker) + await Promise.all(this.trackers.map((t2, i) => { + if (i === args.skipTracker) return; return t2.saveWalletConfig(args); })); @@ -60623,8 +60623,8 @@ class MultipleTracker { return imageHash2; } async saveCounterfactualWallet(args) { - await Promise.all(this.trackers.map((t2, i2) => { - if (i2 === args.skipTracker) + await Promise.all(this.trackers.map((t2, i) => { + if (i === args.skipTracker) return; return t2.saveCounterfactualWallet(args); })); @@ -60996,12 +60996,12 @@ class Services { if (!url) throw Error("No sequence api url"); let jwtAuth; - for (let i2 = 1; ; i2++) { + for (let i = 1; ; i++) { try { jwtAuth = (await _this.getJWT(true)).token; break; } catch (error) { - if (i2 === maxTries) { + if (i === maxTries) { console.error(`couldn't authenticate after ${maxTries} attempts`, error); throw error; } @@ -61224,10 +61224,10 @@ class AuthError extends Error { } } const ErrAccountIsRequired = new AuthError("auth error: account address is empty"); -function _extends$a() { - _extends$a = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$6() { + _extends$6 = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -61236,7 +61236,7 @@ function _extends$a() { } return target; }; - return _extends$a.apply(this, arguments); + return _extends$6.apply(this, arguments); } function isSessionDumpV1(obj) { return obj.config && obj.metadata && obj.version === void 0; @@ -61263,7 +61263,7 @@ class Session { address: this.account.address }; if (this.services) { - return _extends$a({}, base2, await this.services.dump()); + return _extends$6({}, base2, await this.services.dump()); } return base2; } @@ -61309,7 +61309,7 @@ class Session { } return void 0; }; - return Session.open(_extends$a({}, args, { + return Session.open(_extends$6({}, args, { orchestrator, referenceSigner, threshold, @@ -61336,8 +61336,8 @@ class Session { networks: networks2, tracker: tracker2, services - } = _extends$a({}, SessionSettingsDefault, settings); - const referenceChainId = (_findNetworkConfig$ch = (_findNetworkConfig = findNetworkConfig(networks2, (_settings$services$se = settings == null || (_settings$services = settings.services) == null ? void 0 : _settings$services.sequenceApiChainId) != null ? _settings$services$se : ChainId$2.MAINNET)) == null ? void 0 : _findNetworkConfig.chainId) != null ? _findNetworkConfig$ch : (_networks$ = networks2[0]) == null ? void 0 : _networks$.chainId; + } = _extends$6({}, SessionSettingsDefault, settings); + const referenceChainId = (_findNetworkConfig$ch = (_findNetworkConfig = findNetworkConfig(networks2, (_settings$services$se = settings == null || (_settings$services = settings.services) == null ? void 0 : _settings$services.sequenceApiChainId) != null ? _settings$services$se : ChainId.MAINNET)) == null ? void 0 : _findNetworkConfig.chainId) != null ? _findNetworkConfig$ch : (_networks$ = networks2[0]) == null ? void 0 : _networks$.chainId; if (!referenceChainId) throw Error("No reference chain found"); const foundWallets = await tracker2.walletsOfSigner({ @@ -61453,11 +61453,11 @@ class Session { networks: networks2, tracker: tracker2, services - } = _extends$a({}, SessionSettingsDefault, settings); + } = _extends$6({}, SessionSettingsDefault, settings); let account2; if (isSessionDumpV1(dump)) { var _dump$jwt$expiration, _dump$jwt, _dump$jwt2; - const oldAddress = dump.config.address || index$1$2.context.addressOf(contexts[1], v1.config.ConfigCoder.imageHashOf(_extends$a({}, dump.config, { + const oldAddress = dump.config.address || index$1$2.context.addressOf(contexts[1], v1.config.ConfigCoder.imageHashOf(_extends$6({}, dump.config, { version: 1 }))); const jwtExpired = ((_dump$jwt$expiration = (_dump$jwt = dump.jwt) == null ? void 0 : _dump$jwt.expiration) != null ? _dump$jwt$expiration : 0) < Math.floor(Date.now() / 1e3); @@ -61527,10 +61527,10 @@ const auth$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper isSessionDumpV2, signAuthorization }, Symbol.toStringTag, { value: "Module" })); -function _extends$9() { - _extends$9 = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$5() { + _extends$5 = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -61539,7 +61539,7 @@ function _extends$9() { } return target; }; - return _extends$9.apply(this, arguments); + return _extends$5.apply(this, arguments); } class Guard { constructor(hostname, fetch2) { @@ -61624,6 +61624,19 @@ class Guard { }); }); }; + this.patch = (args, headers, signal) => { + return this.fetch(this.url("Patch"), createHTTPRequest$2(args, headers, signal)).then((res) => { + return buildResponse$2(res).then((_data2) => { + return { + txs: _data2.txs + }; + }); + }, (error) => { + throw WebrpcRequestFailedError$2.new({ + cause: `fetch(): ${error.message || ""}` + }); + }); + }; this.authMethods = (args, headers, signal) => { return this.fetch(this.url("AuthMethods"), createHTTPRequest$2(args, headers, signal)).then((res) => { return buildResponse$2(res).then((_data2) => { @@ -61744,7 +61757,7 @@ class Guard { const createHTTPRequest$2 = (body = {}, headers = {}, signal = null) => { return { method: "POST", - headers: _extends$9({}, headers, { + headers: _extends$5({}, headers, { "Content-Type": "application/json" }), body: JSON.stringify(body || {}), @@ -61992,7 +62005,7 @@ class GuardSigner { } }); } - return _extends$9({}, response, { + return _extends$5({}, response, { methods: response.methods.map(parseAuthMethod) }); } @@ -62192,16 +62205,17 @@ function toUTCString(date) { const guard$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, AuthMethod, + Guard, GuardSigner, getAuthUpdateProofTypedData, getOwnershipProofTypedData, isSignedOwnershipProof, signOwnershipProof }, Symbol.toStringTag, { value: "Module" })); -function _extends$8() { - _extends$8 = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$4() { + _extends$4 = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -62210,7 +62224,7 @@ function _extends$8() { } return target; }; - return _extends$8.apply(this, arguments); + return _extends$4.apply(this, arguments); } let JsonRpcMethod = /* @__PURE__ */ function(JsonRpcMethod2) { JsonRpcMethod2["ethCall"] = "eth_call"; @@ -62227,8 +62241,8 @@ async function safeSolve(promise, def) { } } function partition$1(array, callback) { - return array.reduce(function(result, element, i2) { - callback(element, i2) ? result[0].push(element) : result[1].push(element); + return array.reduce(function(result, element, i) { + callback(element, i) ? result[0].push(element) : result[1].push(element); return result; }, [[], []]); } @@ -62391,7 +62405,7 @@ class Multicall { return null; } }); - var [items, discartItems] = partition$1(items, (_, i2) => callParams[i2] !== void 0); + var [items, discartItems] = partition$1(items, (_, i) => callParams[i] !== void 0); callParams = callParams.filter((c2) => c2); if (discartItems.length !== 0) { if (_this.options.verbose) @@ -62483,7 +62497,7 @@ class Multicall { } }); }; - this.options = options ? _extends$8({}, Multicall.DefaultOptions, options) : Multicall.DefaultOptions; + this.options = options ? _extends$4({}, Multicall.DefaultOptions, options) : Multicall.DefaultOptions; if (this.options.batchSize <= 0) throw new Error(`Invalid batch size of ${this.options.batchSize}`); } @@ -62501,7 +62515,7 @@ class Multicall { return cand !== void 0 && cand.batchSize !== void 0 && cand.timeWindow !== void 0 && cand.contract !== void 0; } } -Multicall.DefaultOptions = _extends$8({}, DefaultMulticallOptions); +Multicall.DefaultOptions = _extends$4({}, DefaultMulticallOptions); const ProxyMethods = ["getNetwork", "getBlockNumber", "getGasPrice", "getTransactionCount", "getStorageAt", "sendTransaction", "estimateGas", "getBlock", "getTransaction", "getTransactionReceipt", "getLogs", "emit", "litenerCount", "addListener", "removeListener", "waitForTransaction", "detectNetwork", "getBlockWithTransactions"]; class MulticallProvider extends BaseProvider { constructor(provider2, multicall2) { @@ -62703,9 +62717,9 @@ var eventemitter2 = { exports: {} }; var key2; var len = keys.length; var valuesCount = 0; - for (var i2 = 0; i2 < len; i2++) { - key2 = keys[i2]; - obj[key2] = i2 < valuesCount ? values[i2] : undefined$1; + for (var i = 0; i < len; i++) { + key2 = keys[i]; + obj[key2] = i < valuesCount ? values[i] : undefined$1; } return obj; } @@ -62802,7 +62816,7 @@ var eventemitter2 = { exports: {} }; var events; var off = this._off; var target = this._target; - var i2; + var i; if (event && typeof event !== "string") { throw TypeError("event must be a string"); } @@ -62827,9 +62841,9 @@ var eventemitter2 = { exports: {} }; } } else { events = ownKeys2(listeners); - i2 = events.length; - while (i2-- > 0) { - event = events[i2]; + i = events.length; + while (i-- > 0) { + event = events[i]; off.call(target, event, listeners[event]); } this._listeners = {}; @@ -62852,8 +62866,8 @@ var eventemitter2 = { exports: {} }; function reject(reason) { throw Error('Invalid "' + option + '" option value' + (reason ? ". Reason: " + reason : "")); } - for (var i2 = 0; i2 < length; i2++) { - option = keys[i2]; + for (var i = 0; i < length; i++) { + option = keys[i]; if (!hasOwnProperty.call(schema, option)) { throw Error('Unknown "' + option + '" option'); } @@ -62894,9 +62908,9 @@ var eventemitter2 = { exports: {} }; } return function(v3, reject) { var kind = typeof v3; - var i2 = len; - while (i2-- > 0) { - if (kind === types2[i2]) + var i = len; + while (i-- > 0) { + if (kind === types2[i]) return v3; } reject(message); @@ -62973,8 +62987,8 @@ var eventemitter2 = { exports: {} }; return; } var length = callbacks.length; - for (var i2 = 1; i2 < length; i2++) { - callbacks[i2](reason); + for (var i = 1; i < length; i++) { + callbacks[i](reason); } callbacks[0](reason); callbacks = null; @@ -62988,17 +63002,17 @@ var eventemitter2 = { exports: {} }; return -1; } var len = observers2.length; - for (var i2 = 0; i2 < len; i2++) { - if (observers2[i2]._target === observer) - return i2; + for (var i = 0; i < len; i++) { + if (observers2[i]._target === observer) + return i; } return -1; } - function searchListenerTree(handlers, type, tree, i2, typeLength) { + function searchListenerTree(handlers, type, tree, i, typeLength) { if (!tree) { return null; } - if (i2 === 0) { + if (i === 0) { var kind = typeof type; if (kind === "string") { var ns, n2, l2 = 0, j2 = 0, delimiter = this.delimiter, dl2 = delimiter.length; @@ -63022,8 +63036,8 @@ var eventemitter2 = { exports: {} }; typeLength = 1; } } - var listeners = null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i2], nextType = type[i2 + 1], branches, _listeners; - if (i2 === typeLength) { + var listeners = null, branch, xTree, xxTree, isolatedBranch, endReached, currentType = type[i], nextType = type[i + 1], branches, _listeners; + if (i === typeLength) { if (tree._listeners) { if (typeof tree._listeners === "function") { handlers && handlers.push(tree._listeners); @@ -63040,7 +63054,7 @@ var eventemitter2 = { exports: {} }; while (n2-- > 0) { branch = branches[n2]; if (branch !== "_listeners") { - _listeners = searchListenerTree(handlers, type, tree[branch], i2 + 1, typeLength); + _listeners = searchListenerTree(handlers, type, tree[branch], i + 1, typeLength); if (_listeners) { if (listeners) { listeners.push.apply(listeners, _listeners); @@ -63052,7 +63066,7 @@ var eventemitter2 = { exports: {} }; } return listeners; } else if (currentType === "**") { - endReached = i2 + 1 === typeLength || i2 + 2 === typeLength && nextType === "*"; + endReached = i + 1 === typeLength || i + 2 === typeLength && nextType === "*"; if (endReached && tree._listeners) { listeners = searchListenerTree(handlers, type, tree, typeLength, typeLength); } @@ -63072,11 +63086,11 @@ var eventemitter2 = { exports: {} }; } } } - _listeners = searchListenerTree(handlers, type, tree[branch], i2, typeLength); + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); } else if (branch === nextType) { - _listeners = searchListenerTree(handlers, type, tree[branch], i2 + 2, typeLength); + _listeners = searchListenerTree(handlers, type, tree[branch], i + 2, typeLength); } else { - _listeners = searchListenerTree(handlers, type, tree[branch], i2, typeLength); + _listeners = searchListenerTree(handlers, type, tree[branch], i, typeLength); } if (_listeners) { if (listeners) { @@ -63089,16 +63103,16 @@ var eventemitter2 = { exports: {} }; } return listeners; } else if (tree[currentType]) { - listeners = searchListenerTree(handlers, type, tree[currentType], i2 + 1, typeLength); + listeners = searchListenerTree(handlers, type, tree[currentType], i + 1, typeLength); } } xTree = tree["*"]; if (xTree) { - searchListenerTree(handlers, type, xTree, i2 + 1, typeLength); + searchListenerTree(handlers, type, xTree, i + 1, typeLength); } xxTree = tree["**"]; if (xxTree) { - if (i2 < typeLength) { + if (i < typeLength) { if (xxTree._listeners) { searchListenerTree(handlers, type, xxTree, typeLength, typeLength); } @@ -63108,13 +63122,13 @@ var eventemitter2 = { exports: {} }; branch = branches[n2]; if (branch !== "_listeners") { if (branch === nextType) { - searchListenerTree(handlers, type, xxTree[branch], i2 + 2, typeLength); + searchListenerTree(handlers, type, xxTree[branch], i + 2, typeLength); } else if (branch === currentType) { - searchListenerTree(handlers, type, xxTree[branch], i2 + 1, typeLength); + searchListenerTree(handlers, type, xxTree[branch], i + 1, typeLength); } else { isolatedBranch = {}; isolatedBranch[branch] = xxTree[branch]; - searchListenerTree(handlers, type, { "**": isolatedBranch }, i2 + 1, typeLength); + searchListenerTree(handlers, type, { "**": isolatedBranch }, i + 1, typeLength); } } } @@ -63127,14 +63141,14 @@ var eventemitter2 = { exports: {} }; return listeners; } function growListenerTree(type, listener, prepend) { - var len = 0, j2 = 0, i2, delimiter = this.delimiter, dl2 = delimiter.length, ns; + var len = 0, j2 = 0, i, delimiter = this.delimiter, dl2 = delimiter.length, ns; if (typeof type === "string") { - if ((i2 = type.indexOf(delimiter)) !== -1) { + if ((i = type.indexOf(delimiter)) !== -1) { ns = new Array(5); do { - ns[len++] = type.slice(j2, i2); - j2 = i2 + dl2; - } while ((i2 = type.indexOf(delimiter, j2)) !== -1); + ns[len++] = type.slice(j2, i); + j2 = i + dl2; + } while ((i = type.indexOf(delimiter, j2)) !== -1); ns[len++] = type.slice(j2); } else { ns = [type]; @@ -63145,17 +63159,17 @@ var eventemitter2 = { exports: {} }; len = type.length; } if (len > 1) { - for (i2 = 0; i2 + 1 < len; i2++) { - if (ns[i2] === "**" && ns[i2 + 1] === "**") { + for (i = 0; i + 1 < len; i++) { + if (ns[i] === "**" && ns[i + 1] === "**") { return; } } } var tree = this.listenerTree, name2; - for (i2 = 0; i2 < len; i2++) { - name2 = ns[i2]; + for (i = 0; i < len; i++) { + name2 = ns[i]; tree = tree[name2] || (tree[name2] = {}); - if (i2 === len - 1) { + if (i === len - 1) { if (!tree._listeners) { tree._listeners = listener; } else { @@ -63179,12 +63193,12 @@ var eventemitter2 = { exports: {} }; } function collectTreeEvents(tree, events, root2, asArray) { var branches = ownKeys2(tree); - var i2 = branches.length; + var i = branches.length; var branch, branchName, path; var hasListeners = tree["_listeners"]; var isArrayPath; - while (i2-- > 0) { - branchName = branches[i2]; + while (i-- > 0) { + branchName = branches[i]; branch = tree[branchName]; if (branchName === "_listeners") { path = root2; @@ -63201,10 +63215,10 @@ var eventemitter2 = { exports: {} }; } function recursivelyGarbageCollect(root2) { var keys = ownKeys2(root2); - var i2 = keys.length; + var i = keys.length; var obj, key2, flag; - while (i2-- > 0) { - key2 = keys[i2]; + while (i-- > 0) { + key2 = keys[i]; obj = root2[key2]; if (obj) { flag = true; @@ -63304,8 +63318,8 @@ var eventemitter2 = { exports: {} }; var len = keys.length; var event; var isSingleReducer = typeof reducers === "function"; - for (var i2 = 0; i2 < len; i2++) { - event = keys[i2]; + for (var i = 0; i < len; i++) { + event = keys[i]; observer.subscribe( event, events2[event] || event, @@ -63321,14 +63335,14 @@ var eventemitter2 = { exports: {} }; if (!observers2) { return false; } - var i2 = observers2.length; + var i = observers2.length; var observer; var matched = false; if (target && typeof target !== "object") { throw TypeError("target should be an object"); } - while (i2-- > 0) { - observer = observers2[i2]; + while (i-- > 0) { + observer = observers2[i]; if (!target || observer._target === target) { observer.unsubscribe(event); matched = true; @@ -63384,7 +63398,7 @@ var eventemitter2 = { exports: {} }; } this._events || init3.call(this); var type = arguments[0], ns, wildcard = this.wildcard; - var args, l2, i2, j2, containsSymbol; + var args, l2, i, j2, containsSymbol; if (type === "newListener" && !this._newListener) { if (!this._events.newListener) { return false; @@ -63396,8 +63410,8 @@ var eventemitter2 = { exports: {} }; if (typeof type === "object") { l2 = type.length; if (symbolsSupported) { - for (i2 = 0; i2 < l2; i2++) { - if (typeof type[i2] === "symbol") { + for (i = 0; i < l2; i++) { + if (typeof type[i] === "symbol") { containsSymbol = true; break; } @@ -63413,20 +63427,20 @@ var eventemitter2 = { exports: {} }; var handler; if (this._all && this._all.length) { handler = this._all.slice(); - for (i2 = 0, l2 = handler.length; i2 < l2; i2++) { + for (i = 0, l2 = handler.length; i < l2; i++) { this.event = type; switch (al2) { case 1: - handler[i2].call(this, type); + handler[i].call(this, type); break; case 2: - handler[i2].call(this, type, arguments[1]); + handler[i].call(this, type, arguments[1]); break; case 3: - handler[i2].call(this, type, arguments[1], arguments[2]); + handler[i].call(this, type, arguments[1], arguments[2]); break; default: - handler[i2].apply(this, arguments); + handler[i].apply(this, arguments); } } } @@ -63464,20 +63478,20 @@ var eventemitter2 = { exports: {} }; for (j2 = 1; j2 < al2; j2++) args[j2 - 1] = arguments[j2]; } - for (i2 = 0, l2 = handler.length; i2 < l2; i2++) { + for (i = 0, l2 = handler.length; i < l2; i++) { this.event = type; switch (al2) { case 1: - handler[i2].call(this); + handler[i].call(this); break; case 2: - handler[i2].call(this, arguments[1]); + handler[i].call(this, arguments[1]); break; case 3: - handler[i2].call(this, arguments[1], arguments[2]); + handler[i].call(this, arguments[1], arguments[2]); break; default: - handler[i2].apply(this, args); + handler[i].apply(this, args); } } return true; @@ -63496,7 +63510,7 @@ var eventemitter2 = { exports: {} }; } this._events || init3.call(this); var type = arguments[0], wildcard = this.wildcard, ns, containsSymbol; - var args, l2, i2, j2; + var args, l2, i, j2; if (type === "newListener" && !this._newListener) { if (!this._events.newListener) { return Promise.resolve([false]); @@ -63508,8 +63522,8 @@ var eventemitter2 = { exports: {} }; if (typeof type === "object") { l2 = type.length; if (symbolsSupported) { - for (i2 = 0; i2 < l2; i2++) { - if (typeof type[i2] === "symbol") { + for (i = 0; i < l2; i++) { + if (typeof type[i] === "symbol") { containsSymbol = true; break; } @@ -63525,20 +63539,20 @@ var eventemitter2 = { exports: {} }; var al2 = arguments.length; var handler; if (this._all) { - for (i2 = 0, l2 = this._all.length; i2 < l2; i2++) { + for (i = 0, l2 = this._all.length; i < l2; i++) { this.event = type; switch (al2) { case 1: - promises.push(this._all[i2].call(this, type)); + promises.push(this._all[i].call(this, type)); break; case 2: - promises.push(this._all[i2].call(this, type, arguments[1])); + promises.push(this._all[i].call(this, type, arguments[1])); break; case 3: - promises.push(this._all[i2].call(this, type, arguments[1], arguments[2])); + promises.push(this._all[i].call(this, type, arguments[1], arguments[2])); break; default: - promises.push(this._all[i2].apply(this, arguments)); + promises.push(this._all[i].apply(this, arguments)); } } } @@ -63573,20 +63587,20 @@ var eventemitter2 = { exports: {} }; for (j2 = 1; j2 < al2; j2++) args[j2 - 1] = arguments[j2]; } - for (i2 = 0, l2 = handler.length; i2 < l2; i2++) { + for (i = 0, l2 = handler.length; i < l2; i++) { this.event = type; switch (al2) { case 1: - promises.push(handler[i2].call(this)); + promises.push(handler[i].call(this)); break; case 2: - promises.push(handler[i2].call(this, arguments[1])); + promises.push(handler[i].call(this, arguments[1])); break; case 3: - promises.push(handler[i2].call(this, arguments[1], arguments[2])); + promises.push(handler[i].call(this, arguments[1], arguments[2])); break; default: - promises.push(handler[i2].apply(this, args)); + promises.push(handler[i].apply(this, args)); } } } else if (!this.ignoreErrors && !this._all && type === "error") { @@ -63686,9 +63700,9 @@ var eventemitter2 = { exports: {} }; handlers = leaf._listeners; if (isArray2(handlers)) { var position = -1; - for (var i2 = 0, length = handlers.length; i2 < length; i2++) { - if (handlers[i2] === listener || handlers[i2].listener && handlers[i2].listener === listener || handlers[i2]._origin && handlers[i2]._origin === listener) { - position = i2; + for (var i = 0, length = handlers.length; i < length; i++) { + if (handlers[i] === listener || handlers[i].listener && handlers[i].listener === listener || handlers[i]._origin && handlers[i]._origin === listener) { + position = i; break; } } @@ -63724,12 +63738,12 @@ var eventemitter2 = { exports: {} }; return this; }; EventEmitter2.prototype.offAny = function(fn) { - var i2 = 0, l2 = 0, fns; + var i = 0, l2 = 0, fns; if (fn && this._all && this._all.length > 0) { fns = this._all; - for (i2 = 0, l2 = fns.length; i2 < l2; i2++) { - if (fn === fns[i2]) { - fns.splice(i2, 1); + for (i = 0, l2 = fns.length; i < l2; i++) { + if (fn === fns[i]) { + fns.splice(i, 1); if (this._removeListener) this.emit("removeListenerAny", fn); return this; @@ -63738,8 +63752,8 @@ var eventemitter2 = { exports: {} }; } else { fns = this._all; if (this._removeListener) { - for (i2 = 0, l2 = fns.length; i2 < l2; i2++) - this.emit("removeListenerAny", fns[i2]); + for (i = 0, l2 = fns.length; i < l2; i++) + this.emit("removeListenerAny", fns[i]); } this._all = []; } @@ -63752,11 +63766,11 @@ var eventemitter2 = { exports: {} }; return this; } if (this.wildcard) { - var leafs = searchListenerTree.call(this, null, type, this.listenerTree, 0), leaf, i2; + var leafs = searchListenerTree.call(this, null, type, this.listenerTree, 0), leaf, i; if (!leafs) return this; - for (i2 = 0; i2 < leafs.length; i2++) { - leaf = leafs[i2]; + for (i = 0; i < leafs.length; i++) { + leaf = leafs[i]; leaf._listeners = null; } this.listenerTree && recursivelyGarbageCollect(this.listenerTree); @@ -63768,7 +63782,7 @@ var eventemitter2 = { exports: {} }; EventEmitter2.prototype.listeners = function(type) { var _events = this._events; var keys, listeners, allListeners; - var i2; + var i; var listenerTree; if (type === undefined$1) { if (this.wildcard) { @@ -63778,10 +63792,10 @@ var eventemitter2 = { exports: {} }; return []; } keys = ownKeys2(_events); - i2 = keys.length; + i = keys.length; allListeners = []; - while (i2-- > 0) { - listeners = _events[keys[i2]]; + while (i-- > 0) { + listeners = _events[keys[i]]; if (typeof listeners === "function") { allListeners.push(listeners); } else { @@ -63982,12 +63996,12 @@ function output$1(out, instance) { const createView$1 = (arr) => new DataView(arr.buffer, arr.byteOffset, arr.byteLength); const rotr$1 = (word, shift2) => word << 32 - shift2 | word >>> shift2; new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68; -const hexes$2 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i2) => i2.toString(16).padStart(2, "0")); +const hexes$2 = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0")); function bytesToHex$2(bytes3) { bytes$1(bytes3); let hex2 = ""; - for (let i2 = 0; i2 < bytes3.length; i2++) { - hex2 += hexes$2[bytes3[i2]]; + for (let i = 0; i < bytes3.length; i++) { + hex2 += hexes$2[bytes3[i]]; } return hex2; } @@ -64081,8 +64095,8 @@ class HashMD extends Hash$1 { this.process(view, 0); pos = 0; } - for (let i2 = pos; i2 < blockLen; i2++) - buffer2[i2] = 0; + for (let i = pos; i < blockLen; i++) + buffer2[i] = 0; setBigUint64$1(view, blockLen - 8, BigInt(this.length * 8), isLE2); this.process(view, 0); const oview = createView$1(out); @@ -64093,8 +64107,8 @@ class HashMD extends Hash$1 { const state = this.get(); if (outLen > state.length) throw new Error("_sha2: outputLen bigger than state"); - for (let i2 = 0; i2 < outLen; i2++) - oview.setUint32(4 * i2, state[i2], isLE2); + for (let i = 0; i < outLen; i++) + oview.setUint32(4 * i, state[i], isLE2); } digest() { const { buffer: buffer2, outputLen } = this; @@ -64221,19 +64235,19 @@ let SHA256$1 = class SHA256 extends HashMD { this.H = H2 | 0; } process(view, offset2) { - for (let i2 = 0; i2 < 16; i2++, offset2 += 4) - SHA256_W$1[i2] = view.getUint32(offset2, false); - for (let i2 = 16; i2 < 64; i2++) { - const W15 = SHA256_W$1[i2 - 15]; - const W2 = SHA256_W$1[i2 - 2]; + for (let i = 0; i < 16; i++, offset2 += 4) + SHA256_W$1[i] = view.getUint32(offset2, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W$1[i - 15]; + const W2 = SHA256_W$1[i - 2]; const s0 = rotr$1(W15, 7) ^ rotr$1(W15, 18) ^ W15 >>> 3; const s1 = rotr$1(W2, 17) ^ rotr$1(W2, 19) ^ W2 >>> 10; - SHA256_W$1[i2] = s1 + SHA256_W$1[i2 - 7] + s0 + SHA256_W$1[i2 - 16] | 0; + SHA256_W$1[i] = s1 + SHA256_W$1[i - 7] + s0 + SHA256_W$1[i - 16] | 0; } let { A: A2, B: B2, C: C2, D: D2, E: E2, F: F2, G: G2, H: H2 } = this; - for (let i2 = 0; i2 < 64; i2++) { + for (let i = 0; i < 64; i++) { const sigma1 = rotr$1(E2, 6) ^ rotr$1(E2, 11) ^ rotr$1(E2, 25); - const T1 = H2 + sigma1 + Chi$1(E2, F2, G2) + SHA256_K$1[i2] + SHA256_W$1[i2] | 0; + const T1 = H2 + sigma1 + Chi$1(E2, F2, G2) + SHA256_K$1[i] + SHA256_W$1[i] | 0; const sigma0 = rotr$1(A2, 2) ^ rotr$1(A2, 13) ^ rotr$1(A2, 22); const T2 = sigma0 + Maj$1(A2, B2, C2) | 0; H2 = G2; @@ -64603,8 +64617,8 @@ var Databeat2 = class { }); __publicField(this, "dedupedQueue", () => { const uniqEvents = /* @__PURE__ */ new Map(); - for (let i2 = 0; i2 < this.queue.length; i2++) { - const ev = this.queue[i2]; + for (let i = 0; i < this.queue.length; i++) { + const ev = this.queue[i]; const key2 = `${ev.event}:${ev.source}:${ev.userId}:${ev.sessionId}:${JSON.stringify(ev.props)}:${JSON.stringify(ev.nums)}`; if (!uniqEvents.has(key2)) { uniqEvents.set(key2, ev); @@ -64706,12 +64720,12 @@ var Databeat2 = class { throw new Error("databeat: init first"); } if (Array.isArray(events)) { - for (let i2 = 0; i2 < events.length; i2++) { - events[i2].ident = this.ident; - events[i2].userId = this.userId; - events[i2].sessionId = this.sessionId; - if (!events[i2].projectId && this.projectId) { - events[i2].projectId = this.projectId; + for (let i = 0; i < events.length; i++) { + events[i].ident = this.ident; + events[i].userId = this.userId; + events[i].sessionId = this.sessionId; + if (!events[i].projectId && this.projectId) { + events[i].projectId = this.projectId; } } this.queue.push(...events); @@ -64931,7 +64945,7 @@ var genSessionId = () => { }; var genRandHex = (n2) => { let hexString = ""; - for (let i2 = 0; i2 < n2; i2++) { + for (let i = 0; i < n2; i++) { hexString += Math.floor(Math.random() * 16).toString(16); } return "0x" + hexString; @@ -64979,10 +64993,10 @@ function isCreateContractCall(data) { return false; } } -function _extends$7() { - _extends$7 = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$3() { + _extends$3 = Object.assign ? Object.assign.bind() : function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -64991,7 +65005,7 @@ function _extends$7() { } return target; }; - return _extends$7.apply(this, arguments); + return _extends$3.apply(this, arguments); } function isProviderTransport(transport) { return transport && typeof transport === "object" && typeof transport.register === "function" && typeof transport.unregister === "function" && typeof transport.openWallet === "function" && typeof transport.closeWallet === "function" && typeof transport.isOpened === "function" && typeof transport.isConnected === "function" && typeof transport.on === "function"; @@ -65320,7 +65334,7 @@ class BaseProviderTransport { logger.info("closing wallet and flushing!"); this.pendingMessageRequests.length = 0; this.responseCallbacks.forEach((responseCallback) => { - responseCallback(_extends$7({}, new Error("wallet closed"), { + responseCallback(_extends$3({}, new Error("wallet closed"), { code: 4001 })); }); @@ -66710,8 +66724,8 @@ class MuxMessageProvider { if (this.provider) { return this.provider.emit(event, ...args); } - for (let i2 = 0; i2 < this.messageProviders.length; i2++) { - this.messageProviders[i2].emit(event, ...args); + for (let i = 0; i < this.messageProviders.length; i++) { + this.messageProviders[i].emit(event, ...args); } return true; } @@ -66738,7 +66752,7 @@ function toExtended(transactions2) { throw new Error("No transaction provided"); } const [first, ...rest] = transactions2; - return _extends$7({}, first, { + return _extends$3({}, first, { auxiliary: rest }); } @@ -67074,7 +67088,7 @@ class WalletRequestHandler { } catch (err) { logger.error(err); response.result = null; - response.error = _extends$7({}, new Error(err), { + response.error = _extends$3({}, new Error(err), { code: 4001 }); } @@ -67157,7 +67171,7 @@ class WalletRequestHandler { error: "unable to connect without signed in account" }; } - const networkId = (_ref = (_options$networkId = options == null ? void 0 : options.networkId) != null ? _options$networkId : this.defaultChainId()) != null ? _ref : ChainId$2.MAINNET; + const networkId = (_ref = (_options$networkId = options == null ? void 0 : options.networkId) != null ? _options$networkId : this.defaultChainId()) != null ? _ref : ChainId.MAINNET; const chainId = findSupportedNetwork(networkId).chainId; const connectDetails = { connected: true, @@ -67190,7 +67204,7 @@ class WalletRequestHandler { sendMessageRequest(message) { return new Promise((resolve) => { this.sendAsync(message.data, (error, response) => { - const responseMessage = _extends$7({}, message, { + const responseMessage = _extends$3({}, message, { data: response }); resolve(responseMessage); @@ -67233,7 +67247,7 @@ class WalletRequestHandler { } if (jsonRpcResponse) { return this.account.networks.map((n2) => { - const network2 = _extends$7({}, n2); + const network2 = _extends$3({}, n2); network2.provider = void 0; network2.relayer = void 0; return network2; @@ -67250,7 +67264,7 @@ class WalletRequestHandler { walletContext: this.account.contexts, accountAddress: this.account.address, // The dapp shouldn't access the relayer directly, and the provider (as an object) is not serializable. - networks: this.account.networks.map((n2) => _extends$7({}, n2, { + networks: this.account.networks.map((n2) => _extends$3({}, n2, { provider: void 0, relayer: void 0 })) @@ -67307,8 +67321,8 @@ class WalletRequestHandler { setAccount(account2) { this.account = account2; if (account2 !== void 0) { - for (let i2 = 0; i2 < this.signerReadyCallbacks.length; i2++) { - this.signerReadyCallbacks[i2](); + for (let i = 0; i < this.signerReadyCallbacks.length; i++) { + this.signerReadyCallbacks[i](); } this.signerReadyCallbacks = []; } @@ -67651,7 +67665,7 @@ class SequenceProvider extends BaseProvider { }); } authorize(options) { - return this.client.connect(_extends$7({}, options, { + return this.client.connect(_extends$3({}, options, { authorize: true })); } @@ -67923,7 +67937,7 @@ const setupAnalytics = (projectAccessKey2, server) => { }; var packageJson = { name: "@0xsequence/provider", - version: "1.9.34", + version: "1.9.36", description: "provider sub-package for Sequence", repository: "https://github.com/0xsequence/sequence.js/tree/master/packages/provider", source: "src/index.ts", @@ -68066,7 +68080,7 @@ class SequenceClient { this.transport.on("connect", (response) => { var _this$callbacks$conne; const chainIdHex = hexValue(this.getChainId()); - (_this$callbacks$conne = this.callbacks.connect) == null || _this$callbacks$conne.forEach((cb2) => cb2(_extends$7({}, response, { + (_this$callbacks$conne = this.callbacks.connect) == null || _this$callbacks$conne.forEach((cb2) => cb2(_extends$3({}, response, { // Ignore the full connect response // use the chainId defined locally chainId: chainIdHex @@ -68200,7 +68214,7 @@ class SequenceClient { } await this.openWallet(void 0, { type: "connect", - options: _extends$7({}, options, { + options: _extends$3({}, options, { networkId: this.getChainId(), clientVersion: packageJson.version }) @@ -68396,8 +68410,8 @@ const initWallet = (projectAccessKey2, partialConfig) => { if (sequenceWalletProvider) { return sequenceWalletProvider; } - const config2 = _extends$7({}, DefaultProviderConfig, partialConfig, { - transports: _extends$7({}, DefaultProviderConfig.transports, partialConfig == null ? void 0 : partialConfig.transports) + const config2 = _extends$3({}, DefaultProviderConfig, partialConfig, { + transports: _extends$3({}, DefaultProviderConfig.transports, partialConfig == null ? void 0 : partialConfig.transports) }); const rpcProviders = {}; const newNetworks = (_config$networks$filt = (_config$networks = config2.networks) == null ? void 0 : _config$networks.filter((n2) => { @@ -68406,7 +68420,7 @@ const initWallet = (projectAccessKey2, partialConfig) => { const combinedNetworks = allNetworks.map((n2) => { var _config$networks2; const network2 = (_config$networks2 = config2.networks) == null ? void 0 : _config$networks2.find((cn) => cn.chainId === n2.chainId); - return network2 ? _extends$7({}, n2, network2) : n2; + return network2 ? _extends$3({}, n2, network2) : n2; }).concat(newNetworks).map((network2) => { if (network2.rpcUrl.includes(projectAccessKey2)) { return network2; @@ -68903,9 +68917,9 @@ function padBytes(bytes3, { dir, size: size2 = 32 } = {}) { type: "bytes" }); const paddedBytes = new Uint8Array(size2); - for (let i2 = 0; i2 < size2; i2++) { + for (let i = 0; i < size2; i++) { const padEnd = dir === "right"; - paddedBytes[padEnd ? i2 : size2 - i2 - 1] = bytes3[padEnd ? i2 : bytes3.length - i2 - 1]; + paddedBytes[padEnd ? i : size2 - i - 1] = bytes3[padEnd ? i : bytes3.length - i - 1]; } return paddedBytes; } @@ -68924,8 +68938,8 @@ function size$5(value) { function trim(hexOrBytes, { dir = "left" } = {}) { let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes; let sliceLength = 0; - for (let i2 = 0; i2 < data.length - 1; i2++) { - if (data[dir === "left" ? i2 : data.length - i2 - 1].toString() === "0") + for (let i = 0; i < data.length - 1; i++) { + if (data[dir === "left" ? i : data.length - i - 1].toString() === "0") sliceLength++; else break; @@ -69063,7 +69077,7 @@ function hexToString(hex2, opts = {}) { } return new TextDecoder().decode(bytes3); } -const hexes$1 = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i2) => i2.toString(16).padStart(2, "0")); +const hexes$1 = /* @__PURE__ */ Array.from({ length: 256 }, (_v, i) => i.toString(16).padStart(2, "0")); function toHex$1(value, opts = {}) { if (typeof value === "number" || typeof value === "bigint") return numberToHex(value, opts); @@ -69084,8 +69098,8 @@ function boolToHex(value, opts = {}) { } function bytesToHex$1(value, opts = {}) { let string = ""; - for (let i2 = 0; i2 < value.length; i2++) { - string += hexes$1[value[i2]]; + for (let i = 0; i < value.length; i++) { + string += hexes$1[value[i]]; } const hex2 = `0x${string}`; if (typeof opts.size === "number") { @@ -69625,9 +69639,9 @@ function fromBig(n2, le2 = false) { function split(lst, le2 = false) { let Ah2 = new Uint32Array(lst.length); let Al = new Uint32Array(lst.length); - for (let i2 = 0; i2 < lst.length; i2++) { - const { h: h2, l: l2 } = fromBig(lst[i2], le2); - [Ah2[i2], Al[i2]] = [h2, l2]; + for (let i = 0; i < lst.length; i++) { + const { h: h2, l: l2 } = fromBig(lst[i], le2); + [Ah2[i], Al[i]] = [h2, l2]; } return [Ah2, Al]; } @@ -69780,7 +69794,7 @@ class Keccak extends Hash2 { const len = data.length; for (let pos = 0; pos < len; ) { const take = Math.min(blockLen - this.pos, len - pos); - for (let i2 = 0; i2 < take; i2++) + for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++]; if (this.pos === blockLen) this.keccak(); @@ -69869,12 +69883,12 @@ function checksumAddress(address_, chainId) { const hexAddress = address_.substring(2).toLowerCase(); const hash2 = keccak256(stringToBytes(hexAddress), "bytes"); const address = hexAddress.split(""); - for (let i2 = 0; i2 < 40; i2 += 2) { - if (hash2[i2 >> 1] >> 4 >= 8 && address[i2]) { - address[i2] = address[i2].toUpperCase(); + for (let i = 0; i < 40; i += 2) { + if (hash2[i >> 1] >> 4 >= 8 && address[i]) { + address[i] = address[i].toUpperCase(); } - if ((hash2[i2 >> 1] & 15) >= 8 && address[i2 + 1]) { - address[i2 + 1] = address[i2 + 1].toUpperCase(); + if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) { + address[i + 1] = address[i + 1].toUpperCase(); } } const result = `0x${address.join("")}`; @@ -69961,8 +69975,8 @@ function encodeAbiParameters(params, values) { } function prepareParams({ params, values }) { const preparedParams = []; - for (let i2 = 0; i2 < params.length; i2++) { - preparedParams.push(prepareParam({ param: params[i2], value: values[i2] })); + for (let i = 0; i < params.length; i++) { + preparedParams.push(prepareParam({ param: params[i], value: values[i] })); } return preparedParams; } @@ -69999,8 +70013,8 @@ function prepareParam({ param, value }) { } function encodeParams(preparedParams) { let staticSize = 0; - for (let i2 = 0; i2 < preparedParams.length; i2++) { - const { dynamic, encoded } = preparedParams[i2]; + for (let i = 0; i < preparedParams.length; i++) { + const { dynamic, encoded } = preparedParams[i]; if (dynamic) staticSize += 32; else @@ -70009,8 +70023,8 @@ function encodeParams(preparedParams) { const staticParams = []; const dynamicParams = []; let dynamicSize = 0; - for (let i2 = 0; i2 < preparedParams.length; i2++) { - const { dynamic, encoded } = preparedParams[i2]; + for (let i = 0; i < preparedParams.length; i++) { + const { dynamic, encoded } = preparedParams[i]; if (dynamic) { staticParams.push(numberToHex(staticSize + dynamicSize, { size: 32 })); dynamicParams.push(encoded); @@ -70038,8 +70052,8 @@ function encodeArray(value, { length, param }) { }); let dynamicChild = false; const preparedParams = []; - for (let i2 = 0; i2 < value.length; i2++) { - const preparedParam = prepareParam({ param, value: value[i2] }); + for (let i = 0; i < value.length; i++) { + const preparedParam = prepareParam({ param, value: value[i] }); if (preparedParam.dynamic) dynamicChild = true; preparedParams.push(preparedParam); @@ -70101,8 +70115,8 @@ function encodeString(value) { const hexValue2 = stringToHex(value); const partsLength = Math.ceil(size$5(hexValue2) / 32); const parts = []; - for (let i2 = 0; i2 < partsLength; i2++) { - parts.push(padHex(slice(hexValue2, i2 * 32, (i2 + 1) * 32), { + for (let i = 0; i < partsLength; i++) { + parts.push(padHex(slice(hexValue2, i * 32, (i + 1) * 32), { dir: "right" })); } @@ -70117,9 +70131,9 @@ function encodeString(value) { function encodeTuple(value, { param }) { let dynamic = false; const preparedParams = []; - for (let i2 = 0; i2 < param.components.length; i2++) { - const param_ = param.components[i2]; - const index2 = Array.isArray(value) ? i2 : param_.name; + for (let i = 0; i < param.components.length; i++) { + const param_ = param.components[i]; + const index2 = Array.isArray(value) ? i : param_.name; const preparedParam = prepareParam({ param: param_, value: value[index2] @@ -71761,9 +71775,9 @@ function blobsToProofs(parameters) { const blobs = typeof parameters.blobs[0] === "string" ? parameters.blobs.map((x) => hexToBytes$1(x)) : parameters.blobs; const commitments = typeof parameters.commitments[0] === "string" ? parameters.commitments.map((x) => hexToBytes$1(x)) : parameters.commitments; const proofs = []; - for (let i2 = 0; i2 < blobs.length; i2++) { - const blob = blobs[i2]; - const commitment = commitments[i2]; + for (let i = 0; i < blobs.length; i++) { + const blob = blobs[i]; + const commitment = commitments[i]; proofs.push(Uint8Array.from(kzg.computeBlobKzgProof(blob, commitment))); } return to === "bytes" ? proofs : proofs.map((x) => bytesToHex$1(x)); @@ -71831,8 +71845,8 @@ class SHA2 extends Hash2 { this.process(view, 0); pos = 0; } - for (let i2 = pos; i2 < blockLen; i2++) - buffer2[i2] = 0; + for (let i = pos; i < blockLen; i++) + buffer2[i] = 0; setBigUint64(view, blockLen - 8, BigInt(this.length * 8), isLE2); this.process(view, 0); const oview = createView(out); @@ -71843,8 +71857,8 @@ class SHA2 extends Hash2 { const state = this.get(); if (outLen > state.length) throw new Error("_sha2: outputLen bigger than state"); - for (let i2 = 0; i2 < outLen; i2++) - oview.setUint32(4 * i2, state[i2], isLE2); + for (let i = 0; i < outLen; i++) + oview.setUint32(4 * i, state[i], isLE2); } digest() { const { buffer: buffer2, outputLen } = this; @@ -71973,19 +71987,19 @@ class SHA2562 extends SHA2 { this.H = H2 | 0; } process(view, offset2) { - for (let i2 = 0; i2 < 16; i2++, offset2 += 4) - SHA256_W[i2] = view.getUint32(offset2, false); - for (let i2 = 16; i2 < 64; i2++) { - const W15 = SHA256_W[i2 - 15]; - const W2 = SHA256_W[i2 - 2]; + for (let i = 0; i < 16; i++, offset2 += 4) + SHA256_W[i] = view.getUint32(offset2, false); + for (let i = 16; i < 64; i++) { + const W15 = SHA256_W[i - 15]; + const W2 = SHA256_W[i - 2]; const s0 = rotr(W15, 7) ^ rotr(W15, 18) ^ W15 >>> 3; const s1 = rotr(W2, 17) ^ rotr(W2, 19) ^ W2 >>> 10; - SHA256_W[i2] = s1 + SHA256_W[i2 - 7] + s0 + SHA256_W[i2 - 16] | 0; + SHA256_W[i] = s1 + SHA256_W[i - 7] + s0 + SHA256_W[i - 16] | 0; } let { A: A2, B: B2, C: C2, D: D2, E: E2, F: F2, G: G2, H: H2 } = this; - for (let i2 = 0; i2 < 64; i2++) { + for (let i = 0; i < 64; i++) { const sigma1 = rotr(E2, 6) ^ rotr(E2, 11) ^ rotr(E2, 25); - const T1 = H2 + sigma1 + Chi(E2, F2, G2) + SHA256_K[i2] + SHA256_W[i2] | 0; + const T1 = H2 + sigma1 + Chi(E2, F2, G2) + SHA256_K[i] + SHA256_W[i] | 0; const sigma0 = rotr(A2, 2) ^ rotr(A2, 13) ^ rotr(A2, 22); const T2 = sigma0 + Maj(A2, B2, C2) | 0; H2 = G2; @@ -72310,11 +72324,11 @@ function toBlobSidecars(parameters) { const commitments = parameters.commitments ?? blobsToCommitments({ blobs, kzg, to }); const proofs = parameters.proofs ?? blobsToProofs({ blobs, commitments, kzg, to }); const sidecars = []; - for (let i2 = 0; i2 < blobs.length; i2++) + for (let i = 0; i < blobs.length; i++) sidecars.push({ - blob: blobs[i2], - commitment: commitments[i2], - proof: proofs[i2] + blob: blobs[i], + commitment: commitments[i], + proof: proofs[i] }); return sidecars; } @@ -72767,8 +72781,8 @@ function decodeAbiParameters(params, data) { }); let consumed = 0; const values = []; - for (let i2 = 0; i2 < params.length; ++i2) { - const param = params[i2]; + for (let i = 0; i < params.length; ++i) { + const param = params[i]; cursor.setPosition(consumed); const [data2, consumed_] = decodeParameter(cursor, param, { staticPosition: 0 @@ -72816,8 +72830,8 @@ function decodeArray(cursor, param, { length, staticPosition }) { const dynamicChild = hasDynamicChild(param); let consumed2 = 0; const value2 = []; - for (let i2 = 0; i2 < length2; ++i2) { - cursor.setPosition(startOfData + (dynamicChild ? i2 * 32 : consumed2)); + for (let i = 0; i < length2; ++i) { + cursor.setPosition(startOfData + (dynamicChild ? i * 32 : consumed2)); const [data, consumed_] = decodeParameter(cursor, param, { staticPosition: startOfData }); @@ -72831,8 +72845,8 @@ function decodeArray(cursor, param, { length, staticPosition }) { const offset2 = bytesToNumber(cursor.readBytes(sizeOfOffset)); const start = staticPosition + offset2; const value2 = []; - for (let i2 = 0; i2 < length; ++i2) { - cursor.setPosition(start + i2 * 32); + for (let i = 0; i < length; ++i) { + cursor.setPosition(start + i * 32); const [data] = decodeParameter(cursor, param, { staticPosition: start }); @@ -72843,7 +72857,7 @@ function decodeArray(cursor, param, { length, staticPosition }) { } let consumed = 0; const value = []; - for (let i2 = 0; i2 < length; ++i2) { + for (let i = 0; i < length; ++i) { const [data, consumed_] = decodeParameter(cursor, param, { staticPosition: staticPosition + consumed }); @@ -72888,24 +72902,24 @@ function decodeTuple(cursor, param, { staticPosition }) { if (hasDynamicChild(param)) { const offset2 = bytesToNumber(cursor.readBytes(sizeOfOffset)); const start = staticPosition + offset2; - for (let i2 = 0; i2 < param.components.length; ++i2) { - const component = param.components[i2]; + for (let i = 0; i < param.components.length; ++i) { + const component = param.components[i]; cursor.setPosition(start + consumed); const [data, consumed_] = decodeParameter(cursor, component, { staticPosition: start }); consumed += consumed_; - value[hasUnnamedChild ? i2 : component == null ? void 0 : component.name] = data; + value[hasUnnamedChild ? i : component == null ? void 0 : component.name] = data; } cursor.setPosition(staticPosition + 32); return [value, 32]; } - for (let i2 = 0; i2 < param.components.length; ++i2) { - const component = param.components[i2]; + for (let i = 0; i < param.components.length; ++i) { + const component = param.components[i]; const [data, consumed_] = decodeParameter(cursor, component, { staticPosition }); - value[hasUnnamedChild ? i2 : component == null ? void 0 : component.name] = data; + value[hasUnnamedChild ? i : component == null ? void 0 : component.name] = data; consumed += consumed_; } return [value, consumed]; @@ -72954,10 +72968,10 @@ function formatAbiParameter(abiParameter) { if (tupleRegex.test(abiParameter.type) && "components" in abiParameter) { type = "("; const length = abiParameter.components.length; - for (let i2 = 0; i2 < length; i2++) { - const component = abiParameter.components[i2]; + for (let i = 0; i < length; i++) { + const component = abiParameter.components[i]; type += formatAbiParameter(component); - if (i2 < length - 1) + if (i < length - 1) type += ", "; } const result = execTyped(tupleRegex, abiParameter.type); @@ -72976,10 +72990,10 @@ function formatAbiParameter(abiParameter) { function formatAbiParameters(abiParameters) { let params = ""; const length = abiParameters.length; - for (let i2 = 0; i2 < length; i2++) { - const abiParameter = abiParameters[i2]; + for (let i = 0; i < length; i++) { + const abiParameter = abiParameters[i]; params += formatAbiParameter(abiParameter); - if (i2 !== length - 1) + if (i !== length - 1) params += ", "; } return params; @@ -73003,8 +73017,8 @@ function normalizeSignature(signature2) { let level = 0; let result = ""; let valid = false; - for (let i2 = 0; i2 < signature2.length; i2++) { - const char = signature2[i2]; + for (let i = 0; i < signature2.length; i++) { + const char = signature2[i]; if (["(", ")", ","].includes(char)) active = true; if (char === "(") @@ -73026,7 +73040,7 @@ function normalizeSignature(signature2) { continue; } if (char === " ") { - if (signature2[i2 - 1] !== "," && current !== "," && current !== ",(") { + if (signature2[i - 1] !== "," && current !== "," && current !== ",(") { current = ""; active = false; } @@ -73291,7 +73305,7 @@ function formatAbiItemWithArgs({ abiItem, args, includeFunctionName = true, incl return; if (!abiItem.inputs) return; - return `${includeFunctionName ? abiItem.name : ""}(${abiItem.inputs.map((input2, i2) => `${includeName && input2.name ? `${input2.name}: ` : ""}${typeof args[i2] === "object" ? stringify(args[i2]) : args[i2]}`).join(", ")})`; + return `${includeFunctionName ? abiItem.name : ""}(${abiItem.inputs.map((input2, i) => `${includeName && input2.name ? `${input2.name}: ` : ""}${typeof args[i] === "object" ? stringify(args[i]) : args[i]}`).join(", ")})`; } class CallExecutionError extends BaseError$2 { constructor(cause, { account: account_, docsPath: docsPath2, chain, data, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce, to, value, stateOverride }) { @@ -73577,9 +73591,9 @@ function namehash(name2) { if (!name2) return bytesToHex$1(result); const labels = name2.split("."); - for (let i2 = labels.length - 1; i2 >= 0; i2 -= 1) { - const hashFromEncodedLabel = encodedLabelToLabelhash(labels[i2]); - const hashed = hashFromEncodedLabel ? toBytes$1(hashFromEncodedLabel) : keccak256(stringToBytes(labels[i2]), "bytes"); + for (let i = labels.length - 1; i >= 0; i -= 1) { + const hashFromEncodedLabel = encodedLabelToLabelhash(labels[i]); + const hashed = hashFromEncodedLabel ? toBytes$1(hashFromEncodedLabel) : keccak256(stringToBytes(labels[i]), "bytes"); result = keccak256(concat([result, hashed]), "bytes"); } return bytesToHex$1(result); @@ -73600,10 +73614,10 @@ function packetToBytes(packet) { const bytes3 = new Uint8Array(stringToBytes(value).byteLength + 2); let offset2 = 0; const list2 = value.split("."); - for (let i2 = 0; i2 < list2.length; i2++) { - let encoded = stringToBytes(list2[i2]); + for (let i = 0; i < list2.length; i++) { + let encoded = stringToBytes(list2[i]); if (encoded.byteLength > 255) - encoded = stringToBytes(encodeLabelhash(labelhash(list2[i2]))); + encoded = stringToBytes(encodeLabelhash(labelhash(list2[i]))); bytes3[offset2] = encoded.length; bytes3.set(encoded, offset2 + 1); offset2 += encoded.length + 1; @@ -73657,8 +73671,8 @@ const __vitePreload = function preload(baseModule, deps, importerUrl) { const cssSelector = isCss ? '[rel="stylesheet"]' : ""; const isBaseRelative = !!importerUrl; if (isBaseRelative) { - for (let i2 = links.length - 1; i2 >= 0; i2--) { - const link2 = links[i2]; + for (let i = links.length - 1; i >= 0; i--) { + const link2 = links[i]; if (link2.href === dep && (!isCss || link2.rel === "stylesheet")) { return; } @@ -73719,14 +73733,14 @@ function createBatchScheduler({ fn, id: id2, shouldSplitBatch, wait: wait2 = 0, var _a2; if (sort && Array.isArray(data)) data.sort(sort); - for (let i2 = 0; i2 < scheduler2.length; i2++) { - const { pendingPromise } = scheduler2[i2]; - (_a2 = pendingPromise.resolve) == null ? void 0 : _a2.call(pendingPromise, [data[i2], data]); + for (let i = 0; i < scheduler2.length; i++) { + const { pendingPromise } = scheduler2[i]; + (_a2 = pendingPromise.resolve) == null ? void 0 : _a2.call(pendingPromise, [data[i], data]); } }).catch((err) => { var _a2; - for (let i2 = 0; i2 < scheduler2.length; i2++) { - const { pendingPromise } = scheduler2[i2]; + for (let i = 0; i < scheduler2.length; i++) { + const { pendingPromise } = scheduler2[i]; (_a2 = pendingPromise.reject) == null ? void 0 : _a2.call(pendingPromise, err); } }); @@ -73809,7 +73823,7 @@ async function call(client2, args) { return { data: response }; } catch (err) { const data2 = getRevertErrorData(err); - const { offchainLookup, offchainLookupSignature } = await __vitePreload(() => import("./ccip-DQVuDNGZ.js"), true ? [] : void 0, import.meta.url); + const { offchainLookup, offchainLookupSignature } = await __vitePreload(() => import("./ccip-D5wfP5v-.js"), true ? [] : void 0, import.meta.url); if (client2.ccipRead !== false && (data2 == null ? void 0 : data2.slice(0, 10)) === offchainLookupSignature && to) return { data: await offchainLookup(client2, { data: data2, to }) }; throw getCallError(err, { @@ -74409,7 +74423,7 @@ function encodeEventTopics(parameters) { const indexedInputs = (_a2 = abiItem.inputs) == null ? void 0 : _a2.filter((param) => "indexed" in param && param.indexed); const args_ = Array.isArray(args) ? args : Object.values(args).length > 0 ? (indexedInputs == null ? void 0 : indexedInputs.map((x) => args[x.name])) ?? [] : []; if (args_.length > 0) { - topics = (indexedInputs == null ? void 0 : indexedInputs.map((param, i2) => Array.isArray(args_[i2]) ? args_[i2].map((_, j2) => encodeArg({ param, value: args_[i2][j2] })) : args_[i2] ? encodeArg({ param, value: args_[i2] }) : null)) ?? []; + topics = (indexedInputs == null ? void 0 : indexedInputs.map((param, i) => Array.isArray(args_[i]) ? args_[i].map((_, j2) => encodeArg({ param, value: args_[i][j2] })) : args_[i] ? encodeArg({ param, value: args_[i] }) : null)) ?? []; } } return [signature2, ...topics]; @@ -74628,15 +74642,15 @@ function decodeEventLog(parameters) { const isUnnamed = inputs == null ? void 0 : inputs.some((x) => !("name" in x && x.name)); let args = isUnnamed ? [] : {}; const indexedInputs = inputs.filter((x) => "indexed" in x && x.indexed); - for (let i2 = 0; i2 < indexedInputs.length; i2++) { - const param = indexedInputs[i2]; - const topic = argTopics[i2]; + for (let i = 0; i < indexedInputs.length; i++) { + const param = indexedInputs[i]; + const topic = argTopics[i]; if (!topic) throw new DecodeLogTopicsMismatch({ abiItem, param }); - args[isUnnamed ? i2 : param.name || i2] = decodeTopic({ param, value: topic }); + args[isUnnamed ? i : param.name || i] = decodeTopic({ param, value: topic }); } const nonIndexedInputs = inputs.filter((x) => !("indexed" in x && x.indexed)); if (nonIndexedInputs.length > 0) { @@ -74647,8 +74661,8 @@ function decodeEventLog(parameters) { if (isUnnamed) args = [...args, ...decodedData]; else { - for (let i2 = 0; i2 < nonIndexedInputs.length; i2++) { - args[nonIndexedInputs[i2].name] = decodedData[i2]; + for (let i = 0; i < nonIndexedInputs.length; i++) { + args[nonIndexedInputs[i].name] = decodedData[i]; } } } @@ -74936,8 +74950,8 @@ async function multicall(client2, parameters) { const chunkedCalls = [[]]; let currentChunk = 0; let currentChunkSize = 0; - for (let i2 = 0; i2 < contracts.length; i2++) { - const { abi: abi2, address, args, functionName } = contracts[i2]; + for (let i = 0; i < contracts.length; i++) { + const { abi: abi2, address, args, functionName } = contracts[i]; try { const callData = encodeFunctionData({ abi: abi2, args, functionName }); currentChunkSize += (callData.length - 2) / 2; @@ -74989,12 +75003,12 @@ async function multicall(client2, parameters) { stateOverride }))); const results2 = []; - for (let i2 = 0; i2 < aggregate3Results.length; i2++) { - const result = aggregate3Results[i2]; + for (let i = 0; i < aggregate3Results.length; i++) { + const result = aggregate3Results[i]; if (result.status === "rejected") { if (!allowFailure) throw result.reason; - for (let j2 = 0; j2 < chunkedCalls[i2].length; j2++) { + for (let j2 = 0; j2 < chunkedCalls[i].length; j2++) { results2.push({ status: "failure", error: result.reason, @@ -75006,7 +75020,7 @@ async function multicall(client2, parameters) { const aggregate3Result = result.value; for (let j2 = 0; j2 < aggregate3Result.length; j2++) { const { returnData, success } = aggregate3Result[j2]; - const { callData } = chunkedCalls[i2][j2]; + const { callData } = chunkedCalls[i][j2]; const { abi: abi2, address, functionName, args } = contracts[results2.length]; try { if (callData === "0x") @@ -75134,9 +75148,9 @@ function watchBlocks(client2, { blockTag = "latest", emitMissed = false, emitOnB if (block.number === prevBlock.number) return; if (block.number - prevBlock.number > 1 && emitMissed) { - for (let i2 = (prevBlock == null ? void 0 : prevBlock.number) + 1n; i2 < block.number; i2++) { + for (let i = (prevBlock == null ? void 0 : prevBlock.number) + 1n; i < block.number; i++) { const block2 = await getAction$1(client2, getBlock, "getBlock")({ - blockNumber: i2, + blockNumber: i, includeTransactions }); emit.onBlock(block2, prevBlock); @@ -75229,9 +75243,9 @@ function watchBlockNumber(client2, { emitOnBegin = false, emitMissed = false, on if (blockNumber === prevBlockNumber) return; if (blockNumber - prevBlockNumber > 1 && emitMissed) { - for (let i2 = prevBlockNumber + 1n; i2 < blockNumber; i2++) { - emit.onBlockNumber(i2, prevBlockNumber); - prevBlockNumber = i2; + for (let i = prevBlockNumber + 1n; i < blockNumber; i++) { + emit.onBlockNumber(i, prevBlockNumber); + prevBlockNumber = i; } } } @@ -76346,13 +76360,13 @@ const _0n$3 = BigInt(0); const _1n$4 = BigInt(1); const _2n$2 = BigInt(2); const u8a = (a2) => a2 instanceof Uint8Array; -const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i2) => i2.toString(16).padStart(2, "0")); +const hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0")); function bytesToHex(bytes3) { if (!u8a(bytes3)) throw new Error("Uint8Array expected"); let hex2 = ""; - for (let i2 = 0; i2 < bytes3.length; i2++) { - hex2 += hexes[bytes3[i2]]; + for (let i = 0; i < bytes3.length; i++) { + hex2 += hexes[bytes3[i]]; } return hex2; } @@ -76372,13 +76386,13 @@ function hexToBytes(hex2) { if (len % 2) throw new Error("padded hex string expected, got unpadded hex of length " + len); const array = new Uint8Array(len / 2); - for (let i2 = 0; i2 < array.length; i2++) { - const j2 = i2 * 2; + for (let i = 0; i < array.length; i++) { + const j2 = i * 2; const hexByte = hex2.slice(j2, j2 + 2); const byte = Number.parseInt(hexByte, 16); if (Number.isNaN(byte) || byte < 0) throw new Error("Invalid byte sequence"); - array[i2] = byte; + array[i] = byte; } return array; } @@ -76431,8 +76445,8 @@ function concatBytes(...arrays) { function equalBytes(b1, b2) { if (b1.length !== b2.length) return false; - for (let i2 = 0; i2 < b1.length; i2++) - if (b1[i2] !== b2[i2]) + for (let i = 0; i < b1.length; i++) + if (b1[i] !== b2[i]) return false; return true; } @@ -76465,11 +76479,11 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) { throw new Error("hmacFn must be a function"); let v3 = u8n(hashLen); let k2 = u8n(hashLen); - let i2 = 0; + let i = 0; const reset = () => { v3.fill(1); k2.fill(0); - i2 = 0; + i = 0; }; const h2 = (...b2) => hmacFn(k2, v3, ...b2); const reseed2 = (seed = u8n()) => { @@ -76481,7 +76495,7 @@ function createHmacDrbg(hashLen, qByteLen, hmacFn) { v3 = h2(); }; const gen2 = () => { - if (i2++ >= 1e3) + if (i++ >= 1e3) throw new Error("drbg: tried 1000 values"); let len = 0; const out = []; @@ -76667,8 +76681,8 @@ function FpSqrt(P2) { const n22 = Fp2.mul(n2, _2n$1); const v3 = Fp2.pow(n22, c1); const nv = Fp2.mul(n2, v3); - const i2 = Fp2.mul(Fp2.mul(nv, _2n$1), v3); - const root2 = Fp2.mul(nv, Fp2.sub(i2, Fp2.ONE)); + const i = Fp2.mul(Fp2.mul(nv, _2n$1), v3); + const root2 = Fp2.mul(nv, Fp2.sub(i, Fp2.ONE)); if (!Fp2.eql(Fp2.sqr(root2), n2)) throw new Error("Cannot find square root"); return root2; @@ -76727,17 +76741,17 @@ function FpPow(f2, num, power) { } function FpInvertBatch(f2, nums) { const tmp = new Array(nums.length); - const lastMultiplied = nums.reduce((acc, num, i2) => { + const lastMultiplied = nums.reduce((acc, num, i) => { if (f2.is0(num)) return acc; - tmp[i2] = acc; + tmp[i] = acc; return f2.mul(acc, num); }, f2.ONE); const inverted = f2.inv(lastMultiplied); - nums.reduceRight((acc, num, i2) => { + nums.reduceRight((acc, num, i) => { if (f2.is0(num)) return acc; - tmp[i2] = f2.mul(acc, tmp[i2]); + tmp[i] = f2.mul(acc, tmp[i]); return f2.mul(acc, num); }, inverted); return tmp; @@ -76862,7 +76876,7 @@ function wNAF(c2, bits) { for (let window2 = 0; window2 < windows; window2++) { base2 = p2; points.push(base2); - for (let i2 = 1; i2 < windowSize; i2++) { + for (let i = 1; i < windowSize; i++) { base2 = base2.add(p2); points.push(base2); } @@ -77090,7 +77104,7 @@ function weierstrassPoints(opts) { throw new Error("invalid affine point"); if (p2 instanceof Point2) throw new Error("projective point not allowed"); - const is0 = (i2) => Fp2.eql(i2, Fp2.ZERO); + const is0 = (i) => Fp2.eql(i, Fp2.ZERO); if (is0(x) && is0(y2)) return Point2.ZERO; return new Point2(x, y2, Fp2.ONE); @@ -77109,7 +77123,7 @@ function weierstrassPoints(opts) { */ static normalizeZ(points) { const toInv = Fp2.invertBatch(points.map((p2) => p2.pz)); - return points.map((p2, i2) => p2.toAffine(toInv[i2])).map(Point2.fromAffine); + return points.map((p2, i) => p2.toAffine(toInv[i])).map(Point2.fromAffine); } /** * Converts hash string or Uint8Array to Point. @@ -77273,7 +77287,7 @@ function weierstrassPoints(opts) { wNAF(n2) { return wnaf.wNAFCached(this, pointPrecomputes, n2, (comp) => { const toInv = Fp2.invertBatch(comp.map((p2) => p2.pz)); - return comp.map((p2, i2) => p2.toAffine(toInv[i2])).map(Point2.fromAffine); + return comp.map((p2, i) => p2.toAffine(toInv[i])).map(Point2.fromAffine); }); } /** @@ -77740,12 +77754,12 @@ class HMAC extends Hash2 { const blockLen = this.blockLen; const pad3 = new Uint8Array(blockLen); pad3.set(key2.length > blockLen ? hash2.create().update(key2).digest() : key2); - for (let i2 = 0; i2 < pad3.length; i2++) - pad3[i2] ^= 54; + for (let i = 0; i < pad3.length; i++) + pad3[i] ^= 54; this.iHash.update(pad3); this.oHash = hash2.create(); - for (let i2 = 0; i2 < pad3.length; i2++) - pad3[i2] ^= 54 ^ 92; + for (let i = 0; i < pad3.length; i++) + pad3[i] ^= 54 ^ 92; this.oHash.update(pad3); pad3.fill(0); } @@ -78178,7 +78192,7 @@ function uid$1(length = 11) { if (!buffer$1 || index$2 + length > size$4 * 2) { buffer$1 = ""; index$2 = 0; - for (let i2 = 0; i2 < size$4; i2++) { + for (let i = 0; i < size$4; i++) { buffer$1 += (256 + Math.random() * 256 | 0).toString(16).substring(1); } } @@ -78876,8 +78890,8 @@ var eventemitter3 = { exports: {} }; return []; if (handlers.fn) return [handlers.fn]; - for (var i2 = 0, l2 = handlers.length, ee2 = new Array(l2); i2 < l2; i2++) { - ee2[i2] = handlers[i2].fn; + for (var i = 0, l2 = handlers.length, ee2 = new Array(l2); i < l2; i++) { + ee2[i] = handlers[i].fn; } return ee2; }; @@ -78893,7 +78907,7 @@ var eventemitter3 = { exports: {} }; var evt = prefix ? prefix + event : event; if (!this._events[evt]) return false; - var listeners = this._events[evt], len = arguments.length, args, i2; + var listeners = this._events[evt], len = arguments.length, args, i; if (listeners.fn) { if (listeners.once) this.removeListener(event, listeners.fn, void 0, true); @@ -78911,34 +78925,34 @@ var eventemitter3 = { exports: {} }; case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; } - for (i2 = 1, args = new Array(len - 1); i2 < len; i2++) { - args[i2 - 1] = arguments[i2]; + for (i = 1, args = new Array(len - 1); i < len; i++) { + args[i - 1] = arguments[i]; } listeners.fn.apply(listeners.context, args); } else { var length = listeners.length, j2; - for (i2 = 0; i2 < length; i2++) { - if (listeners[i2].once) - this.removeListener(event, listeners[i2].fn, void 0, true); + for (i = 0; i < length; i++) { + if (listeners[i].once) + this.removeListener(event, listeners[i].fn, void 0, true); switch (len) { case 1: - listeners[i2].fn.call(listeners[i2].context); + listeners[i].fn.call(listeners[i].context); break; case 2: - listeners[i2].fn.call(listeners[i2].context, a1); + listeners[i].fn.call(listeners[i].context, a1); break; case 3: - listeners[i2].fn.call(listeners[i2].context, a1, a2); + listeners[i].fn.call(listeners[i].context, a1, a2); break; case 4: - listeners[i2].fn.call(listeners[i2].context, a1, a2, a3); + listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; default: if (!args) for (j2 = 1, args = new Array(len - 1); j2 < len; j2++) { args[j2 - 1] = arguments[j2]; } - listeners[i2].fn.apply(listeners[i2].context, args); + listeners[i].fn.apply(listeners[i].context, args); } } } @@ -78964,9 +78978,9 @@ var eventemitter3 = { exports: {} }; clearEvent(this, evt); } } else { - for (var i2 = 0, events = [], length = listeners.length; i2 < length; i2++) { - if (listeners[i2].fn !== fn || once && !listeners[i2].once || context2 && listeners[i2].context !== context2) { - events.push(listeners[i2]); + for (var i = 0, events = [], length = listeners.length; i < length; i++) { + if (listeners[i].fn !== fn || once && !listeners[i].once || context2 && listeners[i].context !== context2) { + events.push(listeners[i]); } } if (events.length) @@ -79728,7 +79742,7 @@ function uid(length = 11) { if (!buffer || index$1 + length > size$3 * 2) { buffer = ""; index$1 = 0; - for (let i2 = 0; i2 < size$3; i2++) { + for (let i = 0; i < size$3; i++) { buffer += (256 + Math.random() * 256 | 0).toString(16).substring(1); } } @@ -80214,13 +80228,13 @@ function deepEqual$1(a2, b2) { if (a2.constructor !== b2.constructor) return false; let length; - let i2; + let i; if (Array.isArray(a2) && Array.isArray(b2)) { length = a2.length; if (length !== b2.length) return false; - for (i2 = length; i2-- !== 0; ) - if (!deepEqual$1(a2[i2], b2[i2])) + for (i = length; i-- !== 0; ) + if (!deepEqual$1(a2[i], b2[i])) return false; return true; } @@ -80232,11 +80246,11 @@ function deepEqual$1(a2, b2) { length = keys.length; if (length !== Object.keys(b2).length) return false; - for (i2 = length; i2-- !== 0; ) - if (!Object.prototype.hasOwnProperty.call(b2, keys[i2])) + for (i = length; i-- !== 0; ) + if (!Object.prototype.hasOwnProperty.call(b2, keys[i])) return false; - for (i2 = length; i2-- !== 0; ) { - const key2 = keys[i2]; + for (i = length; i-- !== 0; ) { + const key2 = keys[i]; if (key2 && !deepEqual$1(a2[key2], b2[key2])) return false; } @@ -80930,8 +80944,8 @@ function replaceEqualDeep(a2, b2) { const bSize = bItems.length; const copy2 = array ? [] : {}; let equalItems = 0; - for (let i2 = 0; i2 < bSize; i2++) { - const key2 = array ? i2 : bItems[i2]; + for (let i = 0; i < bSize; i++) { + const key2 = array ? i : bItems[i]; if ((!array && aItems.includes(key2) || array) && a2[key2] === void 0 && b2[key2] === void 0) { copy2[key2] = void 0; equalItems++; @@ -82196,7 +82210,7 @@ function infiniteQueryBehavior(pages) { oldPageParams[0] ?? options.initialPageParam ); const remainingPages = pages ?? oldPages.length; - for (let i2 = 1; i2 < remainingPages; i2++) { + for (let i = 1; i < remainingPages; i++) { const param = getNextPageParam(options, result); result = await fetchPage(result, param); } @@ -83992,10 +84006,10 @@ var _excluded$4 = ["onSuccess", "onError", "skipScript", "authOptions", "iconPro function _interopRequireDefault$1(obj) { return obj && obj.__esModule ? obj : { default: obj }; } -function _extends$6() { - _extends$6 = Object.assign || function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; +function _extends$2() { + _extends$2 = Object.assign || function(target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; for (var key2 in source) { if (Object.prototype.hasOwnProperty.call(source, key2)) { target[key2] = source[key2]; @@ -84004,7 +84018,7 @@ function _extends$6() { } return target; }; - return _extends$6.apply(this, arguments); + return _extends$2.apply(this, arguments); } function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); @@ -84020,9 +84034,9 @@ function ownKeys$1(object, enumerableOnly) { return keys; } function _objectSpread$1(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2] != null ? arguments[i2] : {}; - if (i2 % 2) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i] != null ? arguments[i] : {}; + if (i % 2) { ownKeys$1(Object(source), true).forEach(function(key2) { _defineProperty$1(target, key2, source[key2]); }); @@ -84048,11 +84062,11 @@ function _objectWithoutProperties$1(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose$2(source, excluded); - var key2, i2; + var key2, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { - key2 = sourceSymbolKeys[i2]; + for (i = 0; i < sourceSymbolKeys.length; i++) { + key2 = sourceSymbolKeys[i]; if (excluded.indexOf(key2) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key2)) @@ -84067,9 +84081,9 @@ function _objectWithoutPropertiesLoose$2(source, excluded) { return {}; var target = {}; var sourceKeys = Object.keys(source); - var key2, i2; - for (i2 = 0; i2 < sourceKeys.length; i2++) { - key2 = sourceKeys[i2]; + var key2, i; + for (i = 0; i < sourceKeys.length; i++) { + key2 = sourceKeys[i]; if (excluded.indexOf(key2) >= 0) continue; target[key2] = source[key2]; @@ -84092,7 +84106,7 @@ var AppleSigninButton = function AppleSigninButton2(_ref) { }); }; var props = _objectSpread$1({ - children: /* @__PURE__ */ _react$1.default.createElement(_react$1.default.Fragment, null, /* @__PURE__ */ _react$1.default.createElement("svg", _extends$6({ + children: /* @__PURE__ */ _react$1.default.createElement(_react$1.default.Fragment, null, /* @__PURE__ */ _react$1.default.createElement("svg", _extends$2({ width: "24px", height: "44px", viewBox: "0 0 24 44" @@ -84117,7 +84131,7 @@ var AppleSigninButton = function AppleSigninButton2(_ref) { if (render) { return render(props); } - return /* @__PURE__ */ _react$1.default.createElement(_react$1.default.Fragment, null, /* @__PURE__ */ _react$1.default.createElement("button", _extends$6({ + return /* @__PURE__ */ _react$1.default.createElement(_react$1.default.Fragment, null, /* @__PURE__ */ _react$1.default.createElement("button", _extends$2({ className: "".concat(noDefaultStyle ? "" : "react-apple-signin-auth-btn react-apple-signin-auth-btn-".concat(uiType)).concat(className ? " ".concat(className) : ""), type: "button", "aria-label": "Signin with apple ID" @@ -84419,24 +84433,24 @@ const EmailConnectButton = (props) => { const getLogo = (theme, walletProps) => theme === "dark" ? walletProps.logoDark || walletProps.monochromeLogoDark : walletProps.logoLight || walletProps.monochromeLogoLight; const getNetworkColor = (chainId, mode = "light") => { switch (chainId) { - case ChainId$2.MAINNET: + case ChainId.MAINNET: return mode === "light" ? "#abf" : "#abf"; - case ChainId$2.POLYGON: + case ChainId.POLYGON: return mode === "light" ? "#c7a6ff" : "#c7a6ff"; - case ChainId$2.ARBITRUM: + case ChainId.ARBITRUM: return mode === "light" ? "#52A7E6" : "#52A7E6"; - case ChainId$2.OPTIMISM: + case ChainId.OPTIMISM: return mode === "light" ? "#DB3132" : "#DB3132"; - case ChainId$2.BSC: + case ChainId.BSC: return mode === "light" ? "#CB9C1D" : "#EEB445"; - case ChainId$2.AVALANCHE: + case ChainId.AVALANCHE: return mode === "light" ? "#E84142" : "#E84142"; - case ChainId$2.GNOSIS: + case ChainId.GNOSIS: return mode === "light" ? "#00193C" : "#D8E8FF"; - case ChainId$2.GOERLI: + case ChainId.GOERLI: return mode === "light" ? "#A77A00" : "#FFA700"; - case ChainId$2.POLYGON_MUMBAI: - case ChainId$2.POLYGON_AMOY: + case ChainId.POLYGON_MUMBAI: + case ChainId.POLYGON_AMOY: return mode === "light" ? "#D68828" : "#FFA700"; default: return mode === "light" ? "#abf" : "#abf"; @@ -84444,31 +84458,31 @@ const getNetworkColor = (chainId, mode = "light") => { }; const getNetworkBackgroundColor = (chainId, mode = "light") => { switch (chainId) { - case ChainId$2.MAINNET: + case ChainId.MAINNET: return mode === "light" ? "#132362" : "#132362"; - case ChainId$2.POLYGON: + case ChainId.POLYGON: return mode === "light" ? "#350881" : "#350881"; - case ChainId$2.ARBITRUM: + case ChainId.ARBITRUM: return mode === "light" ? "#EDF7FF" : "#0C3754"; - case ChainId$2.OPTIMISM: + case ChainId.OPTIMISM: return mode === "light" ? "#FFEAE9" : "#390B0C"; - case ChainId$2.BSC: + case ChainId.BSC: return mode === "light" ? "#FFE8AB" : "#554018"; - case ChainId$2.AVALANCHE: + case ChainId.AVALANCHE: return mode === "light" ? "#FBDFDF" : "#390B0C"; - case ChainId$2.GNOSIS: + case ChainId.GNOSIS: return mode === "light" ? "#D8E8FF" : "#00193C"; - case ChainId$2.GOERLI: + case ChainId.GOERLI: return mode === "light" ? "#FFD871" : "#554018"; - case ChainId$2.POLYGON_MUMBAI: - case ChainId$2.POLYGON_AMOY: + case ChainId.POLYGON_MUMBAI: + case ChainId.POLYGON_AMOY: return mode === "light" ? "#FFE8CD" : "#554018"; default: return mode === "light" ? "#132362" : "#132362"; } }; const getNetwork = (chainId) => { - const network2 = networks$3[chainId]; + const network2 = networks$1[chainId]; if (!network2) { throw new Error(`Unknown network chainId: ${chainId}`); } @@ -84506,7 +84520,7 @@ const useIndexerClient = (chainId) => { const indexerClients = reactExports.useMemo(() => { return /* @__PURE__ */ new Map(); }, [projectAccessKey2, isDev]); - const network2 = networks$3[chainId]; + const network2 = networks$1[chainId]; const clientUrl = isDev ? `https://dev-${network2.name}-indexer.sequence.app` : `https://${network2.name}-indexer.sequence.app`; if (!indexerClients.has(chainId)) { indexerClients.set(chainId, new SequenceIndexer(clientUrl, projectAccessKey2)); @@ -84525,7 +84539,7 @@ const useIndexerClients = (chainIds) => { }, [projectAccessKey2, isDev]); const result = /* @__PURE__ */ new Map(); for (const chainId of chainIds) { - const network2 = networks$3[chainId]; + const network2 = networks$1[chainId]; const clientUrl = isDev ? `https://dev-${network2.name}-indexer.sequence.app` : `https://${network2.name}-indexer.sequence.app`; if (!indexerClients.has(chainId)) { indexerClients.set(chainId, new SequenceIndexer(clientUrl, projectAccessKey2)); @@ -84777,7 +84791,7 @@ const useTransactionHistory = (args) => { }); }; const nativeTokenInfos = { - [ChainId$2.MAINNET]: { + [ChainId.MAINNET]: { name: "Ethereum", symbol: "ETH", logoURI: "https://assets.coingecko.com/coins/images/279/thumb/ethereum.png", @@ -84785,7 +84799,7 @@ const nativeTokenInfos = { blockExplorerName: "Etherscan", blockExplorerUrl: "https://etherscan.io" }, - [ChainId$2.GOERLI]: { + [ChainId.GOERLI]: { name: "Goerli", symbol: "ETH", decimals: 18, @@ -84793,7 +84807,7 @@ const nativeTokenInfos = { blockExplorerName: "Etherscan (Goerli)", blockExplorerUrl: "https://goerli.etherscan.io" }, - [ChainId$2.OPTIMISM]: { + [ChainId.OPTIMISM]: { name: "Optimism", symbol: "OP", logoURI: "https://assets.coingecko.com/coins/images/25244/small/Optimism.png", @@ -84801,7 +84815,7 @@ const nativeTokenInfos = { blockExplorerName: "Etherscan (Optimism)", blockExplorerUrl: "https://optimistic.etherscan.io" }, - [ChainId$2.BSC]: { + [ChainId.BSC]: { name: "BNB", symbol: "BNB", logoURI: "https://assets.coingecko.com/coins/images/825/thumb/bnb-icon2_2x.png", @@ -84809,7 +84823,7 @@ const nativeTokenInfos = { blockExplorerName: "BscScan", blockExplorerUrl: "https://bscscan.com" }, - [ChainId$2.GNOSIS]: { + [ChainId.GNOSIS]: { name: "Gnosis", symbol: "GNO", logoURI: "https://assets.coingecko.com/coins/images/662/small/logo_square_simple_300px.png", @@ -84817,7 +84831,7 @@ const nativeTokenInfos = { blockExplorerUrl: "https://gnosisscan.io", blockExplorerName: "Gnosis Scan" }, - [ChainId$2.POLYGON]: { + [ChainId.POLYGON]: { name: "Polygon", symbol: "MATIC", logoURI: "https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png", @@ -84825,7 +84839,7 @@ const nativeTokenInfos = { blockExplorerName: "Polyscan", blockExplorerUrl: "https://polygonscan.com" }, - [ChainId$2.POLYGON_ZKEVM]: { + [ChainId.POLYGON_ZKEVM]: { name: "Polygon zkEVM", symbol: "ETH", logoURI: "https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png", @@ -84833,7 +84847,7 @@ const nativeTokenInfos = { blockExplorerName: "PolygonScan", blockExplorerUrl: "https://zkevm.polygonscan.com" }, - [ChainId$2.ARBITRUM]: { + [ChainId.ARBITRUM]: { name: "Arbitrum", symbol: "ARB", logoURI: "https://assets.coingecko.com/asset_platforms/images/33/small/arbitrum-one.png", @@ -84841,7 +84855,7 @@ const nativeTokenInfos = { blockExplorerName: "Arbiscan", blockExplorerUrl: "https://arbiscan.io" }, - [ChainId$2.AVALANCHE]: { + [ChainId.AVALANCHE]: { name: "Avalanche", symbol: "AVAX", logoURI: "https://assets.coingecko.com/coins/images/12559/small/Avalanche_Circle_RedWhite_Trans.png", @@ -84849,7 +84863,7 @@ const nativeTokenInfos = { blockExplorerName: "Snowtrace", blockExplorerUrl: "https://snowtrace.io" }, - [ChainId$2.POLYGON_MUMBAI]: { + [ChainId.POLYGON_MUMBAI]: { name: "Mumbai", symbol: "MATIC", logoURI: "https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png", @@ -84857,7 +84871,7 @@ const nativeTokenInfos = { blockExplorerName: "Polyscan (Mumbai)", blockExplorerUrl: "https://mumbai.polygonscan.com" }, - [ChainId$2.POLYGON_AMOY]: { + [ChainId.POLYGON_AMOY]: { name: "Amoy", symbol: "MATIC", logoURI: "https://assets.coingecko.com/coins/images/4713/thumb/matic-token-icon.png", @@ -84874,7 +84888,7 @@ const defaultNativeTokenInfo = (chainId, wagmiChains) => { name: foundChain.nativeCurrency.name, symbol: foundChain.nativeCurrency.symbol, decimals: foundChain.nativeCurrency.decimals, - logoURI: nativeTokenInfos[ChainId$2.MAINNET].logoURI, + logoURI: nativeTokenInfos[ChainId.MAINNET].logoURI, blockExplorerName: (_a2 = foundChain.blockExplorers) == null ? void 0 : _a2.default.name, blockExplorerUrl: (_b2 = foundChain.blockExplorers) == null ? void 0 : _b2.default.url }; @@ -84882,7 +84896,7 @@ const defaultNativeTokenInfo = (chainId, wagmiChains) => { return; }; const getNativeTokenInfoByChainId = (chainId, wagmiChains) => { - return nativeTokenInfos[chainId] || defaultNativeTokenInfo(chainId, wagmiChains) || nativeTokenInfos[ChainId$2.MAINNET]; + return nativeTokenInfos[chainId] || defaultNativeTokenInfo(chainId, wagmiChains) || nativeTokenInfos[ChainId.MAINNET]; }; var utils = {}; const require$$0$2 = /* @__PURE__ */ getAugmentedNamespace(lib_esm$b); @@ -85265,8 +85279,8 @@ var DecodingType; DecodingType2["UNKNOWN"] = "unknown"; })(DecodingType || (DecodingType = {})); const transformArgs = (args) => { - return Object.fromEntries(args.map((arg, i2) => [ - arg.name && !arg.name.startsWith("unnamed") ? arg.name : `_${i2}`, + return Object.fromEntries(args.map((arg, i) => [ + arg.name && !arg.name.startsWith("unnamed") ? arg.name : `_${i}`, Array.isArray(arg.value) ? arg.type.startsWith("(") && (arg.type.endsWith(")") || arg.type.endsWith(")[]")) ? transformArgs(arg.value) : arg.value : arg.value ])); }; @@ -85361,8 +85375,8 @@ const decodeTransactions = async (apiClient, accountAddress, txns) => { const encodedTxns = encodeTransactions(txns); const decodedTxnDatas = (await decodeTxnData(apiClient, encodedTxns)).objs; const from = utils.getAddress(accountAddress); - const txnProps = encodedTxns.map((txn, i2) => { - const decodedTxnData = decodedTxnDatas[i2]; + const txnProps = encodedTxns.map((txn, i) => { + const decodedTxnData = decodedTxnDatas[i]; const data = txn.data.toString(); const value = BigNumber.from(txn.value).toString(); const target = txn.target; @@ -85796,7 +85810,7 @@ const KitProvider = (props) => { rejectPendingRequest(""); }, children: jsxRuntimeExports$1.jsxs(Box, { paddingX: "4", paddingTop: "4", paddingBottom: "2", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", justifyContent: "center", color: "text100", alignItems: "center", fontWeight: "medium", style: { marginTop: "4px" - }, children: [jsxRuntimeExports$1.jsxs(Text, { as: "h1", variant: "large", marginBottom: "5", children: ["Confirm ", pendingRequestConfirmation.type === "signMessage" ? "signing message" : "transaction"] }), pendingRequestConfirmation.type === "signMessage" && jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", width: "full", children: [jsxRuntimeExports$1.jsx(Text, { fontSize: "normal", color: "text50", children: "Message" }), jsxRuntimeExports$1.jsx(Card, { marginTop: "2", paddingY: "6", children: jsxRuntimeExports$1.jsx(Text, { variant: "normal", marginBottom: "4", children: toUtf8String(pendingRequestConfirmation.message ?? "") }) })] }), pendingRequestConfirmation.type === "signTransaction" && jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", width: "full", children: [jsxRuntimeExports$1.jsx(TxnDetails, { address: address ?? "", txs: pendingRequestConfirmation.txs ?? [], chainId: pendingRequestConfirmation.chainId ?? ChainId$2.POLYGON }), jsxRuntimeExports$1.jsx(Collapsible, { label: "Transaction data", marginTop: "4", children: jsxRuntimeExports$1.jsx(Card, { overflowX: "scroll", marginY: "3", children: jsxRuntimeExports$1.jsx(Text, { variant: "code", marginBottom: "4", children: JSON.stringify(pendingRequestConfirmation.txs, null, 2) }) }) })] }), pendingRequestConfirmation.chainId && jsxRuntimeExports$1.jsxs(Box, { width: "full", marginTop: "3", justifyContent: "flex-end", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Box, { width: "1/2", justifyContent: "flex-start", children: jsxRuntimeExports$1.jsx(Text, { variant: "small", color: "text50", children: "Network" }) }), jsxRuntimeExports$1.jsx(Box, { width: "1/2", justifyContent: "flex-end", children: jsxRuntimeExports$1.jsx(NetworkBadge$1, { chainId: pendingRequestConfirmation.chainId }) })] }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", gap: "2", width: "full", marginTop: "5", children: [jsxRuntimeExports$1.jsx(Button, { width: "full", shape: "square", size: "lg", label: "Reject", onClick: () => { + }, children: [jsxRuntimeExports$1.jsxs(Text, { as: "h1", variant: "large", marginBottom: "5", children: ["Confirm ", pendingRequestConfirmation.type === "signMessage" ? "signing message" : "transaction"] }), pendingRequestConfirmation.type === "signMessage" && jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", width: "full", children: [jsxRuntimeExports$1.jsx(Text, { fontSize: "normal", color: "text50", children: "Message" }), jsxRuntimeExports$1.jsx(Card, { marginTop: "2", paddingY: "6", children: jsxRuntimeExports$1.jsx(Text, { variant: "normal", marginBottom: "4", children: toUtf8String(pendingRequestConfirmation.message ?? "") }) })] }), pendingRequestConfirmation.type === "signTransaction" && jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", width: "full", children: [jsxRuntimeExports$1.jsx(TxnDetails, { address: address ?? "", txs: pendingRequestConfirmation.txs ?? [], chainId: pendingRequestConfirmation.chainId ?? ChainId.POLYGON }), jsxRuntimeExports$1.jsx(Collapsible, { label: "Transaction data", marginTop: "4", children: jsxRuntimeExports$1.jsx(Card, { overflowX: "scroll", marginY: "3", children: jsxRuntimeExports$1.jsx(Text, { variant: "code", marginBottom: "4", children: JSON.stringify(pendingRequestConfirmation.txs, null, 2) }) }) })] }), pendingRequestConfirmation.chainId && jsxRuntimeExports$1.jsxs(Box, { width: "full", marginTop: "3", justifyContent: "flex-end", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Box, { width: "1/2", justifyContent: "flex-start", children: jsxRuntimeExports$1.jsx(Text, { variant: "small", color: "text50", children: "Network" }) }), jsxRuntimeExports$1.jsx(Box, { width: "1/2", justifyContent: "flex-end", children: jsxRuntimeExports$1.jsx(NetworkBadge$1, { chainId: pendingRequestConfirmation.chainId }) })] }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", gap: "2", width: "full", marginTop: "5", children: [jsxRuntimeExports$1.jsx(Button, { width: "full", shape: "square", size: "lg", label: "Reject", onClick: () => { rejectPendingRequest(pendingRequestConfirmation == null ? void 0 : pendingRequestConfirmation.id); } }), jsxRuntimeExports$1.jsx(Button, { alignItems: "center", textAlign: "center", width: "full", shape: "square", size: "lg", label: "Confirm", variant: "primary", onClick: () => { confirmPendingRequest(pendingRequestConfirmation == null ? void 0 : pendingRequestConfirmation.id); @@ -85877,23756 +85891,22364 @@ const validateEthProof = async (walletClient, publicClient, proof) => { const isValid2 = await sequence$1.utils.isValidTypedDataSignature(walletAddress, proof.typedData, decodedProof.signature, provider2); return isValid2; }; -const useOpenConnectModal = () => { - const { setOpenConnectModal, openConnectModalState } = useConnectModalContext(); - return { setOpenConnectModal, openConnectModalState }; -}; -const useTheme = () => { - const { setTheme, theme, position, setPosition } = useThemeContext(); - return { - setTheme, - theme, - position, - setPosition - }; -}; -const useWalletSettings = () => { - const { setDisplayedAssets, displayedAssets } = useWalletConfigContext(); - return { - displayedAssets, - setDisplayedAssets - }; -}; -let _pendingFeeConfirmation; -function useWaasFeeOptions() { - var _a2; - const connections = useConnections(); - const waasConnector = (_a2 = connections.find((c2) => c2.connector.id.includes("waas"))) == null ? void 0 : _a2.connector; - const [pendingFeeOptionConfirmation, setPendingFeeOptionConfirmation] = reactExports.useState(); - function confirmPendingFeeOption(id2, feeTokenAddress) { - _pendingFeeConfirmation == null ? void 0 : _pendingFeeConfirmation.resolve({ id: id2, feeTokenAddress, confirmed: true }); - setPendingFeeOptionConfirmation(void 0); - _pendingFeeConfirmation = void 0; - } - function rejectPendingFeeOption(id2) { - _pendingFeeConfirmation == null ? void 0 : _pendingFeeConfirmation.resolve({ id: id2, feeTokenAddress: void 0, confirmed: false }); - setPendingFeeOptionConfirmation(void 0); - _pendingFeeConfirmation = void 0; - } - reactExports.useEffect(() => { - async function setup() { - if (!waasConnector) { - return; - } - const waasProvider = waasConnector.sequenceWaasProvider; - if (!waasProvider) { - return; +sequenceWallet.type = "sequence"; +function sequenceWallet(params) { + const { defaultNetwork, connect: connect2, walletAppURL } = params; + const { projectAccessKey: projectAccessKey2 } = connect2; + return createConnector((config2) => ({ + id: "sequence", + name: "Sequence", + type: sequenceWallet.type, + params, + setEmail(email2) { + if (params.connect.settings) { + params.connect.settings.signInWithEmail = email2; } - waasProvider.feeConfirmationHandler = { - confirmFeeOption(id2, options, txs, chainId) { - const pending = new Deferred(); - setPendingFeeOptionConfirmation({ id: id2, options, chainId }); - _pendingFeeConfirmation = pending; - return pending.promise; + }, + async setup() { + const provider2 = await this.getProvider(); + provider2.on("chainChanged", (chainIdHex) => { + config2.emitter.emit("change", { chainId: normalizeChainId$1(chainIdHex) }); + }); + provider2.on("disconnect", () => { + this.onDisconnect(); + }); + }, + async connect() { + var _a2, _b2, _c2, _d2, _e2; + const provider2 = await this.getProvider(); + if (!provider2.isConnected()) { + const localStorageTheme = await ((_a2 = config2.storage) == null ? void 0 : _a2.getItem(LocalStorageKey.Theme)); + const ethAuthSettings = await ((_b2 = config2.storage) == null ? void 0 : _b2.getItem(LocalStorageKey.EthAuthSettings)) ?? {}; + const connectOptionsWithTheme = { + authorize: true, + ...ethAuthSettings, + ...connect2, + settings: { + theme: localStorageTheme || "dark", + ...connect2 == null ? void 0 : connect2.settings + } + }; + const e2 = await provider2.connect(connectOptionsWithTheme); + if (e2.error) { + throw new UserRejectedRequestError(new Error(e2.error)); } + if (!e2.connected) { + throw new UserRejectedRequestError(new Error("Wallet connection rejected")); + } + const proofString = (_c2 = e2.proof) == null ? void 0 : _c2.proofString; + const proofTypedData = (_d2 = e2.proof) == null ? void 0 : _d2.typedData; + if (proofString && proofTypedData) { + const jsonEthAuthProof = { + proofString, + typedData: proofTypedData + }; + await ((_e2 = config2.storage) == null ? void 0 : _e2.setItem(LocalStorageKey.EthAuthProof, jsonEthAuthProof)); + } + } + const accounts = await this.getAccounts(); + return { + accounts: [...accounts], + chainId: provider2.getChainId() }; - } - setup(); - }); - return [pendingFeeOptionConfirmation, confirmPendingFeeOption, rejectPendingFeeOption]; -} -const createGenericContext$1 = () => { - const genericContext = reactExports.createContext(void 0); - const useGenericContext = () => { - const contextIsDefined = reactExports.useContext(genericContext); - if (!contextIsDefined) { - throw new Error("useGenericContext must be used within a Provider"); - } - return contextIsDefined; - }; - return [useGenericContext, genericContext.Provider]; -}; -const [useAddFundsModalContext, AddFundsContextProvider] = createGenericContext$1(); -const [useCheckoutModalContext, CheckoutModalContextProvider] = createGenericContext$1(); -const [useNavigationContext$1, NavigationContextProvider$1] = createGenericContext$1(); -const HEADER_HEIGHT$1 = "54px"; -const useNavigation$1 = () => { - const { setHistory, history, defaultLocation } = useNavigationContext$1(); - const setNavigation = (navigation2) => { - const childElement = document.getElementById("sequence-kit-wallet-content"); - const parentElement = childElement == null ? void 0 : childElement.parentElement; - parentElement == null ? void 0 : parentElement.scrollTo(0, 0); - const newHistory = [...history, navigation2]; - setHistory(newHistory); - }; - const goBack = () => { - const newHistory = [...history]; - newHistory.pop(); - setHistory(newHistory); - }; - const navigation = history.length > 0 ? history[history.length - 1] : defaultLocation; - return { setNavigation, history, setHistory, goBack, navigation }; -}; -const NavigationHeader$1 = ({ secondaryText, primaryText, disableBack = false }) => { - const { goBack, history } = useNavigation$1(); - const onClickBack = () => { - goBack(); - }; - return jsxRuntimeExports$1.jsxs(Box, { background: "backgroundPrimary", zIndex: "20", position: "fixed", width: "full", flexDirection: "row", alignItems: "center", justifyContent: "space-between", style: { - height: HEADER_HEIGHT$1, - paddingTop: "6px", - backgroundColor: vars.colors.backgroundPrimary - }, children: [history.length > 0 && !disableBack ? jsxRuntimeExports$1.jsx(IconButton, { onClick: onClickBack, icon: SvgChevronLeftIcon, size: "sm", style: { - background: "rgba(0,0,0,0)", - width: "44px" - } }) : jsxRuntimeExports$1.jsx(Box, {}), jsxRuntimeExports$1.jsxs(Box, { width: "full", alignItems: "center", justifyContent: "center", style: { marginLeft: "40px" }, children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", variant: "small", color: "text50", children: secondaryText }), jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", variant: "small", color: "text100", children: primaryText })] }), jsxRuntimeExports$1.jsx(Box, { style: { - width: "44px" - } })] }); -}; -const fetchSardineClientToken = async ({ order, isDev, projectAccessKey: projectAccessKey2, tokenMetadata }) => { - const accessKey = isDev ? "17xhjK4yjRf1fr0am8kgKfICAAAAAAAAA" : projectAccessKey2; - const url = isDev ? "https://dev-api.sequence.app/rpc/API/GetSardineNFTCheckoutToken" : "https://api.sequence.app/rpc/API/GetSardineNFTCheckoutToken"; - const res = await fetch(url, { - method: "POST", - headers: { - "Content-Type": "application/json", - "X-Access-Key": `${accessKey || ""}` }, - body: JSON.stringify({ - params: { - name: (tokenMetadata == null ? void 0 : tokenMetadata.name) || "Unknown", - imageUrl: (tokenMetadata == null ? void 0 : tokenMetadata.image) || "https://sequence.market/images/placeholder.png", - network: networks$3[order.chainId].name, - recipientAddress: order.recipientAddress, - contractAddress: order.contractAddress, - platform: "calldata_execution", - blockchainNftId: order.nftId, - quantity: Number(order.nftQuantity), - decimals: Number((order == null ? void 0 : order.nftDecimals) || 0), - tokenAmount: order.currencyQuantity, - tokenAddress: order.currencyAddress, - tokenSymbol: order.currencySymbol, - tokenDecimals: Number(order.currencyDecimals), - callData: order.calldata, - ...(order == null ? void 0 : order.approvedSpenderAddress) ? { approvedSpenderAddress: order.approvedSpenderAddress } : {} + async disconnect() { + const provider2 = await this.getProvider(); + provider2.disconnect(); + }, + async getAccounts() { + const provider2 = await this.getProvider(); + const signer2 = provider2.getSigner(); + const account2 = getAddress(await signer2.getAddress()); + return [account2]; + }, + async getProvider() { + try { + const provider2 = sequence$1.getWallet(); + return provider2; + } catch (err) { + if (!projectAccessKey2) { + throw "projectAccessKey not found"; + } + const provider2 = sequence$1.initWallet(projectAccessKey2, { + defaultNetwork, + transports: { + walletAppURL: walletAppURL || "https://sequence.app" + }, + defaultEIP6492: true, + analytics: false + }); + const chainId = provider2.getChainId(); + config2.emitter.emit("change", { chainId: normalizeChainId$1(chainId) }); + return provider2; } - }) - }); - const { resp: { orderId, token } } = await res.json(); - return { - token, - orderId - }; -}; -const fetchSardineOrderStatus = async (orderId, isDev, projectAccessKey2) => { - const accessKey = isDev ? "17xhjK4yjRf1fr0am8kgKfICAAAAAAAAA" : projectAccessKey2; - const url = isDev ? "https://dev-api.sequence.app/rpc/API/GetSardineNFTCheckoutOrderStatus" : "https://api.sequence.app/rpc/API/GetSardineNFTCheckoutOrderStatus"; - const response = await fetch(url, { - method: "POST", - headers: { - "Content-Type": "application/json", - "X-Access-Key": `${accessKey}` }, - body: JSON.stringify({ - orderId - }) - }); - const json = await response.json(); - console.log("json:", json); - return json; -}; -const useAddFundsModal = () => { - const { triggerAddFunds, closeAddFunds, addFundsSettings } = useAddFundsModalContext(); - return { triggerAddFunds, closeAddFunds, addFundsSettings }; -}; -const useCheckoutModal = () => { - const { triggerCheckout, closeCheckout, settings } = useCheckoutModalContext(); - return { triggerCheckout, closeCheckout, settings }; -}; -const compareAddress$1 = (a2, b2) => { - return a2.toLowerCase() === b2.toLowerCase(); -}; -var ValueType$1; -(function(ValueType2) { - ValueType2[ValueType2["VERY_LARGE"] = 0] = "VERY_LARGE"; - ValueType2[ValueType2["FRACTION"] = 1] = "FRACTION"; - ValueType2[ValueType2["VERY_TINY"] = 2] = "VERY_TINY"; - ValueType2[ValueType2["MIXED"] = 3] = "MIXED"; -})(ValueType$1 || (ValueType$1 = {})); -const formatDisplay$1 = (_val) => { - if (isNaN(Number(_val))) { - console.error(`display format error ${_val} is not a number`); - return "NaN"; - } - const val = Number(_val); - if (val === 0) { - return "0"; + async isAuthorized() { + try { + const account2 = await this.getAccounts(); + return !!account2; + } catch (e2) { + return false; + } + }, + async switchChain({ chainId }) { + const provider2 = await this.getProvider(); + const chain = config2.chains.find((c2) => c2.id === chainId) || config2.chains[0]; + provider2.setDefaultChainId(normalizeChainId$1(chainId)); + config2.emitter.emit("change", { chainId }); + return chain; + }, + async getChainId() { + const provider2 = await this.getProvider(); + const chainId = provider2.getChainId(); + return chainId; + }, + async onAccountsChanged(accounts) { + return { account: accounts[0] }; + }, + async onChainChanged(chain) { + const provider2 = await this.getProvider(); + config2.emitter.emit("change", { chainId: normalizeChainId$1(chain) }); + provider2.setDefaultChainId(normalizeChainId$1(chain)); + }, + async onConnect(_connectinfo) { + }, + async onDisconnect() { + var _a2; + await ((_a2 = config2.storage) == null ? void 0 : _a2.removeItem(LocalStorageKey.EthAuthProof)); + config2.emitter.emit("disconnect"); + } + })); +} +function normalizeChainId$1(chainId) { + if (typeof chainId === "object") + return normalizeChainId$1(chainId.chainId); + if (typeof chainId === "string") + return Number.parseInt(chainId, chainId.trim().substring(0, 2) === "0x" ? 16 : 10); + if (typeof chainId === "bigint") + return Number(chainId); + return chainId; +} +function canonicalize(obj) { + var buffer2 = ""; + serialize2(obj); + return buffer2; + function serialize2(object) { + if (object === null || typeof object !== "object" || object.toJSON != null) { + buffer2 += JSON.stringify(object); + } else if (Array.isArray(object)) { + buffer2 += "["; + var next_1 = false; + object.forEach(function(element) { + if (next_1) { + buffer2 += ","; + } + next_1 = true; + if (element === void 0) { + element = null; + } + serialize2(element); + }); + buffer2 += "]"; + } else { + buffer2 += "{"; + var vKeys = Object.keys(object).filter(function(k2) { + return object[k2] !== void 0; + }).sort(); + vKeys.forEach(function(property, index2) { + return addProp(object, property, index2); + }); + buffer2 += "}"; + } } - let valMode; - if (val > 1e8) { - valMode = ValueType$1.VERY_LARGE; - } else if (val < 1e-10) { - valMode = ValueType$1.VERY_TINY; - } else if (val < 1) { - valMode = ValueType$1.FRACTION; - } else { - valMode = ValueType$1.MIXED; + function addProp(object, property, index2) { + if (index2 > 0) { + buffer2 += ","; + } + buffer2 += JSON.stringify(property); + buffer2 += ":"; + serialize2(object[property]); } - let notation = void 0; - let config2; - switch (valMode) { - case ValueType$1.VERY_LARGE: - notation = "compact"; - config2 = { - maximumFractionDigits: 4 - }; +} +class InvalidTokenError extends Error { +} +InvalidTokenError.prototype.name = "InvalidTokenError"; +function b64DecodeUnicode(str) { + return decodeURIComponent(atob(str).replace(/(.)/g, (m2, p2) => { + let code2 = p2.charCodeAt(0).toString(16).toUpperCase(); + if (code2.length < 2) { + code2 = "0" + code2; + } + return "%" + code2; + })); +} +function base64UrlDecode(str) { + let output2 = str.replace(/-/g, "+").replace(/_/g, "/"); + switch (output2.length % 4) { + case 0: break; - case ValueType$1.VERY_TINY: - notation = "scientific"; - config2 = { - maximumFractionDigits: 4 - }; + case 2: + output2 += "=="; break; - case ValueType$1.FRACTION: - notation = "standard"; - config2 = { - maximumSignificantDigits: 4 - }; + case 3: + output2 += "="; break; default: - notation = "standard"; - config2 = { - maximumFractionDigits: 2 - }; + throw new Error("base64 string is not of the correct length"); } - return Intl.NumberFormat("en-US", { - notation, - ...config2 - }).format(val); -}; -const useSardineClientToken = (args, disabled) => { - return useQuery$1({ - queryKey: ["useSardineClientToken", args], - queryFn: async () => { - const res = await fetchSardineClientToken(args); - return res; + try { + return b64DecodeUnicode(output2); + } catch (err) { + return atob(output2); + } +} +function jwtDecode(token, options) { + if (typeof token !== "string") { + throw new InvalidTokenError("Invalid token specified: must be a string"); + } + options || (options = {}); + const pos = options.header === true ? 0 : 1; + const part = token.split(".")[pos]; + if (typeof part !== "string") { + throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`); + } + let decoded; + try { + decoded = base64UrlDecode(part); + } catch (e2) { + throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e2.message})`); + } + try { + return JSON.parse(decoded); + } catch (e2) { + throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e2.message})`); + } +} +const getHttpHandlerExtensionConfiguration = (runtimeConfig) => { + let httpHandler = runtimeConfig.httpHandler; + return { + setHttpHandler(handler) { + httpHandler = handler; }, - retry: false, - staleTime: 0, - enabled: !disabled, - refetchOnWindowFocus: false - }); + httpHandler() { + return httpHandler; + }, + updateHttpClientConfig(key2, value) { + httpHandler.updateHttpClientConfig(key2, value); + }, + httpHandlerConfigs() { + return httpHandler.httpHandlerConfigs(); + } + }; }; -const POLLING_TIME = 10 * 1e3; -const PendingTransaction = () => { - var _a2; - const nav = useNavigation$1(); - const { settings } = useCheckoutModal(); - const { params: { creditCardCheckout } } = nav.navigation; - const { setNavigation } = nav; - const projectAccessKey2 = useProjectAccessKey(); - const { data: tokensMetadata, isLoading: isLoadingTokenMetadata } = useTokenMetadata(creditCardCheckout.chainId, creditCardCheckout.nftAddress, [creditCardCheckout.nftId]); - const tokenMetadata = tokensMetadata ? tokensMetadata[0] : void 0; - const isDev = ((_a2 = settings == null ? void 0 : settings.creditCardCheckout) == null ? void 0 : _a2.isDev) || false; - const disableSardineClientTokenFetch = isLoadingTokenMetadata; - const { data, isLoading, isError } = useSardineClientToken({ - order: creditCardCheckout, - isDev, - projectAccessKey: projectAccessKey2, - tokenMetadata - }, disableSardineClientTokenFetch); - const authToken = data == null ? void 0 : data.token; - const url = isDev ? `https://crypto.sandbox.sardine.ai/?client_token=${authToken}&show_features=true` : `https://crypto.sardine.ai/?client_token=${authToken}&show_features=true`; - const pollForOrderStatus = async () => { - var _a3; - try { - if (!data) { - return; - } - const { orderId } = data; - console.log("Polling for transaction status"); - const isDev2 = (creditCardCheckout == null ? void 0 : creditCardCheckout.isDev) || false; - const pollResponse = await fetchSardineOrderStatus(orderId, isDev2, projectAccessKey2); - const status = pollResponse.resp.status; - const transactionHash = (_a3 = pollResponse.resp) == null ? void 0 : _a3.transactionHash; - console.log("transaction status poll response:", status); - if (status === "Draft") { - return; - } - if (status === "Complete") { - setNavigation && setNavigation({ - location: "transaction-success", - params: { - transactionHash - } - }); - return; - } - if (status === "Declined" || status === "Cancelled") { - setNavigation && setNavigation({ - location: "transaction-error", - params: { - error: new Error("Failed to transfer collectible") - } - }); - return; - } - } catch (e2) { - console.error("An error occurred while fetching the transaction status"); - setNavigation && setNavigation({ - location: "transaction-error", - params: { - error: e2 - } - }); - } +const resolveHttpHandlerRuntimeConfig = (httpHandlerExtensionConfiguration) => { + return { + httpHandler: httpHandlerExtensionConfiguration.httpHandler() }; - reactExports.useEffect(() => { - const interval = setInterval(() => { - pollForOrderStatus(); - }, POLLING_TIME); - return () => { - clearInterval(interval); +}; +var HttpAuthLocation; +(function(HttpAuthLocation2) { + HttpAuthLocation2["HEADER"] = "header"; + HttpAuthLocation2["QUERY"] = "query"; +})(HttpAuthLocation || (HttpAuthLocation = {})); +var HttpApiKeyAuthLocation; +(function(HttpApiKeyAuthLocation2) { + HttpApiKeyAuthLocation2["HEADER"] = "header"; + HttpApiKeyAuthLocation2["QUERY"] = "query"; +})(HttpApiKeyAuthLocation || (HttpApiKeyAuthLocation = {})); +var EndpointURLScheme; +(function(EndpointURLScheme2) { + EndpointURLScheme2["HTTP"] = "http"; + EndpointURLScheme2["HTTPS"] = "https"; +})(EndpointURLScheme || (EndpointURLScheme = {})); +var AlgorithmId; +(function(AlgorithmId2) { + AlgorithmId2["MD5"] = "md5"; + AlgorithmId2["CRC32"] = "crc32"; + AlgorithmId2["CRC32C"] = "crc32c"; + AlgorithmId2["SHA1"] = "sha1"; + AlgorithmId2["SHA256"] = "sha256"; +})(AlgorithmId || (AlgorithmId = {})); +var FieldPosition; +(function(FieldPosition2) { + FieldPosition2[FieldPosition2["HEADER"] = 0] = "HEADER"; + FieldPosition2[FieldPosition2["TRAILER"] = 1] = "TRAILER"; +})(FieldPosition || (FieldPosition = {})); +const SMITHY_CONTEXT_KEY = "__smithy_context"; +var IniSectionType; +(function(IniSectionType2) { + IniSectionType2["PROFILE"] = "profile"; + IniSectionType2["SSO_SESSION"] = "sso-session"; + IniSectionType2["SERVICES"] = "services"; +})(IniSectionType || (IniSectionType = {})); +var RequestHandlerProtocol; +(function(RequestHandlerProtocol2) { + RequestHandlerProtocol2["HTTP_0_9"] = "http/0.9"; + RequestHandlerProtocol2["HTTP_1_0"] = "http/1.0"; + RequestHandlerProtocol2["TDS_8_0"] = "tds/8.0"; +})(RequestHandlerProtocol || (RequestHandlerProtocol = {})); +class HttpRequest { + constructor(options) { + this.method = options.method || "GET"; + this.hostname = options.hostname || "localhost"; + this.port = options.port; + this.query = options.query || {}; + this.headers = options.headers || {}; + this.body = options.body; + this.protocol = options.protocol ? options.protocol.slice(-1) !== ":" ? `${options.protocol}:` : options.protocol : "https:"; + this.path = options.path ? options.path.charAt(0) !== "/" ? `/${options.path}` : options.path : "/"; + this.username = options.username; + this.password = options.password; + this.fragment = options.fragment; + } + static isInstance(request) { + if (!request) + return false; + const req = request; + return "method" in req && "protocol" in req && "hostname" in req && "path" in req && typeof req["query"] === "object" && typeof req["headers"] === "object"; + } + clone() { + const cloned = new HttpRequest({ + ...this, + headers: { ...this.headers } + }); + if (cloned.query) + cloned.query = cloneQuery$1(cloned.query); + return cloned; + } +} +function cloneQuery$1(query) { + return Object.keys(query).reduce((carry, paramName) => { + const param = query[paramName]; + return { + ...carry, + [paramName]: Array.isArray(param) ? [...param] : param }; - }, []); - if (isError) { - return jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", justifyContent: "center", alignItems: "center", gap: "6", style: { - height: "500px", - width: "380px" - }, children: jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(Text, { color: "text100", children: "An error has occurred" }) }) }); + }, {}); +} +class HttpResponse { + constructor(options) { + this.statusCode = options.statusCode; + this.reason = options.reason; + this.headers = options.headers || {}; + this.body = options.body; } - if (isLoading || !authToken) { - return jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", justifyContent: "center", alignItems: "center", gap: "6", style: { - height: "500px", - width: "380px" - }, children: jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(Spinner, { size: "lg" }) }) }); + static isInstance(response) { + if (!response) + return false; + const resp = response; + return typeof resp.statusCode === "number" && typeof resp.headers === "object"; } - return jsxRuntimeExports$1.jsx(Box, { alignItems: "center", justifyContent: "center", style: { height: "620px" }, children: jsxRuntimeExports$1.jsx("iframe", { src: url, style: { - maxHeight: "500px", - height: "100%", - maxWidth: "380px", - width: "100%" - } }) }); -}; -const TransactionSuccess = () => { - var _a2, _b2, _c2; - const { settings } = useCheckoutModal(); - const nav = useNavigation$1(); - const navigation = nav.navigation; - const chainId = ((_a2 = settings == null ? void 0 : settings.creditCardCheckout) == null ? void 0 : _a2.chainId) || ChainId$2.POLYGON; - const network2 = sequence$1.network.allNetworks.find((n2) => n2.chainId === chainId); - reactExports.useEffect(() => { - var _a3, _b3, _c3, _d2; - ((_a3 = settings == null ? void 0 : settings.creditCardCheckout) == null ? void 0 : _a3.onSuccess) && ((_b3 = settings == null ? void 0 : settings.creditCardCheckout) == null ? void 0 : _b3.onSuccess(navigation.params.transactionHash, settings == null ? void 0 : settings.creditCardCheckout)); - ((_c3 = settings == null ? void 0 : settings.creditCardCheckout) == null ? void 0 : _c3.onSuccess) && ((_d2 = settings == null ? void 0 : settings.creditCardCheckout) == null ? void 0 : _d2.onSuccess(navigation.params.transactionHash, settings == null ? void 0 : settings.creditCardCheckout)); - }, []); - return jsxRuntimeExports$1.jsx(Box, { style: { height: "500px" }, children: jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", alignItems: "center", position: "absolute", style: { top: "50%", right: "50%", transform: "translate(50%, -50%)" }, children: [jsxRuntimeExports$1.jsx(NotificationSuccessIcon, {}), jsxRuntimeExports$1.jsx(Text, { fontSize: "xlarge", children: "Success!" }), jsxRuntimeExports$1.jsx(Text, { textAlign: "center", variant: "normal", color: "text80", children: "Purchase was successful, item was sent to your wallet." }), navigation.params.transactionHash && jsxRuntimeExports$1.jsxs(Text, { as: "a", variant: "small", underline: true, marginTop: "6", color: "text100", href: `${(_b2 = network2 == null ? void 0 : network2.blockExplorer) == null ? void 0 : _b2.rootUrl}/tx/${navigation.params.transactionHash}`, target: "_blank", rel: "noreferrer", children: ["View on ", (_c2 = network2 == null ? void 0 : network2.blockExplorer) == null ? void 0 : _c2.name] })] }) }); +} +function resolveHostHeaderConfig(input2) { + return input2; +} +const hostHeaderMiddleware = (options) => (next) => async (args) => { + if (!HttpRequest.isInstance(args.request)) + return next(args); + const { request } = args; + const { handlerProtocol = "" } = options.requestHandler.metadata || {}; + if (handlerProtocol.indexOf("h2") >= 0 && !request.headers[":authority"]) { + delete request.headers["host"]; + request.headers[":authority"] = request.hostname + (request.port ? ":" + request.port : ""); + } else if (!request.headers["host"]) { + let host = request.hostname; + if (request.port != null) + host += `:${request.port}`; + request.headers["host"] = host; + } + return next(args); }; -const NotificationSuccessIcon = () => jsxRuntimeExports$1.jsx(Box, { color: "white", background: "positive", alignItems: "center", justifyContent: "center", width: "16", height: "16", borderRadius: "circle", marginBottom: "2", children: jsxRuntimeExports$1.jsx(SvgCheckmarkIcon, { size: "xl" }) }); -const TransactionError = () => { - const { closeCheckout, settings } = useCheckoutModal(); - const nav = useNavigation$1(); - const navigation = nav.navigation; - reactExports.useEffect(() => { - setTimeout(() => { - var _a2, _b2; - closeCheckout(); - ((_a2 = settings == null ? void 0 : settings.creditCardCheckout) == null ? void 0 : _a2.onError) && ((_b2 = settings == null ? void 0 : settings.creditCardCheckout) == null ? void 0 : _b2.onError(navigation.params.error, settings == null ? void 0 : settings.creditCardCheckout)); - }, 3e3); - }, []); - return jsxRuntimeExports$1.jsx(Box, { style: { height: "500px" }, children: jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", alignItems: "center", position: "absolute", style: { top: "50%", right: "50%", transform: "translate(50%, -50%)" }, children: [jsxRuntimeExports$1.jsx(NotificationErrorIcon, {}), jsxRuntimeExports$1.jsx(Text, { fontSize: "xlarge", children: "Error" }), jsxRuntimeExports$1.jsx(Text, { textAlign: "center", variant: "normal", color: "text80", children: "An error occurred while processing the transaction." })] }) }); +const hostHeaderMiddlewareOptions = { + name: "hostHeaderMiddleware", + step: "build", + priority: "low", + tags: ["HOST"], + override: true }; -const NotificationErrorIcon = () => jsxRuntimeExports$1.jsx(Box, { color: "white", alignItems: "center", justifyContent: "center", width: "16", height: "16", borderRadius: "circle", marginBottom: "2", background: "negative", children: jsxRuntimeExports$1.jsx(SvgCloseIcon, { size: "xl" }) }); -const OrderSummaryItem = ({ contractAddress, tokenId, quantityRaw, chainId }) => { - const { data: tokenMetadata, isPending: isPendingTokenMetadata } = useTokenMetadata(chainId, contractAddress, [tokenId]); - const { data: contractInfo, isPending: isPendingContractInfo } = useContractInfo(chainId, contractAddress); - const isPending = isPendingTokenMetadata || isPendingContractInfo; - if (isPending) { - return jsxRuntimeExports$1.jsx(OrderSummarySkeleton, {}); +const getHostHeaderPlugin = (options) => ({ + applyToStack: (clientStack) => { + clientStack.add(hostHeaderMiddleware(options), hostHeaderMiddlewareOptions); + } +}); +const loggerMiddleware = () => (next, context2) => async (args) => { + var _a2, _b2; + try { + const response = await next(args); + const { clientName, commandName, logger: logger2, dynamoDbDocumentClientOptions = {} } = context2; + const { overrideInputFilterSensitiveLog, overrideOutputFilterSensitiveLog } = dynamoDbDocumentClientOptions; + const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context2.inputFilterSensitiveLog; + const outputFilterSensitiveLog = overrideOutputFilterSensitiveLog ?? context2.outputFilterSensitiveLog; + const { $metadata, ...outputWithoutMetadata } = response.output; + (_a2 = logger2 == null ? void 0 : logger2.info) == null ? void 0 : _a2.call(logger2, { + clientName, + commandName, + input: inputFilterSensitiveLog(args.input), + output: outputFilterSensitiveLog(outputWithoutMetadata), + metadata: $metadata + }); + return response; + } catch (error) { + const { clientName, commandName, logger: logger2, dynamoDbDocumentClientOptions = {} } = context2; + const { overrideInputFilterSensitiveLog } = dynamoDbDocumentClientOptions; + const inputFilterSensitiveLog = overrideInputFilterSensitiveLog ?? context2.inputFilterSensitiveLog; + (_b2 = logger2 == null ? void 0 : logger2.error) == null ? void 0 : _b2.call(logger2, { + clientName, + commandName, + input: inputFilterSensitiveLog(args.input), + error, + metadata: error.$metadata + }); + throw error; } - const { name: name2 = "unknown", image, decimals = 0 } = (tokenMetadata == null ? void 0 : tokenMetadata[0]) ?? {}; - const { logoURI: collectionLogoURI, name: collectionName = "Unknown Collection" } = contractInfo || {}; - const balanceFormatted = formatUnits$1(quantityRaw, decimals); - return jsxRuntimeExports$1.jsxs(Card, { flexDirection: "row", alignItems: "flex-start", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", alignItems: "center", justifyContent: "center", gap: "2", children: [jsxRuntimeExports$1.jsx(Box, { aspectRatio: "1/1", height: "full", justifyContent: "center", alignItems: "center", style: { width: "80px" }, children: jsxRuntimeExports$1.jsx(Image$1, { src: image, borderRadius: "md", style: { maxWidth: "80px", height: "80px", objectFit: "cover" } }) }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", alignItems: "flex-start", justifyContent: "center", gap: "2", children: [jsxRuntimeExports$1.jsxs(Box, { gap: "1", alignItems: "center", children: [jsxRuntimeExports$1.jsx(TokenImage, { src: collectionLogoURI, size: "xs" }), jsxRuntimeExports$1.jsx(Text, { marginLeft: "1", fontSize: "small", color: "text80", fontWeight: "bold", children: collectionName }), jsxRuntimeExports$1.jsx(NetworkImage, { chainId, size: "xs" })] }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", alignItems: "flex-start", justifyContent: "center", style: { - width: "180px" - }, children: [jsxRuntimeExports$1.jsx(Text, { color: "text100", fontSize: "normal", fontWeight: "normal", children: name2 }), jsxRuntimeExports$1.jsx(Text, { color: "text50", fontSize: "normal", fontWeight: "normal", children: `#${tokenId}` })] })] })] }), jsxRuntimeExports$1.jsx(Box, { height: "full", fontSize: "small", color: "text50", fontWeight: "bold", children: `x${formatDisplay$1(balanceFormatted)}` })] }); }; -const OrderSummarySkeleton = () => { - return jsxRuntimeExports$1.jsxs(Card, { flexDirection: "row", alignItems: "flex-start", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", alignItems: "center", justifyContent: "center", gap: "2", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "80px", height: "80px" } }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", alignItems: "flex-start", justifyContent: "center", gap: "2", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "100px", height: "14px" } }), jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "180px", height: "34px" } })] })] }), jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "14px", height: "14px" } })] }); +const loggerMiddlewareOptions = { + name: "loggerMiddleware", + tags: ["LOGGER"], + step: "initialize", + override: true }; -const CheckoutSelection = () => { - var _a2, _b2, _c2, _d2, _e2; - const { chains: chains2 } = useConfig(); - const { setNavigation } = useNavigation$1(); - const { closeCheckout, settings } = useCheckoutModal(); - const { address: accountAddress } = useAccount(); - useProjectAccessKey(); - const cryptoCheckoutSettings = settings == null ? void 0 : settings.cryptoCheckout; - const creditCardCheckoutSettings = settings == null ? void 0 : settings.creditCardCheckout; - const displayCreditCardCheckout = !!creditCardCheckoutSettings; - const displayCryptoCheckout = !!cryptoCheckoutSettings; - const { data: contractInfoData, isLoading: isPendingContractInfo } = useContractInfo((cryptoCheckoutSettings == null ? void 0 : cryptoCheckoutSettings.chainId) || 1, ((_a2 = cryptoCheckoutSettings == null ? void 0 : cryptoCheckoutSettings.coinQuantity) == null ? void 0 : _a2.contractAddress) || ""); - const { data: balancesData, isPending: isPendingBalances } = useBalances({ - chainIds: [(cryptoCheckoutSettings == null ? void 0 : cryptoCheckoutSettings.chainId) || 1], - accountAddress: accountAddress || "" - }); - const isPending = (isPendingContractInfo || isPendingBalances) && cryptoCheckoutSettings; - const isNativeToken = compareAddress$1(((_b2 = cryptoCheckoutSettings == null ? void 0 : cryptoCheckoutSettings.coinQuantity) == null ? void 0 : _b2.contractAddress) || "", AddressZero); - const nativeTokenInfo = getNativeTokenInfoByChainId((cryptoCheckoutSettings == null ? void 0 : cryptoCheckoutSettings.chainId) || 1, chains2); - const coinDecimals = isNativeToken ? nativeTokenInfo.decimals : (contractInfoData == null ? void 0 : contractInfoData.decimals) || 0; - const coinSymbol = isNativeToken ? nativeTokenInfo.symbol : (contractInfoData == null ? void 0 : contractInfoData.symbol) || "COIN"; - const coinImageUrl = isNativeToken ? nativeTokenInfo.logoURI : (contractInfoData == null ? void 0 : contractInfoData.logoURI) || ""; - const coinBalance = balancesData == null ? void 0 : balancesData.find((balance) => { - var _a3; - return compareAddress$1(balance.contractAddress, ((_a3 = cryptoCheckoutSettings == null ? void 0 : cryptoCheckoutSettings.coinQuantity) == null ? void 0 : _a3.contractAddress) || ""); +const getLoggerPlugin = (options) => ({ + applyToStack: (clientStack) => { + clientStack.add(loggerMiddleware(), loggerMiddlewareOptions); + } +}); +var define_process_env_default = {}; +const TRACE_ID_HEADER_NAME = "X-Amzn-Trace-Id"; +const ENV_LAMBDA_FUNCTION_NAME = "AWS_LAMBDA_FUNCTION_NAME"; +const ENV_TRACE_ID = "_X_AMZN_TRACE_ID"; +const recursionDetectionMiddleware = (options) => (next) => async (args) => { + const { request } = args; + if (!HttpRequest.isInstance(request) || options.runtime !== "node" || request.headers.hasOwnProperty(TRACE_ID_HEADER_NAME)) { + return next(args); + } + const functionName = define_process_env_default[ENV_LAMBDA_FUNCTION_NAME]; + const traceId = define_process_env_default[ENV_TRACE_ID]; + const nonEmptyString = (str) => typeof str === "string" && str.length > 0; + if (nonEmptyString(functionName) && nonEmptyString(traceId)) { + request.headers[TRACE_ID_HEADER_NAME] = traceId; + } + return next({ + ...args, + request }); - const userBalanceRaw = coinBalance ? coinBalance.balance : "0"; - const requestedAmountRaw = ((_c2 = cryptoCheckoutSettings == null ? void 0 : cryptoCheckoutSettings.coinQuantity) == null ? void 0 : _c2.amountRequiredRaw) || "0"; - const userBalance = formatUnits$1(userBalanceRaw, coinDecimals); - const requestAmount = formatUnits$1(requestedAmountRaw, coinDecimals); - const isInsufficientBalance = BigNumber.from(userBalanceRaw).lt(BigNumber.from(requestedAmountRaw)); - const orderSummaryItems = (settings == null ? void 0 : settings.orderSummaryItems) || []; - const chainId = ((_d2 = settings == null ? void 0 : settings.cryptoCheckout) == null ? void 0 : _d2.chainId) || ((_e2 = settings == null ? void 0 : settings.creditCardCheckout) == null ? void 0 : _e2.chainId) || 1; - const triggerSardineTransaction = async () => { - console.log("trigger sardine transaction"); - if (settings == null ? void 0 : settings.creditCardCheckout) { - setNavigation({ - location: "transaction-pending", - params: { - creditCardCheckout: settings.creditCardCheckout - } - }); - } - }; - const onClickPayWithCard = () => { - if (settings == null ? void 0 : settings.creditCardCheckout) { - triggerSardineTransaction(); - } else { - setNavigation({ - location: "transaction-form" - }); - } - }; - const onClickPayWithCrypto = () => { - var _a3; - console.log("trigger transaction"); - const transaction2 = (_a3 = settings == null ? void 0 : settings.cryptoCheckout) == null ? void 0 : _a3.triggerTransaction; - transaction2 && transaction2(); - closeCheckout(); - }; - return jsxRuntimeExports$1.jsxs(Box, { paddingX: "5", paddingBottom: "5", style: { - marginTop: HEADER_HEIGHT$1 - }, flexDirection: "column", gap: "3", children: [orderSummaryItems.length > 0 && jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", gap: "2", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "normal", fontSize: "normal", color: "text50", children: "Order summary" }), jsxRuntimeExports$1.jsx(Tooltip, { vOffset: -2, side: "bottom", message: jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: ["Please note that NFTs are digital assets", jsxRuntimeExports$1.jsx("br", {}), " ,and as such, cannot be delivered physically."] }), children: jsxRuntimeExports$1.jsx(Box, { width: "5", height: "5", children: jsxRuntimeExports$1.jsx(SvgHelpIcon, { color: "text80" }) }) })] }), jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", gap: "2", children: orderSummaryItems.map((orderSummaryItem, index2) => { - return jsxRuntimeExports$1.jsx(OrderSummaryItem, { ...orderSummaryItem, chainId }, index2); - }) }), jsxRuntimeExports$1.jsx(Box, { marginTop: "2", children: jsxRuntimeExports$1.jsx(Divider, { color: "backgroundSecondary", style: { - margin: "0px" - } }) })] }), displayCryptoCheckout && jsxRuntimeExports$1.jsxs(Box, { justifyContent: "space-between", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "normal", fontSize: "normal", color: "text50", children: "Total" }), isPending ? jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "100px", height: "17px" } }) : jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", gap: "1", alignItems: "center", children: [jsxRuntimeExports$1.jsx(TokenImage, { src: coinImageUrl, size: "xs" }), jsxRuntimeExports$1.jsx(Text, { fontWeight: "normal", fontSize: "normal", color: "text100", children: `${formatDisplay$1(requestAmount)} ${coinSymbol}` })] })] }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "2", children: [displayCreditCardCheckout && jsxRuntimeExports$1.jsx(Button, { style: { - borderRadius: vars.radii.md, - height: "56px" - }, width: "full", borderRadius: "md", leftIcon: SvgPaymentsIcon, variant: "primary", label: "Pay with credit card", rightIcon: SvgChevronRightIcon, onClick: onClickPayWithCard }), displayCryptoCheckout && !isInsufficientBalance && !isPending && jsxRuntimeExports$1.jsx(Button, { style: { - borderRadius: vars.radii.md, - height: "56px" - }, width: "full", leftIcon: () => jsxRuntimeExports$1.jsx(TokenImage, { src: coinImageUrl, size: "sm" }), variant: "primary", label: `Pay with ${coinSymbol}`, rightIcon: SvgChevronRightIcon, onClick: onClickPayWithCrypto }), displayCryptoCheckout && (isInsufficientBalance || isPending) && jsxRuntimeExports$1.jsx(Button, { shape: "square", width: "full", variant: "glass", label: jsxRuntimeExports$1.jsxs(Box, { placeItems: "center", gap: "2", children: [jsxRuntimeExports$1.jsx(TokenImage, { src: coinImageUrl, size: "sm" }), jsxRuntimeExports$1.jsxs(Text, { children: ["Insufficient $", coinSymbol] })] }), onClick: onClickPayWithCrypto, disabled: true })] }), displayCryptoCheckout && jsxRuntimeExports$1.jsx(Box, { width: "full", justifyContent: "flex-end", children: isPending ? jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "102px", height: "14px" } }) : jsxRuntimeExports$1.jsxs(Text, { fontWeight: "bold", fontSize: "small", color: "text50", children: ["Balance: ", `${formatDisplay$1(userBalance)} ${coinSymbol}`] }) })] }); }; -const TRANSAK_API_KEY = "5911d9ec-46b5-48fa-a755-d59a715ff0cf"; -const getTransakLink = (addFundsSettings) => { - const defaultNetworks = "ethereum,mainnet,arbitrum,optimism,polygon,polygonzkevm,zksync,base,bnb,oasys,astar,avaxcchain"; - const options = { - apiKey: TRANSAK_API_KEY, - referrerDomain: window.location.origin, - walletAddress: addFundsSettings.walletAddress, - fiatCurrency: addFundsSettings == null ? void 0 : addFundsSettings.fiatCurrency, - disableWalletAddressForm: "true", - defaultFiatAmount: (addFundsSettings == null ? void 0 : addFundsSettings.defaultFiatAmount) || "50", - defaultCryptoCurrency: (addFundsSettings == null ? void 0 : addFundsSettings.defaultCryptoCurrency) || "USDC", - networks: (addFundsSettings == null ? void 0 : addFundsSettings.networks) || defaultNetworks +const addRecursionDetectionMiddlewareOptions = { + step: "build", + tags: ["RECURSION_DETECTION"], + name: "recursionDetectionMiddleware", + override: true, + priority: "low" +}; +const getRecursionDetectionPlugin = (options) => ({ + applyToStack: (clientStack) => { + clientStack.add(recursionDetectionMiddleware(options), addRecursionDetectionMiddlewareOptions); + } +}); +function resolveUserAgentConfig(input2) { + return { + ...input2, + customUserAgent: typeof input2.customUserAgent === "string" ? [[input2.customUserAgent]] : input2.customUserAgent }; - const url = new URL("https://global.transak.com"); - Object.keys(options).forEach((k2) => { - const option = options[k2]; - if (option) { - url.searchParams.append(k2, option); +} +const IP_V4_REGEX = new RegExp(`^(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}$`); +const isIpAddress = (value) => IP_V4_REGEX.test(value) || value.startsWith("[") && value.endsWith("]"); +const VALID_HOST_LABEL_REGEX = new RegExp(`^(?!.*-$)(?!-)[a-zA-Z0-9-]{1,63}$`); +const isValidHostLabel = (value, allowSubDomains = false) => { + if (!allowSubDomains) { + return VALID_HOST_LABEL_REGEX.test(value); + } + const labels = value.split("."); + for (const label of labels) { + if (!isValidHostLabel(label)) { + return false; } - }); - return url.href; + } + return true; }; -const AddFundsContent = () => { - const { addFundsSettings } = useAddFundsModal(); - if (!addFundsSettings) { - return; +const customEndpointFunctions = {}; +const debugId = "endpoints"; +function toDebugString(input2) { + if (typeof input2 !== "object" || input2 == null) { + return input2; } - const link = getTransakLink(addFundsSettings); - return jsxRuntimeExports$1.jsx(Box, { alignItems: "center", width: "full", paddingX: "4", paddingBottom: "4", height: "full", style: { height: "600px" }, children: jsxRuntimeExports$1.jsx(Box, { as: "iframe", width: "full", height: "full", borderWidth: "none", src: link }) }); + if ("ref" in input2) { + return `$${toDebugString(input2.ref)}`; + } + if ("fn" in input2) { + return `${input2.fn}(${(input2.argv || []).map(toDebugString).join(", ")})`; + } + return JSON.stringify(input2, null, 2); +} +class EndpointError extends Error { + constructor(message) { + super(message); + this.name = "EndpointError"; + } +} +const booleanEquals = (value1, value2) => value1 === value2; +const getAttrPathList = (path) => { + const parts = path.split("."); + const pathList = []; + for (const part of parts) { + const squareBracketIndex = part.indexOf("["); + if (squareBracketIndex !== -1) { + if (part.indexOf("]") !== part.length - 1) { + throw new EndpointError(`Path: '${path}' does not end with ']'`); + } + const arrayIndex = part.slice(squareBracketIndex + 1, -1); + if (Number.isNaN(parseInt(arrayIndex))) { + throw new EndpointError(`Invalid array index: '${arrayIndex}' in path: '${path}'`); + } + if (squareBracketIndex !== 0) { + pathList.push(part.slice(0, squareBracketIndex)); + } + pathList.push(arrayIndex); + } else { + pathList.push(part); + } + } + return pathList; }; -const KitCheckoutProvider = (props) => { - const queryClient2 = new QueryClient(); - return jsxRuntimeExports$1.jsx(QueryClientProvider, { client: queryClient2, children: jsxRuntimeExports$1.jsx(KitCheckoutContent, { ...props }) }); +const getAttr = (value, path) => getAttrPathList(path).reduce((acc, index2) => { + if (typeof acc !== "object") { + throw new EndpointError(`Index '${index2}' in '${path}' not found in '${JSON.stringify(value)}'`); + } else if (Array.isArray(acc)) { + return acc[parseInt(index2)]; + } + return acc[index2]; +}, value); +const isSet = (value) => value != null; +const not = (value) => !value; +const DEFAULT_PORTS = { + [EndpointURLScheme.HTTP]: 80, + [EndpointURLScheme.HTTPS]: 443 }; -const KitCheckoutContent = ({ children }) => { - const { theme, position } = useTheme(); - const [openCheckoutModal, setOpenCheckoutModal] = reactExports.useState(false); - const [openAddFundsModal, setOpenAddFundsModal] = reactExports.useState(false); - const [settings, setSettings] = reactExports.useState(); - const [addFundsSettings, setAddFundsSettings] = reactExports.useState(); - const [history, setHistory] = reactExports.useState([]); - const getDefaultLocation = () => { - const orderSummaryItems = (settings == null ? void 0 : settings.orderSummaryItems) || []; - const creditCardSettings = settings == null ? void 0 : settings.creditCardCheckout; - if (orderSummaryItems.length === 0 && creditCardSettings) { - return { - location: "transaction-pending", - params: { - creditCardCheckout: creditCardSettings - } - }; - } else { - return { - location: "select-method-checkout" - }; +const parseURL = (value) => { + const whatwgURL = (() => { + try { + if (value instanceof URL) { + return value; + } + if (typeof value === "object" && "hostname" in value) { + const { hostname: hostname2, port, protocol: protocol2 = "", path = "", query = {} } = value; + const url = new URL(`${protocol2}//${hostname2}${port ? `:${port}` : ""}${path}`); + url.search = Object.entries(query).map(([k2, v3]) => `${k2}=${v3}`).join("&"); + return url; + } + return new URL(value); + } catch (error) { + return null; } - }; - const navigation = history.length > 0 ? history[history.length - 1] : getDefaultLocation(); - const triggerCheckout = (settings2) => { - setSettings(settings2); - setOpenCheckoutModal(true); - }; - const closeCheckout = () => { - setOpenCheckoutModal(false); - }; - const triggerAddFunds = (settings2) => { - setAddFundsSettings(settings2); - setOpenAddFundsModal(true); - }; - const closeAddFunds = () => { - setOpenAddFundsModal(false); - }; - const getCheckoutContent = () => { - const { location: location2 } = navigation; - switch (location2) { - case "select-method-checkout": - return jsxRuntimeExports$1.jsx(CheckoutSelection, {}); - case "transaction-pending": - return jsxRuntimeExports$1.jsx(PendingTransaction, {}); - case "transaction-success": - return jsxRuntimeExports$1.jsx(TransactionSuccess, {}); - case "transaction-error": - return jsxRuntimeExports$1.jsx(TransactionError, {}); - case "transaction-form": - default: - return jsxRuntimeExports$1.jsx(CheckoutSelection, {}); - } - }; - const getCheckoutHeader = () => { - const { location: location2 } = navigation; - switch (location2) { - case "select-method-checkout": - return jsxRuntimeExports$1.jsx(NavigationHeader$1, { primaryText: "Checkout" }); - case "transaction-success": - case "transaction-error": - case "transaction-pending": - return jsxRuntimeExports$1.jsx(NavigationHeader$1, { disableBack: true, primaryText: "Pay with credit or debit card" }); - case "transaction-form": - default: - return jsxRuntimeExports$1.jsx(NavigationHeader$1, { primaryText: "Pay with credit or debit card" }); - } - }; - const getAddFundsHeader = () => { - const { location: location2 } = navigation; - switch (location2) { - default: - return jsxRuntimeExports$1.jsx(NavigationHeader$1, { primaryText: "Add funds with credit card or debit card" }); - } - }; - const getAddFundsContent = () => { - const { location: location2 } = navigation; - switch (location2) { - default: - return jsxRuntimeExports$1.jsx(AddFundsContent, {}); - } - }; - reactExports.useEffect(() => { - if (openCheckoutModal || openAddFundsModal) { - setHistory([]); - } - }, [openCheckoutModal, openAddFundsModal]); - return jsxRuntimeExports$1.jsx(AddFundsContextProvider, { value: { - triggerAddFunds, - closeAddFunds, - addFundsSettings - }, children: jsxRuntimeExports$1.jsx(CheckoutModalContextProvider, { value: { - triggerCheckout, - closeCheckout, - settings, - theme - }, children: jsxRuntimeExports$1.jsxs(NavigationContextProvider$1, { value: { history, setHistory, defaultLocation: getDefaultLocation() }, children: [jsxRuntimeExports$1.jsx("div", { id: "kit-checkout", children: jsxRuntimeExports$1.jsx(ThemeProvider, { root: "#kit-checkout", scope: "kit", theme, children: jsxRuntimeExports$1.jsxs(AnimatePresence, { children: [openCheckoutModal && jsxRuntimeExports$1.jsx(Modal, { contentProps: { - style: { - maxWidth: "400px", - height: "auto", - ...getModalPositionCss(position) - } - }, scroll: false, backdropColor: "backgroundBackdrop", onClose: () => setOpenCheckoutModal(false), children: jsxRuntimeExports$1.jsxs(Box, { id: "sequence-kit-checkout-content", children: [getCheckoutHeader(), getCheckoutContent()] }) }), openAddFundsModal && jsxRuntimeExports$1.jsx(Modal, { contentProps: { - style: { - maxWidth: "400px", - height: "auto", - ...getModalPositionCss(position) - } - }, scroll: false, backdropColor: "backgroundBackdrop", onClose: () => setOpenAddFundsModal(false), children: jsxRuntimeExports$1.jsxs(Box, { id: "sequence-kit-add-funds-content", children: [getAddFundsHeader(), getAddFundsContent()] }) })] }) }) }), children] }) }) }); -}; -const ERC_1155_ABI = [ - { - inputs: [ - { - internalType: "address", - name: "_from", - type: "address" - }, - { - internalType: "address", - name: "_to", - type: "address" - }, - { - internalType: "uint256[]", - name: "_ids", - type: "uint256[]" - }, - { - internalType: "uint256[]", - name: "_amounts", - type: "uint256[]" - }, - { - internalType: "bytes", - name: "_data", - type: "bytes" - } - ], - name: "safeBatchTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function" + })(); + if (!whatwgURL) { + console.error(`Unable to parse ${JSON.stringify(value)} as a whatwg URL.`); + return null; } -]; -const ERC_20_ABI = [ - { - constant: false, - inputs: [ - { - internalType: "address", - name: "recipient", - type: "address" - }, - { - internalType: "uint256", - name: "amount", - type: "uint256" - } - ], - name: "transfer", - outputs: [ - { - internalType: "bool", - name: "", - type: "bool" - } - ], - payable: false, - stateMutability: "nonpayable", - type: "function" + const urlString = whatwgURL.href; + const { host, hostname, pathname, protocol, search: search2 } = whatwgURL; + if (search2) { + return null; } -]; -const ERC_721_ABI = [ - { - inputs: [ - { - internalType: "address", - name: "from", - type: "address" - }, - { - internalType: "address", - name: "to", - type: "address" - }, - { - internalType: "uint256", - name: "tokenId", - type: "uint256" - } - ], - name: "safeTransferFrom", - outputs: [], - stateMutability: "nonpayable", - type: "function" + const scheme = protocol.slice(0, -1); + if (!Object.values(EndpointURLScheme).includes(scheme)) { + return null; } -]; -const supportedFiatCurrencies = [ - { symbol: "USD", sign: "$", name: { message: "US Dollar" }, decimals: 2 }, - { symbol: "CAD", sign: "$", name: { message: "Canadian Dollar" }, decimals: 2 }, - { symbol: "GBP", sign: "£", name: { message: "British Pound Sterling" }, decimals: 2 }, - { symbol: "EUR", sign: "€", name: { message: "Euro" }, decimals: 2 }, - { symbol: "CNY", sign: "¥", name: { message: "Chinese Yuan" }, decimals: 2 }, - { symbol: "JPY", sign: "¥", name: { message: "Japanese Yen" }, decimals: 2 }, - { symbol: "KRW", sign: "₩", name: { message: "South Korean Won" }, decimals: 2 }, - { symbol: "SGD", sign: "$", name: { message: "Singapore Dollar" }, decimals: 2 }, - { symbol: "CHF", sign: "CHF ", name: { message: "Swiss Franc" }, decimals: 2 }, - { symbol: "AUD", sign: "$", name: { message: "Australian Dollar" }, decimals: 2 }, - { symbol: "NZD", sign: "$", name: { message: "New Zealand Dollar" }, decimals: 2 }, - { symbol: "SEK", sign: "kr ", name: { message: "Swedish Krona" }, decimals: 2 }, - { symbol: "NOK", sign: "kr ", name: { message: "Norwegian Krone" }, decimals: 2 }, - { symbol: "MXN", sign: "$", name: { message: "Mexican Peso" }, decimals: 2 }, - { symbol: "INR", sign: "₹", name: { message: "Indian Rupee" }, decimals: 2 }, - { symbol: "ZAR", sign: "R ", name: { message: "South African Rand" }, decimals: 2 }, - { symbol: "TRY", sign: "₺", name: { message: "Turkish Lira" }, decimals: 2 }, - { symbol: "BRL", sign: "R$", name: { message: "Brazilian Real" }, decimals: 2 }, - { symbol: "DKK", sign: "kr ", name: { message: "Danish Krone" }, decimals: 2 }, - { symbol: "PLN", sign: "zł ", name: { message: "Polish Zloty" }, decimals: 2 }, - { symbol: "THB", sign: "฿", name: { message: "Thai Baht" }, decimals: 2 }, - { symbol: "IDR", sign: "Rp", name: { message: "Indonesian Rupiah" }, decimals: 2 } -]; -const defaultFiatCurrency = supportedFiatCurrencies[0]; -const HEADER_HEIGHT = "54px"; -const createGenericContext = () => { - const genericContext = reactExports.createContext(void 0); - const useGenericContext = () => { - const contextIsDefined = reactExports.useContext(genericContext); - if (!contextIsDefined) { - throw new Error("useGenericContext must be used within a Provider"); - } - return contextIsDefined; + const isIp = isIpAddress(hostname); + const inputContainsDefaultPort = urlString.includes(`${host}:${DEFAULT_PORTS[scheme]}`) || typeof value === "string" && value.includes(`${host}:${DEFAULT_PORTS[scheme]}`); + const authority = `${host}${inputContainsDefaultPort ? `:${DEFAULT_PORTS[scheme]}` : ``}`; + return { + scheme, + authority, + path: pathname, + normalizedPath: pathname.endsWith("/") ? pathname : `${pathname}/`, + isIp }; - return [useGenericContext, genericContext.Provider]; -}; -const [useWalletModalContext, WalletModalContextProvider] = createGenericContext(); -const [useNavigationContext, NavigationContextProvider] = createGenericContext(); -const useOpenWalletModal = () => { - const { setOpenWalletModal, openWalletModalState } = useWalletModalContext(); - return { setOpenWalletModal, openWalletModalState }; }; -const compareAddress = (a2, b2) => { - return a2.toLowerCase() === b2.toLowerCase(); -}; -const truncateAtMiddle = (text2, truncateAt) => { - let finalText = text2; - if (text2.length >= truncateAt) { - finalText = text2.slice(0, truncateAt / 2) + "..." + text2.slice(text2.length - truncateAt / 2, text2.length); +const stringEquals = (value1, value2) => value1 === value2; +const substring = (input2, start, stop, reverse) => { + if (start >= stop || input2.length < stop) { + return null; } - return finalText; + if (!reverse) { + return input2.substring(start, stop); + } + return input2.substring(input2.length - stop, input2.length - start); }; -const formatAddress = (text2) => { - return `0x${truncateAtMiddle((text2 == null ? void 0 : text2.substring(2)) || "", 8)}`; +const uriEncode = (value) => encodeURIComponent(value).replace(/[!*'()]/g, (c2) => `%${c2.charCodeAt(0).toString(16).toUpperCase()}`); +const endpointFunctions = { + booleanEquals, + getAttr, + isSet, + isValidHostLabel, + not, + parseURL, + stringEquals, + substring, + uriEncode }; -var ValueType; -(function(ValueType2) { - ValueType2[ValueType2["VERY_LARGE"] = 0] = "VERY_LARGE"; - ValueType2[ValueType2["FRACTION"] = 1] = "FRACTION"; - ValueType2[ValueType2["VERY_TINY"] = 2] = "VERY_TINY"; - ValueType2[ValueType2["MIXED"] = 3] = "MIXED"; -})(ValueType || (ValueType = {})); -const formatDisplay = (_val) => { - if (isNaN(Number(_val))) { - console.error(`display format error ${_val} is not a number`); - return "NaN"; - } - const val = Number(_val); - if (val === 0) { - return "0"; - } - let valMode; - if (val > 1e8) { - valMode = ValueType.VERY_LARGE; - } else if (val < 1e-10) { - valMode = ValueType.VERY_TINY; - } else if (val < 1) { - valMode = ValueType.FRACTION; - } else { - valMode = ValueType.MIXED; - } - let notation = void 0; - let config2; - switch (valMode) { - case ValueType.VERY_LARGE: - notation = "compact"; - config2 = { - maximumFractionDigits: 4 - }; - break; - case ValueType.VERY_TINY: - notation = "scientific"; - config2 = { - maximumFractionDigits: 4 - }; +const evaluateTemplate = (template, options) => { + const evaluatedTemplateArr = []; + const templateContext = { + ...options.endpointParams, + ...options.referenceRecord + }; + let currentIndex = 0; + while (currentIndex < template.length) { + const openingBraceIndex = template.indexOf("{", currentIndex); + if (openingBraceIndex === -1) { + evaluatedTemplateArr.push(template.slice(currentIndex)); break; - case ValueType.FRACTION: - notation = "standard"; - config2 = { - maximumSignificantDigits: 4 - }; + } + evaluatedTemplateArr.push(template.slice(currentIndex, openingBraceIndex)); + const closingBraceIndex = template.indexOf("}", openingBraceIndex); + if (closingBraceIndex === -1) { + evaluatedTemplateArr.push(template.slice(openingBraceIndex)); break; - default: - notation = "standard"; - config2 = { - maximumFractionDigits: 2 - }; + } + if (template[openingBraceIndex + 1] === "{" && template[closingBraceIndex + 1] === "}") { + evaluatedTemplateArr.push(template.slice(openingBraceIndex + 1, closingBraceIndex)); + currentIndex = closingBraceIndex + 2; + } + const parameterName = template.substring(openingBraceIndex + 1, closingBraceIndex); + if (parameterName.includes("#")) { + const [refName, attrName] = parameterName.split("#"); + evaluatedTemplateArr.push(getAttr(templateContext[refName], attrName)); + } else { + evaluatedTemplateArr.push(templateContext[parameterName]); + } + currentIndex = closingBraceIndex + 1; } - return Intl.NumberFormat("en-US", { - notation, - ...config2 - }).format(val); + return evaluatedTemplateArr.join(""); }; -const capitalize = (word) => { - return word.charAt(0).toUpperCase() + word.slice(1); +const getReferenceValue = ({ ref }, options) => { + const referenceRecord = { + ...options.endpointParams, + ...options.referenceRecord + }; + return referenceRecord[ref]; }; -const limitDecimals = (value, decimals) => { - const splitValue = value.split("."); - if (splitValue.length === 1) { - return value; +const evaluateExpression = (obj, keyName, options) => { + if (typeof obj === "string") { + return evaluateTemplate(obj, options); + } else if (obj["fn"]) { + return callFunction(obj, options); + } else if (obj["ref"]) { + return getReferenceValue(obj, options); } - return `${splitValue[0]}.${splitValue[1].slice(0, decimals)}`; -}; -const isEthAddress = (value) => { - const ethAddressRegEx = /0x[a-fA-F0-9]{40}/; - const isEthAddress2 = ethAddressRegEx.test(value); - return isEthAddress2; + throw new EndpointError(`'${keyName}': ${String(obj)} is not a string, function or reference.`); }; -const sampleSize = (collection, n2) => { - const length = collection.length; - if (!length || n2 < 1) { - return []; +const callFunction = ({ fn, argv }, options) => { + const evaluatedArgs = argv.map((arg) => ["boolean", "number"].includes(typeof arg) ? arg : evaluateExpression(arg, "arg", options)); + const fnSegments = fn.split("."); + if (fnSegments[0] in customEndpointFunctions && fnSegments[1] != null) { + return customEndpointFunctions[fnSegments[0]][fnSegments[1]](...evaluatedArgs); } - n2 = n2 > length ? length : n2; - const sampled = new Array(n2); - const indexes = /* @__PURE__ */ new Set(); - while (indexes.size < n2) { - indexes.add(Math.floor(Math.random() * length)); + return endpointFunctions[fn](...evaluatedArgs); +}; +const evaluateCondition = ({ assign, ...fnArgs }, options) => { + var _a2, _b2; + if (assign && assign in options.referenceRecord) { + throw new EndpointError(`'${assign}' is already defined in Reference Record.`); } - let index2 = 0; - for (const i2 of indexes) { - sampled[index2++] = collection[i2]; + const value = callFunction(fnArgs, options); + (_b2 = (_a2 = options.logger) == null ? void 0 : _a2.debug) == null ? void 0 : _b2.call(_a2, `${debugId} evaluateCondition: ${toDebugString(fnArgs)} = ${toDebugString(value)}`); + return { + result: value === "" ? true : !!value, + ...assign != null && { toAssign: { name: assign, value } } + }; +}; +const evaluateConditions = (conditions = [], options) => { + var _a2, _b2; + const conditionsReferenceRecord = {}; + for (const condition of conditions) { + const { result, toAssign } = evaluateCondition(condition, { + ...options, + referenceRecord: { + ...options.referenceRecord, + ...conditionsReferenceRecord + } + }); + if (!result) { + return { result }; + } + if (toAssign) { + conditionsReferenceRecord[toAssign.name] = toAssign.value; + (_b2 = (_a2 = options.logger) == null ? void 0 : _a2.debug) == null ? void 0 : _b2.call(_a2, `${debugId} assign: ${toAssign.name} := ${toDebugString(toAssign.value)}`); + } } - return sampled; + return { result: true, referenceRecord: conditionsReferenceRecord }; }; -const getPercentageColor = (value) => { - if (value > 0) { - return vars.colors.positive; - } else if (value < 0) { - return vars.colors.negative; - } else { - return vars.colors.text50; +const getEndpointHeaders = (headers, options) => Object.entries(headers).reduce((acc, [headerKey, headerVal]) => ({ + ...acc, + [headerKey]: headerVal.map((headerValEntry) => { + const processedExpr = evaluateExpression(headerValEntry, "Header value entry", options); + if (typeof processedExpr !== "string") { + throw new EndpointError(`Header '${headerKey}' value '${processedExpr}' is not a string`); + } + return processedExpr; + }) +}), {}); +const getEndpointProperty = (property, options) => { + if (Array.isArray(property)) { + return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options)); + } + switch (typeof property) { + case "string": + return evaluateTemplate(property, options); + case "object": + if (property === null) { + throw new EndpointError(`Unexpected endpoint property: ${property}`); + } + return getEndpointProperties(property, options); + case "boolean": + return property; + default: + throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`); } }; -const getPercentagePriceChange = (balance, prices) => { - var _a2; - const priceForToken = prices.find((p2) => compareAddress(p2.token.contractAddress, balance.contractAddress)); - if (!priceForToken) { - return 0; +const getEndpointProperties = (properties, options) => Object.entries(properties).reduce((acc, [propertyKey, propertyVal]) => ({ + ...acc, + [propertyKey]: getEndpointProperty(propertyVal, options) +}), {}); +const getEndpointUrl = (endpointUrl, options) => { + const expression = evaluateExpression(endpointUrl, "Endpoint URL", options); + if (typeof expression === "string") { + try { + return new URL(expression); + } catch (error) { + console.error(`Failed to construct URL with ${expression}`, error); + throw error; + } } - const price24HourChange = ((_a2 = priceForToken == null ? void 0 : priceForToken.price24hChange) == null ? void 0 : _a2.value) || 0; - return price24HourChange; + throw new EndpointError(`Endpoint URL must be a string, got ${typeof expression}`); }; -const computeBalanceFiat = ({ balance, prices, decimals, conversionRate }) => { - var _a2; - let totalUsd = 0; - const priceForToken = prices.find((p2) => compareAddress(p2.token.contractAddress, balance.contractAddress)); - if (!priceForToken) { - return "0.00"; +const evaluateEndpointRule = (endpointRule, options) => { + var _a2, _b2; + const { conditions, endpoint } = endpointRule; + const { result, referenceRecord } = evaluateConditions(conditions, options); + if (!result) { + return; } - const priceFiat = ((_a2 = priceForToken.price) == null ? void 0 : _a2.value) || 0; - const valueFormatted = formatUnits$1(balance.balance, decimals); - const usdValue = parseFloat(valueFormatted) * priceFiat; - totalUsd += usdValue; - const fiatValue = totalUsd * conversionRate; - return `${fiatValue.toFixed(2)}`; + const endpointRuleOptions = { + ...options, + referenceRecord: { ...options.referenceRecord, ...referenceRecord } + }; + const { url, properties, headers } = endpoint; + (_b2 = (_a2 = options.logger) == null ? void 0 : _a2.debug) == null ? void 0 : _b2.call(_a2, `${debugId} Resolving endpoint from template: ${toDebugString(endpoint)}`); + return { + ...headers != void 0 && { + headers: getEndpointHeaders(headers, endpointRuleOptions) + }, + ...properties != void 0 && { + properties: getEndpointProperties(properties, endpointRuleOptions) + }, + url: getEndpointUrl(url, endpointRuleOptions) + }; }; -const compareTokenBalanceIds = (a2, b2) => { - return (a2.tokenID || "").localeCompare(b2.tokenID || ""); +const evaluateErrorRule = (errorRule, options) => { + const { conditions, error } = errorRule; + const { result, referenceRecord } = evaluateConditions(conditions, options); + if (!result) { + return; + } + throw new EndpointError(evaluateExpression(error, "Error", { + ...options, + referenceRecord: { ...options.referenceRecord, ...referenceRecord } + })); }; -const sortBalancesByType = (balances) => { - const nativeTokens = []; - const erc20Tokens = []; - const collectibles = []; - balances.forEach((balance) => { - if (balance.contractAddress === AddressZero) { - nativeTokens.push(balance); - } else if (balance.contractType === "ERC20") { - erc20Tokens.push(balance); - } else if (balance.contractType === "ERC721" || balance.contractType === "ERC1155") { - collectibles.push(balance); - } - }); - const sortedNativeTokens = nativeTokens.sort(compareTokenBalanceIds); - const sortedErc20Tokens = erc20Tokens.sort(compareTokenBalanceIds); - const sortedCollectibles = collectibles.sort(compareTokenBalanceIds); - return { - nativeTokens: sortedNativeTokens, - erc20Tokens: sortedErc20Tokens, - collectibles: sortedCollectibles - }; -}; -const flattenPaginatedTransactionHistory = (transactionHistoryData) => { - const transactionHistory = []; - transactionHistoryData == null ? void 0 : transactionHistoryData.pages.forEach((page) => { - transactionHistory.push(...page.transactions); +const evaluateTreeRule = (treeRule, options) => { + const { conditions, rules } = treeRule; + const { result, referenceRecord } = evaluateConditions(conditions, options); + if (!result) { + return; + } + return evaluateRules(rules, { + ...options, + referenceRecord: { ...options.referenceRecord, ...referenceRecord } }); - return transactionHistory; -}; -const time = { - oneSecond: 1 * 1e3, - oneMinute: 60 * 1e3, - oneHour: 60 * 60 * 1e3 }; -const getBalancesAssetsSummary = async (apiClient, metadataClient, indexerClients, { accountAddress, displayAssets, hideCollectibles, verifiedOnly }) => { - const indexerClientsArr = Array.from(indexerClients.entries()); - const MAX_COLLECTIBLES_AMOUNTS = 10; - let tokenBalances = []; - const customDisplayAssets = displayAssets.length > 0; - try { - if (customDisplayAssets) { - const nativeTokens2 = displayAssets.filter((asset) => compareAddress(asset.contractAddress, AddressZero)); - const otherAssets = displayAssets.filter((asset) => !compareAddress(asset.contractAddress, AddressZero)); - const nativeTokensByChainId = {}; - const otherAssetsByChainId = {}; - nativeTokens2.forEach((asset) => { - if (!nativeTokensByChainId[asset.chainId]) { - nativeTokensByChainId[asset.chainId] = []; - } - nativeTokensByChainId[asset.chainId].push(asset); - }); - otherAssets.forEach((asset) => { - if (!otherAssetsByChainId[asset.chainId]) { - otherAssetsByChainId[asset.chainId] = []; - } - otherAssetsByChainId[asset.chainId].push(asset); - }); - tokenBalances = (await Promise.all([ - ...Object.keys(nativeTokensByChainId).map((chainId) => getNativeTokenBalance(indexerClients.get(Number(chainId)), Number(chainId), accountAddress)), - ...Object.keys(otherAssetsByChainId).map((chainId) => otherAssetsByChainId[Number(chainId)].map((asset) => getTokenBalances(indexerClients.get(Number(chainId)), { - accountAddress, - contractAddress: asset.contractAddress, - includeMetadata: false, - hideCollectibles, - verifiedOnly - }))).flat() - ])).flat(); - } else { - tokenBalances = (await Promise.all([ - ...indexerClientsArr.map(([chainId, indexerClient]) => getNativeTokenBalance(indexerClient, chainId, accountAddress)), - ...indexerClientsArr.map(([_chainId, indexerClient]) => getTokenBalances(indexerClient, { - accountAddress, - hideCollectibles, - includeMetadata: false, - verifiedOnly - })) - ])).flat(); - } - const { nativeTokens, erc20Tokens, collectibles: collectionBalances } = sortBalancesByType(tokenBalances); - const fetchPricesPromise = new Promise(async (resolve) => { - if (erc20Tokens.length > 0) { - const tokens = erc20Tokens.map((token) => ({ - chainId: token.chainId, - contractAddress: token.contractAddress - })); - const prices2 = await getCoinPrices(apiClient, tokens) || []; - resolve(prices2); - } else { - resolve([]); +const evaluateRules = (rules, options) => { + for (const rule of rules) { + if (rule.type === "endpoint") { + const endpointOrUndefined = evaluateEndpointRule(rule, options); + if (endpointOrUndefined) { + return endpointOrUndefined; } - }); - const fetchCollectiblesPromises = collectionBalances.map(async (collectionBalance) => { - if (customDisplayAssets) { - return collectionBalance; + } else if (rule.type === "error") { + evaluateErrorRule(rule, options); + } else if (rule.type === "tree") { + const endpointOrUndefined = evaluateTreeRule(rule, options); + if (endpointOrUndefined) { + return endpointOrUndefined; } - const balance = await getCollectionBalance(indexerClients.get(collectionBalance.chainId), { - accountAddress, - chainId: collectionBalance.chainId, - contractAddress: collectionBalance.contractAddress, - includeMetadata: false - }); - return balance; - }); - const fetchErc20ContractInfoPromise = async () => { - const contractInfoMapByChainId2 = {}; - const erc20BalanceByChainId = {}; - erc20Tokens.forEach((erc20Token) => { - if (!erc20BalanceByChainId[erc20Token.chainId]) { - erc20BalanceByChainId[erc20Token.chainId] = [erc20Token]; - } else { - erc20BalanceByChainId[erc20Token.chainId].push(erc20Token); - } - }); - const contractInfoPromises = Object.keys(erc20BalanceByChainId).map(async (chainId) => { - const tokenBalances2 = erc20BalanceByChainId[Number(chainId)]; - const contractAddresses = tokenBalances2.map((balance) => balance.contractAddress); - const result = await metadataClient.getContractInfoBatch({ - chainID: String(chainId), - contractAddresses - }); - contractInfoMapByChainId2[Number(chainId)] = result; - }); - await Promise.all([...contractInfoPromises]); - return contractInfoMapByChainId2; - }; - const [prices, contractInfoMapByChainId, ...collectionCollectibles] = await Promise.all([ - fetchPricesPromise, - fetchErc20ContractInfoPromise(), - ...fetchCollectiblesPromises - ]); - const erc20HighestValue = erc20Tokens.sort((a2, b2) => { - var _a2, _b2; - const aPriceData = prices.find((price) => compareAddress(price.token.contractAddress, a2.contractAddress)); - const bPriceData = prices.find((price) => compareAddress(price.token.contractAddress, b2.contractAddress)); - const aPrice = (aPriceData == null ? void 0 : aPriceData.price) ? aPriceData.price.value : 0; - const bPrice = (bPriceData == null ? void 0 : bPriceData.price) ? bPriceData.price.value : 0; - const aDecimals = (_a2 = contractInfoMapByChainId[a2.chainId].contractInfoMap[a2.contractAddress]) == null ? void 0 : _a2.decimals; - const bDecimals = (_b2 = contractInfoMapByChainId[b2.chainId].contractInfoMap[b2.contractAddress]) == null ? void 0 : _b2.decimals; - const aFormattedBalance = aDecimals === void 0 ? 0 : Number(formatUnits$1(a2.balance, aDecimals)); - const bFormattedBalance = bDecimals === void 0 ? 0 : Number(formatUnits$1(b2.balance, bDecimals)); - const aValue = aFormattedBalance * aPrice; - const bValue = bFormattedBalance * bPrice; - return bValue - aValue; - }); - const collectibles = sampleSize(collectionCollectibles.flat(), MAX_COLLECTIBLES_AMOUNTS).sort((a2, b2) => { - return a2.contractAddress.localeCompare(b2.contractAddress); - }); - if (hideCollectibles) { - const summaryBalances2 = [ - ...nativeTokens.length > 0 ? [nativeTokens[0]] : [], - // the spots normally occupied by collectibles will be filled by erc20 tokens - ...erc20HighestValue.length > 0 ? erc20HighestValue.slice(0, MAX_COLLECTIBLES_AMOUNTS + 1) : [] - ]; - return summaryBalances2; + } else { + throw new EndpointError(`Unknown endpoint rule: ${rule}`); } - const summaryBalances = [ - ...nativeTokens.length > 0 ? [nativeTokens[0]] : [], - ...erc20HighestValue.length > 0 ? [erc20HighestValue[0]] : [], - ...collectibles.length > 0 ? [...collectibles] : [] - ]; - return summaryBalances; - } catch (e2) { - console.error(e2); - return []; } + throw new EndpointError(`Rules evaluation failed`); }; -const useBalancesAssetsSummary = (args) => { - const apiClient = useAPIClient(); - const metadataClient = useMetadataClient(); - const indexerClients = useIndexerClients(args.chainIds); - return useQuery$1({ - queryKey: ["balancesAssetsSummary", args], - queryFn: () => getBalancesAssetsSummary(apiClient, metadataClient, indexerClients, args), - retry: true, - refetchInterval: time.oneSecond * 4, - refetchOnMount: true, - staleTime: time.oneSecond, - enabled: args.chainIds.length > 0 && !!args.accountAddress - }); -}; -const getTransactionHistorySummary = async (indexerClients, { accountAddress }) => { - const histories = await Promise.all(Array.from(indexerClients.values()).map((indexerClient) => getTransactionHistory(indexerClient, { - accountAddress, - page: { - page: 1 +const resolveEndpoint = (ruleSetObject, options) => { + var _a2, _b2, _c2, _d2, _e2; + const { endpointParams, logger: logger2 } = options; + const { parameters, rules } = ruleSetObject; + (_b2 = (_a2 = options.logger) == null ? void 0 : _a2.debug) == null ? void 0 : _b2.call(_a2, `${debugId} Initial EndpointParams: ${toDebugString(endpointParams)}`); + const paramsWithDefault = Object.entries(parameters).filter(([, v3]) => v3.default != null).map(([k2, v3]) => [k2, v3.default]); + if (paramsWithDefault.length > 0) { + for (const [paramKey, paramDefaultValue] of paramsWithDefault) { + endpointParams[paramKey] = endpointParams[paramKey] ?? paramDefaultValue; } - }))); - const unorderedTransactions = histories.map((history) => history.transactions).flat(); - const orderedTransactions = unorderedTransactions.sort((a2, b2) => { - const firstDate = new Date(a2.timestamp).getTime(); - const secondDate = new Date(b2.timestamp).getTime(); - return secondDate - firstDate; - }); - return orderedTransactions; -}; -const useTransactionHistorySummary = (args) => { - const indexerClients = useIndexerClients(args.chainIds); - return useQuery$1({ - queryKey: ["transactionHistorySummary", args], - queryFn: () => getTransactionHistorySummary(indexerClients, args), - retry: true, - staleTime: time.oneSecond, - refetchOnMount: true, - enabled: args.chainIds.length > 0 && !!args.accountAddress - }); -}; -const useNavigation = () => { - const { setHistory, history } = useNavigationContext(); - const setNavigation = (navigation) => { - const childElement = document.getElementById("sequence-kit-wallet-content"); - const parentElement = childElement == null ? void 0 : childElement.parentElement; - parentElement == null ? void 0 : parentElement.scrollTo(0, 0); - const newHistory = navigation.location === "home" ? [] : [...history, navigation]; - setHistory(newHistory); - }; - const goBack = () => { - const newHistory = [...history]; - newHistory.pop(); - setHistory(newHistory); - }; - return { setNavigation, history, setHistory, goBack }; -}; -const useSettings = () => { - const { chains: chains2 } = useConfig(); - const getSettingsFromStorage = () => { - let hideUnlistedTokens = true; - let hideCollectibles = false; - let fiatCurrency = defaultFiatCurrency; - let selectedNetworks = chains2.map((chain) => chain.id); + } + const requiredParams = Object.entries(parameters).filter(([, v3]) => v3.required).map(([k2]) => k2); + for (const requiredParam of requiredParams) { + if (endpointParams[requiredParam] == null) { + throw new EndpointError(`Missing required parameter: '${requiredParam}'`); + } + } + const endpoint = evaluateRules(rules, { endpointParams, logger: logger2, referenceRecord: {} }); + if ((_c2 = options.endpointParams) == null ? void 0 : _c2.Endpoint) { try { - const settingsStorage = localStorage.getItem(LocalStorageKey.Settings); - const settings2 = JSON.parse(settingsStorage || "{}"); - if ((settings2 == null ? void 0 : settings2.hideUnlistedTokens) !== void 0) { - hideUnlistedTokens = settings2 == null ? void 0 : settings2.hideUnlistedTokens; - } - if ((settings2 == null ? void 0 : settings2.hideCollectibles) !== void 0) { - hideCollectibles = settings2 == null ? void 0 : settings2.hideCollectibles; - } - if ((settings2 == null ? void 0 : settings2.fiatCurrency) !== void 0) { - fiatCurrency = settings2 == null ? void 0 : settings2.fiatCurrency; - } - if ((settings2 == null ? void 0 : settings2.selectedNetworks) !== void 0) { - let areSelectedNetworksValid = true; - settings2.selectedNetworks.forEach((chainId) => { - if (chains2.find((chain) => chain.id === chainId) === void 0) { - areSelectedNetworksValid = false; - } - }); - if (areSelectedNetworksValid) { - selectedNetworks = settings2 == null ? void 0 : settings2.selectedNetworks; - } - } + const givenEndpoint = new URL(options.endpointParams.Endpoint); + const { protocol, port } = givenEndpoint; + endpoint.url.protocol = protocol; + endpoint.url.port = port; } catch (e2) { - console.error(e2, "Failed to fetch settings"); } - return { - hideUnlistedTokens, - hideCollectibles, - fiatCurrency, - selectedNetworks - }; - }; - const defaultSettings = getSettingsFromStorage(); - const [settings, setSettings] = reactExports.useState(defaultSettings); - const setHideUnlistedTokens = (newState) => { - const oldSettings = getSettingsFromStorage(); - const newSettings = { - ...oldSettings, - hideUnlistedTokens: newState - }; - localStorage.setItem(LocalStorageKey.Settings, JSON.stringify(newSettings)); - setSettings(newSettings); - }; - const setHideCollectibles = (newState) => { - const oldSettings = getSettingsFromStorage(); - const newSettings = { - ...oldSettings, - hideCollectibles: newState - }; - localStorage.setItem(LocalStorageKey.Settings, JSON.stringify(newSettings)); - setSettings(newSettings); - }; - const setFiatCurrency = (newFiatCurrency) => { - const oldSettings = getSettingsFromStorage(); - const newSettings = { - ...oldSettings, - fiatCurrency: newFiatCurrency - }; - localStorage.setItem(LocalStorageKey.Settings, JSON.stringify(newSettings)); - setSettings(newSettings); - }; - const setSelectedNetworks = (newSelectedNetworks) => { - const oldSettings = getSettingsFromStorage(); - const newSettings = { - ...oldSettings, - selectedNetworks: newSelectedNetworks - }; - localStorage.setItem(LocalStorageKey.Settings, JSON.stringify(newSettings)); - setSettings(newSettings); - }; - return { - ...settings, - setFiatCurrency, - setHideCollectibles, - setHideUnlistedTokens, - setSelectedNetworks - }; -}; -const CoinTileContent = ({ logoUrl, tokenName, balance, balanceFiat, priceChangePercentage, symbol, chainId }) => { - const { fiatCurrency } = useSettings(); - const priceChangeSymbol = priceChangePercentage > 0 ? "+" : ""; - return jsxRuntimeExports$1.jsxs(Box, { background: "backgroundSecondary", width: "full", height: "full", borderRadius: "md", padding: "4", flexDirection: "column", justifyContent: "center", alignItems: "flex-start", gap: "1", children: [jsxRuntimeExports$1.jsx(Box, { marginBottom: "1", children: jsxRuntimeExports$1.jsx(TokenImage, { src: logoUrl, symbol, size: "xl" }) }), jsxRuntimeExports$1.jsxs(Box, { marginBottom: "3", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", gap: "1", justifyContent: "flex-start", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", whiteSpace: "nowrap", color: "text100", style: { maxWidth: "130px", textOverflow: "ellipsis", overflow: "hidden" }, children: tokenName }), jsxRuntimeExports$1.jsx(NetworkImage, { chainId, size: "xs" })] }), jsxRuntimeExports$1.jsx(Text, { color: "text50", whiteSpace: "nowrap", style: { display: "block", maxWidth: "150px", textOverflow: "ellipsis", overflow: "hidden" }, children: `${balance} ${symbol}` })] }), jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", color: "text100", children: `${fiatCurrency.sign}${balanceFiat}` }) }), jsxRuntimeExports$1.jsx(Text, { style: { color: getPercentageColor(priceChangePercentage) }, children: `${priceChangeSymbol}${priceChangePercentage.toFixed(2)}%` })] })] }); + } + (_e2 = (_d2 = options.logger) == null ? void 0 : _d2.debug) == null ? void 0 : _e2.call(_d2, `${debugId} Resolved endpoint: ${toDebugString(endpoint)}`); + return endpoint; }; -const CoinTile = ({ balance }) => { - const { chains: chains2 } = useConfig(); - const { fiatCurrency } = useSettings(); - const isNativeToken = compareAddress(balance.contractAddress, AddressZero); - const nativeTokenInfo = getNativeTokenInfoByChainId(balance.chainId, chains2); - const { data: dataCoinPrices = [], isPending: isPendingCoinPrice } = useCoinPrices([ - { - chainId: balance.chainId, - contractAddress: balance.contractAddress +const isVirtualHostableS3Bucket = (value, allowSubDomains = false) => { + if (allowSubDomains) { + for (const label of value.split(".")) { + if (!isVirtualHostableS3Bucket(label)) { + return false; + } } - ]); - const { data: conversionRate = 1, isPending: isPendingConversionRate } = useExchangeRate(fiatCurrency.symbol); - const { data: contractInfo, isPending: isPendingContractInfo } = useContractInfo(balance.chainId, balance.contractAddress); - const isPending = isPendingCoinPrice || isPendingConversionRate || isPendingContractInfo; - if (isPending) { - return jsxRuntimeExports$1.jsx(Box, { background: "backgroundSecondary", width: "full", height: "full", borderRadius: "md" }); + return true; } - if (isNativeToken) { - const computedBalance2 = computeBalanceFiat({ - balance, - prices: dataCoinPrices, - conversionRate, - decimals: nativeTokenInfo.decimals - }); - const priceChangePercentage2 = getPercentagePriceChange(balance, dataCoinPrices); - const formattedBalance2 = formatUnits$1(balance.balance, nativeTokenInfo.decimals); - const balanceDisplayed2 = formatDisplay(formattedBalance2); - return jsxRuntimeExports$1.jsx(CoinTileContent, { chainId: balance.chainId, logoUrl: nativeTokenInfo.logoURI, tokenName: nativeTokenInfo.name, balance: balanceDisplayed2, balanceFiat: computedBalance2, priceChangePercentage: priceChangePercentage2, symbol: nativeTokenInfo.symbol }); + if (!isValidHostLabel(value)) { + return false; } - const decimals = (contractInfo == null ? void 0 : contractInfo.decimals) ?? 18; - const computedBalance = computeBalanceFiat({ - balance, - prices: dataCoinPrices, - conversionRate, - decimals - }); - const priceChangePercentage = getPercentagePriceChange(balance, dataCoinPrices); - const formattedBalance = formatUnits$1(balance.balance, decimals); - const balanceDisplayed = formatDisplay(formattedBalance); - const name2 = (contractInfo == null ? void 0 : contractInfo.name) || "Unknown"; - const symbol = (contractInfo == null ? void 0 : contractInfo.name) || "TOKEN"; - const url = contractInfo == null ? void 0 : contractInfo.logoURI; - return jsxRuntimeExports$1.jsx(CoinTileContent, { chainId: balance.chainId, logoUrl: url, tokenName: name2, balance: balanceDisplayed, balanceFiat: computedBalance, priceChangePercentage, symbol }); -}; -const CollectibleTileImage = ({ imageUrl }) => { - return jsxRuntimeExports$1.jsx(Card, { padding: "0", aspectRatio: "1/1", justifyContent: "center", alignItems: "center", overflow: "hidden", borderRadius: "sm", background: "backgroundSecondary", children: jsxRuntimeExports$1.jsx(Image$1, { style: { height: "100%" }, src: imageUrl }) }); -}; -const CollectibleTile = ({ balance }) => { - var _a2; - const { data: tokenMetadata } = useTokenMetadata(balance.chainId, balance.contractAddress, [balance.tokenID || ""]); - const imageUrl = (_a2 = tokenMetadata == null ? void 0 : tokenMetadata[0]) == null ? void 0 : _a2.image; - return jsxRuntimeExports$1.jsx(CollectibleTileImage, { imageUrl }); -}; -const SkeletonTiles = () => { - return jsxRuntimeExports$1.jsx(Box, { style: { - display: "grid", - gridTemplateColumns: `calc(50% - ${vars.space[1]}) calc(50% - ${vars.space[1]})`, - gap: vars.space[2] - }, children: Array(12).fill(null).map((_, i2) => jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(Skeleton, { height: "full", width: "full", aspectRatio: "1/1" }) }, i2)) }); -}; -const AssetSummary = () => { - const { address } = useAccount(); - const { setNavigation } = useNavigation(); - const { displayedAssets } = useWalletSettings(); - const { hideUnlistedTokens, hideCollectibles, selectedNetworks } = useSettings(); - const { data: balances = [], isPending: isPendingBalances } = useBalancesAssetsSummary({ - accountAddress: address || "", - chainIds: selectedNetworks, - displayAssets: displayedAssets, - hideCollectibles, - verifiedOnly: hideUnlistedTokens - }); - if (isPendingBalances) { - return jsxRuntimeExports$1.jsx(SkeletonTiles, {}); + if (value.length < 3 || value.length > 63) { + return false; } - const { nativeTokens, erc20Tokens, collectibles } = sortBalancesByType(balances); - const onClickItem = (balance) => { - if (balance.contractType === "ERC1155" || balance.contractType === "ERC721") { - setNavigation && setNavigation({ - location: "collectible-details", - params: { - contractAddress: balance.contractAddress, - chainId: balance.chainId, - tokenId: balance.tokenID || "" - } - }); - } else if (balance.contractType === "ERC20") { - setNavigation && setNavigation({ - location: "coin-details", - params: { - contractAddress: balance.contractAddress, - chainId: balance.chainId - } - }); - } else { - setNavigation && setNavigation({ - location: "coin-details", - params: { - contractAddress: balance.contractAddress, - chainId: balance.chainId - } - }); - } - }; - return jsxRuntimeExports$1.jsxs(Box, { style: { - display: "grid", - gridTemplateColumns: `calc(50% - ${vars.space[1]}) calc(50% - ${vars.space[1]})`, - gap: vars.space[2] - }, children: [nativeTokens.map((balance, index2) => { - return jsxRuntimeExports$1.jsx(Box, { userSelect: "none", cursor: "pointer", opacity: { hover: "80" }, aspectRatio: "1/1", onClick: () => onClickItem(balance), children: jsxRuntimeExports$1.jsx(CoinTile, { balance }) }, index2); - }), erc20Tokens.map((balance, index2) => { - return jsxRuntimeExports$1.jsx(Box, { userSelect: "none", cursor: "pointer", opacity: { hover: "80" }, aspectRatio: "1/1", onClick: () => onClickItem(balance), children: jsxRuntimeExports$1.jsx(CoinTile, { balance }) }, index2); - }), collectibles.map((balance, index2) => { - return jsxRuntimeExports$1.jsx(Box, { userSelect: "none", cursor: "pointer", opacity: { hover: "80" }, aspectRatio: "1/1", onClick: () => onClickItem(balance), children: jsxRuntimeExports$1.jsx(CollectibleTile, { balance }) }, index2); - })] }); -}; -const Home = () => { - return jsxRuntimeExports$1.jsx(Box, { paddingX: "4", paddingBottom: "5", gap: "4", flexDirection: "column", children: jsxRuntimeExports$1.jsx(AssetSummary, {}) }); + if (value !== value.toLowerCase()) { + return false; + } + if (isIpAddress(value)) { + return false; + } + return true; }; -var __defProp2 = Object.defineProperty; -var __getOwnPropSymbols = Object.getOwnPropertySymbols; -var __hasOwnProp = Object.prototype.hasOwnProperty; -var __propIsEnum = Object.prototype.propertyIsEnumerable; -var __defNormalProp2 = (obj, key2, value) => key2 in obj ? __defProp2(obj, key2, { enumerable: true, configurable: true, writable: true, value }) : obj[key2] = value; -var __spreadValues = (a2, b2) => { - for (var prop in b2 || (b2 = {})) - if (__hasOwnProp.call(b2, prop)) - __defNormalProp2(a2, prop, b2[prop]); - if (__getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(b2)) { - if (__propIsEnum.call(b2, prop)) - __defNormalProp2(a2, prop, b2[prop]); - } - return a2; +const parseArn = (value) => { + const segments = value.split(":"); + if (segments.length < 6) + return null; + const [arn, partition2, service, region, accountId, ...resourceId] = segments; + if (arn !== "arn" || partition2 === "" || service === "" || resourceId[0] === "") + return null; + return { + partition: partition2, + service, + region, + accountId, + resourceId: resourceId[0].includes("/") ? resourceId[0].split("/") : resourceId + }; }; -var __objRest = (source, exclude) => { - var target = {}; - for (var prop in source) - if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0) - target[prop] = source[prop]; - if (source != null && __getOwnPropSymbols) - for (var prop of __getOwnPropSymbols(source)) { - if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop)) - target[prop] = source[prop]; - } - return target; -}; -/** - * @license QR Code generator library (TypeScript) - * Copyright (c) Project Nayuki. - * SPDX-License-Identifier: MIT - */ -var qrcodegen; -((qrcodegen2) => { - const _QrCode = class { - constructor(version2, errorCorrectionLevel, dataCodewords, msk) { - this.version = version2; - this.errorCorrectionLevel = errorCorrectionLevel; - this.modules = []; - this.isFunction = []; - if (version2 < _QrCode.MIN_VERSION || version2 > _QrCode.MAX_VERSION) - throw new RangeError("Version value out of range"); - if (msk < -1 || msk > 7) - throw new RangeError("Mask value out of range"); - this.size = version2 * 4 + 17; - let row = []; - for (let i2 = 0; i2 < this.size; i2++) - row.push(false); - for (let i2 = 0; i2 < this.size; i2++) { - this.modules.push(row.slice()); - this.isFunction.push(row.slice()); - } - this.drawFunctionPatterns(); - const allCodewords = this.addEccAndInterleave(dataCodewords); - this.drawCodewords(allCodewords); - if (msk == -1) { - let minPenalty = 1e9; - for (let i2 = 0; i2 < 8; i2++) { - this.applyMask(i2); - this.drawFormatBits(i2); - const penalty = this.getPenaltyScore(); - if (penalty < minPenalty) { - msk = i2; - minPenalty = penalty; - } - this.applyMask(i2); - } +const partitions = [ + { + id: "aws", + outputs: { + dnsSuffix: "amazonaws.com", + dualStackDnsSuffix: "api.aws", + implicitGlobalRegion: "us-east-1", + name: "aws", + supportsDualStack: true, + supportsFIPS: true + }, + regionRegex: "^(us|eu|ap|sa|ca|me|af|il)\\-\\w+\\-\\d+$", + regions: { + "af-south-1": { + description: "Africa (Cape Town)" + }, + "ap-east-1": { + description: "Asia Pacific (Hong Kong)" + }, + "ap-northeast-1": { + description: "Asia Pacific (Tokyo)" + }, + "ap-northeast-2": { + description: "Asia Pacific (Seoul)" + }, + "ap-northeast-3": { + description: "Asia Pacific (Osaka)" + }, + "ap-south-1": { + description: "Asia Pacific (Mumbai)" + }, + "ap-south-2": { + description: "Asia Pacific (Hyderabad)" + }, + "ap-southeast-1": { + description: "Asia Pacific (Singapore)" + }, + "ap-southeast-2": { + description: "Asia Pacific (Sydney)" + }, + "ap-southeast-3": { + description: "Asia Pacific (Jakarta)" + }, + "ap-southeast-4": { + description: "Asia Pacific (Melbourne)" + }, + "aws-global": { + description: "AWS Standard global region" + }, + "ca-central-1": { + description: "Canada (Central)" + }, + "ca-west-1": { + description: "Canada West (Calgary)" + }, + "eu-central-1": { + description: "Europe (Frankfurt)" + }, + "eu-central-2": { + description: "Europe (Zurich)" + }, + "eu-north-1": { + description: "Europe (Stockholm)" + }, + "eu-south-1": { + description: "Europe (Milan)" + }, + "eu-south-2": { + description: "Europe (Spain)" + }, + "eu-west-1": { + description: "Europe (Ireland)" + }, + "eu-west-2": { + description: "Europe (London)" + }, + "eu-west-3": { + description: "Europe (Paris)" + }, + "il-central-1": { + description: "Israel (Tel Aviv)" + }, + "me-central-1": { + description: "Middle East (UAE)" + }, + "me-south-1": { + description: "Middle East (Bahrain)" + }, + "sa-east-1": { + description: "South America (Sao Paulo)" + }, + "us-east-1": { + description: "US East (N. Virginia)" + }, + "us-east-2": { + description: "US East (Ohio)" + }, + "us-west-1": { + description: "US West (N. California)" + }, + "us-west-2": { + description: "US West (Oregon)" } - assert2(0 <= msk && msk <= 7); - this.mask = msk; - this.applyMask(msk); - this.drawFormatBits(msk); - this.isFunction = []; } - static encodeText(text2, ecl) { - const segs = qrcodegen2.QrSegment.makeSegments(text2); - return _QrCode.encodeSegments(segs, ecl); - } - static encodeBinary(data, ecl) { - const seg = qrcodegen2.QrSegment.makeBytes(data); - return _QrCode.encodeSegments([seg], ecl); - } - static encodeSegments(segs, ecl, minVersion = 1, maxVersion = 40, mask = -1, boostEcl = true) { - if (!(_QrCode.MIN_VERSION <= minVersion && minVersion <= maxVersion && maxVersion <= _QrCode.MAX_VERSION) || mask < -1 || mask > 7) - throw new RangeError("Invalid value"); - let version2; - let dataUsedBits; - for (version2 = minVersion; ; version2++) { - const dataCapacityBits2 = _QrCode.getNumDataCodewords(version2, ecl) * 8; - const usedBits = QrSegment.getTotalBits(segs, version2); - if (usedBits <= dataCapacityBits2) { - dataUsedBits = usedBits; - break; - } - if (version2 >= maxVersion) - throw new RangeError("Data too long"); - } - for (const newEcl of [_QrCode.Ecc.MEDIUM, _QrCode.Ecc.QUARTILE, _QrCode.Ecc.HIGH]) { - if (boostEcl && dataUsedBits <= _QrCode.getNumDataCodewords(version2, newEcl) * 8) - ecl = newEcl; - } - let bb2 = []; - for (const seg of segs) { - appendBits(seg.mode.modeBits, 4, bb2); - appendBits(seg.numChars, seg.mode.numCharCountBits(version2), bb2); - for (const b2 of seg.getData()) - bb2.push(b2); + }, + { + id: "aws-cn", + outputs: { + dnsSuffix: "amazonaws.com.cn", + dualStackDnsSuffix: "api.amazonwebservices.com.cn", + implicitGlobalRegion: "cn-northwest-1", + name: "aws-cn", + supportsDualStack: true, + supportsFIPS: true + }, + regionRegex: "^cn\\-\\w+\\-\\d+$", + regions: { + "aws-cn-global": { + description: "AWS China global region" + }, + "cn-north-1": { + description: "China (Beijing)" + }, + "cn-northwest-1": { + description: "China (Ningxia)" } - assert2(bb2.length == dataUsedBits); - const dataCapacityBits = _QrCode.getNumDataCodewords(version2, ecl) * 8; - assert2(bb2.length <= dataCapacityBits); - appendBits(0, Math.min(4, dataCapacityBits - bb2.length), bb2); - appendBits(0, (8 - bb2.length % 8) % 8, bb2); - assert2(bb2.length % 8 == 0); - for (let padByte = 236; bb2.length < dataCapacityBits; padByte ^= 236 ^ 17) - appendBits(padByte, 8, bb2); - let dataCodewords = []; - while (dataCodewords.length * 8 < bb2.length) - dataCodewords.push(0); - bb2.forEach((b2, i2) => dataCodewords[i2 >>> 3] |= b2 << 7 - (i2 & 7)); - return new _QrCode(version2, ecl, dataCodewords, mask); - } - getModule(x, y2) { - return 0 <= x && x < this.size && 0 <= y2 && y2 < this.size && this.modules[y2][x]; - } - getModules() { - return this.modules; } - drawFunctionPatterns() { - for (let i2 = 0; i2 < this.size; i2++) { - this.setFunctionModule(6, i2, i2 % 2 == 0); - this.setFunctionModule(i2, 6, i2 % 2 == 0); - } - this.drawFinderPattern(3, 3); - this.drawFinderPattern(this.size - 4, 3); - this.drawFinderPattern(3, this.size - 4); - const alignPatPos = this.getAlignmentPatternPositions(); - const numAlign = alignPatPos.length; - for (let i2 = 0; i2 < numAlign; i2++) { - for (let j2 = 0; j2 < numAlign; j2++) { - if (!(i2 == 0 && j2 == 0 || i2 == 0 && j2 == numAlign - 1 || i2 == numAlign - 1 && j2 == 0)) - this.drawAlignmentPattern(alignPatPos[i2], alignPatPos[j2]); - } + }, + { + id: "aws-us-gov", + outputs: { + dnsSuffix: "amazonaws.com", + dualStackDnsSuffix: "api.aws", + implicitGlobalRegion: "us-gov-west-1", + name: "aws-us-gov", + supportsDualStack: true, + supportsFIPS: true + }, + regionRegex: "^us\\-gov\\-\\w+\\-\\d+$", + regions: { + "aws-us-gov-global": { + description: "AWS GovCloud (US) global region" + }, + "us-gov-east-1": { + description: "AWS GovCloud (US-East)" + }, + "us-gov-west-1": { + description: "AWS GovCloud (US-West)" } - this.drawFormatBits(0); - this.drawVersion(); - } - drawFormatBits(mask) { - const data = this.errorCorrectionLevel.formatBits << 3 | mask; - let rem = data; - for (let i2 = 0; i2 < 10; i2++) - rem = rem << 1 ^ (rem >>> 9) * 1335; - const bits = (data << 10 | rem) ^ 21522; - assert2(bits >>> 15 == 0); - for (let i2 = 0; i2 <= 5; i2++) - this.setFunctionModule(8, i2, getBit(bits, i2)); - this.setFunctionModule(8, 7, getBit(bits, 6)); - this.setFunctionModule(8, 8, getBit(bits, 7)); - this.setFunctionModule(7, 8, getBit(bits, 8)); - for (let i2 = 9; i2 < 15; i2++) - this.setFunctionModule(14 - i2, 8, getBit(bits, i2)); - for (let i2 = 0; i2 < 8; i2++) - this.setFunctionModule(this.size - 1 - i2, 8, getBit(bits, i2)); - for (let i2 = 8; i2 < 15; i2++) - this.setFunctionModule(8, this.size - 15 + i2, getBit(bits, i2)); - this.setFunctionModule(8, this.size - 8, true); } - drawVersion() { - if (this.version < 7) - return; - let rem = this.version; - for (let i2 = 0; i2 < 12; i2++) - rem = rem << 1 ^ (rem >>> 11) * 7973; - const bits = this.version << 12 | rem; - assert2(bits >>> 18 == 0); - for (let i2 = 0; i2 < 18; i2++) { - const color2 = getBit(bits, i2); - const a2 = this.size - 11 + i2 % 3; - const b2 = Math.floor(i2 / 3); - this.setFunctionModule(a2, b2, color2); - this.setFunctionModule(b2, a2, color2); + }, + { + id: "aws-iso", + outputs: { + dnsSuffix: "c2s.ic.gov", + dualStackDnsSuffix: "c2s.ic.gov", + implicitGlobalRegion: "us-iso-east-1", + name: "aws-iso", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^us\\-iso\\-\\w+\\-\\d+$", + regions: { + "aws-iso-global": { + description: "AWS ISO (US) global region" + }, + "us-iso-east-1": { + description: "US ISO East" + }, + "us-iso-west-1": { + description: "US ISO WEST" } } - drawFinderPattern(x, y2) { - for (let dy = -4; dy <= 4; dy++) { - for (let dx = -4; dx <= 4; dx++) { - const dist2 = Math.max(Math.abs(dx), Math.abs(dy)); - const xx = x + dx; - const yy = y2 + dy; - if (0 <= xx && xx < this.size && 0 <= yy && yy < this.size) - this.setFunctionModule(xx, yy, dist2 != 2 && dist2 != 4); - } + }, + { + id: "aws-iso-b", + outputs: { + dnsSuffix: "sc2s.sgov.gov", + dualStackDnsSuffix: "sc2s.sgov.gov", + implicitGlobalRegion: "us-isob-east-1", + name: "aws-iso-b", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^us\\-isob\\-\\w+\\-\\d+$", + regions: { + "aws-iso-b-global": { + description: "AWS ISOB (US) global region" + }, + "us-isob-east-1": { + description: "US ISOB East (Ohio)" } } - drawAlignmentPattern(x, y2) { - for (let dy = -2; dy <= 2; dy++) { - for (let dx = -2; dx <= 2; dx++) - this.setFunctionModule(x + dx, y2 + dy, Math.max(Math.abs(dx), Math.abs(dy)) != 1); + }, + { + id: "aws-iso-e", + outputs: { + dnsSuffix: "cloud.adc-e.uk", + dualStackDnsSuffix: "cloud.adc-e.uk", + implicitGlobalRegion: "eu-isoe-west-1", + name: "aws-iso-e", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^eu\\-isoe\\-\\w+\\-\\d+$", + regions: {} + }, + { + id: "aws-iso-f", + outputs: { + dnsSuffix: "csp.hci.ic.gov", + dualStackDnsSuffix: "csp.hci.ic.gov", + implicitGlobalRegion: "us-isof-south-1", + name: "aws-iso-f", + supportsDualStack: false, + supportsFIPS: true + }, + regionRegex: "^us\\-isof\\-\\w+\\-\\d+$", + regions: {} + } +]; +const version$1 = "1.1"; +const partitionsInfo = { + partitions, + version: version$1 +}; +let selectedPartitionsInfo = partitionsInfo; +const partition = (value) => { + const { partitions: partitions2 } = selectedPartitionsInfo; + for (const partition2 of partitions2) { + const { regions, outputs } = partition2; + for (const [region, regionData] of Object.entries(regions)) { + if (region === value) { + return { + ...outputs, + ...regionData + }; } } - setFunctionModule(x, y2, isDark) { - this.modules[y2][x] = isDark; - this.isFunction[y2][x] = true; + } + for (const partition2 of partitions2) { + const { regionRegex, outputs } = partition2; + if (new RegExp(regionRegex).test(value)) { + return { + ...outputs + }; } - addEccAndInterleave(data) { - const ver = this.version; - const ecl = this.errorCorrectionLevel; - if (data.length != _QrCode.getNumDataCodewords(ver, ecl)) - throw new RangeError("Invalid argument"); - const numBlocks = _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver]; - const blockEccLen = _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver]; - const rawCodewords = Math.floor(_QrCode.getNumRawDataModules(ver) / 8); - const numShortBlocks = numBlocks - rawCodewords % numBlocks; - const shortBlockLen = Math.floor(rawCodewords / numBlocks); - let blocks = []; - const rsDiv = _QrCode.reedSolomonComputeDivisor(blockEccLen); - for (let i2 = 0, k2 = 0; i2 < numBlocks; i2++) { - let dat = data.slice(k2, k2 + shortBlockLen - blockEccLen + (i2 < numShortBlocks ? 0 : 1)); - k2 += dat.length; - const ecc = _QrCode.reedSolomonComputeRemainder(dat, rsDiv); - if (i2 < numShortBlocks) - dat.push(0); - blocks.push(dat.concat(ecc)); + } + const DEFAULT_PARTITION = partitions2.find((partition2) => partition2.id === "aws"); + if (!DEFAULT_PARTITION) { + throw new Error("Provided region was not found in the partition array or regex, and default partition with id 'aws' doesn't exist."); + } + return { + ...DEFAULT_PARTITION.outputs + }; +}; +const awsEndpointFunctions = { + isVirtualHostableS3Bucket, + parseArn, + partition +}; +customEndpointFunctions.aws = awsEndpointFunctions; +const USER_AGENT = "user-agent"; +const X_AMZ_USER_AGENT = "x-amz-user-agent"; +const SPACE$1 = " "; +const UA_NAME_SEPARATOR = "/"; +const UA_NAME_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w]/g; +const UA_VALUE_ESCAPE_REGEX = /[^\!\$\%\&\'\*\+\-\.\^\_\`\|\~\d\w\#]/g; +const UA_ESCAPE_CHAR = "-"; +const userAgentMiddleware = (options) => (next, context2) => async (args) => { + var _a2, _b2; + const { request } = args; + if (!HttpRequest.isInstance(request)) + return next(args); + const { headers } = request; + const userAgent = ((_a2 = context2 == null ? void 0 : context2.userAgent) == null ? void 0 : _a2.map(escapeUserAgent)) || []; + const defaultUserAgent2 = (await options.defaultUserAgentProvider()).map(escapeUserAgent); + const customUserAgent = ((_b2 = options == null ? void 0 : options.customUserAgent) == null ? void 0 : _b2.map(escapeUserAgent)) || []; + const sdkUserAgentValue = [].concat([...defaultUserAgent2, ...userAgent, ...customUserAgent]).join(SPACE$1); + const normalUAValue = [ + ...defaultUserAgent2.filter((section) => section.startsWith("aws-sdk-")), + ...customUserAgent + ].join(SPACE$1); + if (options.runtime !== "browser") { + if (normalUAValue) { + headers[X_AMZ_USER_AGENT] = headers[X_AMZ_USER_AGENT] ? `${headers[USER_AGENT]} ${normalUAValue}` : normalUAValue; + } + headers[USER_AGENT] = sdkUserAgentValue; + } else { + headers[X_AMZ_USER_AGENT] = sdkUserAgentValue; + } + return next({ + ...args, + request + }); +}; +const escapeUserAgent = (userAgentPair) => { + var _a2; + const name2 = userAgentPair[0].split(UA_NAME_SEPARATOR).map((part) => part.replace(UA_NAME_ESCAPE_REGEX, UA_ESCAPE_CHAR)).join(UA_NAME_SEPARATOR); + const version2 = (_a2 = userAgentPair[1]) == null ? void 0 : _a2.replace(UA_VALUE_ESCAPE_REGEX, UA_ESCAPE_CHAR); + const prefixSeparatorIndex = name2.indexOf(UA_NAME_SEPARATOR); + const prefix = name2.substring(0, prefixSeparatorIndex); + let uaName = name2.substring(prefixSeparatorIndex + 1); + if (prefix === "api") { + uaName = uaName.toLowerCase(); + } + return [prefix, uaName, version2].filter((item2) => item2 && item2.length > 0).reduce((acc, item2, index2) => { + switch (index2) { + case 0: + return item2; + case 1: + return `${acc}/${item2}`; + default: + return `${acc}#${item2}`; + } + }, ""); +}; +const getUserAgentMiddlewareOptions = { + name: "getUserAgentMiddleware", + step: "build", + priority: "low", + tags: ["SET_USER_AGENT", "USER_AGENT"], + override: true +}; +const getUserAgentPlugin = (config2) => ({ + applyToStack: (clientStack) => { + clientStack.add(userAgentMiddleware(config2), getUserAgentMiddlewareOptions); + } +}); +var SelectorType; +(function(SelectorType2) { + SelectorType2["ENV"] = "env"; + SelectorType2["CONFIG"] = "shared config entry"; +})(SelectorType || (SelectorType = {})); +const DEFAULT_USE_DUALSTACK_ENDPOINT = false; +const DEFAULT_USE_FIPS_ENDPOINT = false; +const getSmithyContext = (context2) => context2[SMITHY_CONTEXT_KEY] || (context2[SMITHY_CONTEXT_KEY] = {}); +const normalizeProvider$1 = (input2) => { + if (typeof input2 === "function") + return input2; + const promisified = Promise.resolve(input2); + return () => promisified; +}; +const isFipsRegion = (region) => typeof region === "string" && (region.startsWith("fips-") || region.endsWith("-fips")); +const getRealRegion = (region) => isFipsRegion(region) ? ["fips-aws-global", "aws-fips"].includes(region) ? "us-east-1" : region.replace(/fips-(dkr-|prod-)?|-fips/, "") : region; +const resolveRegionConfig = (input2) => { + const { region, useFipsEndpoint } = input2; + if (!region) { + throw new Error("Region is missing"); + } + return { + ...input2, + region: async () => { + if (typeof region === "string") { + return getRealRegion(region); } - let result = []; - for (let i2 = 0; i2 < blocks[0].length; i2++) { - blocks.forEach((block, j2) => { - if (i2 != shortBlockLen - blockEccLen || j2 >= numShortBlocks) - result.push(block[i2]); - }); + const providedRegion = await region(); + return getRealRegion(providedRegion); + }, + useFipsEndpoint: async () => { + const providedRegion = typeof region === "string" ? region : await region(); + if (isFipsRegion(providedRegion)) { + return true; } - assert2(result.length == rawCodewords); - return result; + return typeof useFipsEndpoint !== "function" ? Promise.resolve(!!useFipsEndpoint) : useFipsEndpoint(); } - drawCodewords(data) { - if (data.length != Math.floor(_QrCode.getNumRawDataModules(this.version) / 8)) - throw new RangeError("Invalid argument"); - let i2 = 0; - for (let right = this.size - 1; right >= 1; right -= 2) { - if (right == 6) - right = 5; - for (let vert = 0; vert < this.size; vert++) { - for (let j2 = 0; j2 < 2; j2++) { - const x = right - j2; - const upward = (right + 1 & 2) == 0; - const y2 = upward ? this.size - 1 - vert : vert; - if (!this.isFunction[y2][x] && i2 < data.length * 8) { - this.modules[y2][x] = getBit(data[i2 >>> 3], 7 - (i2 & 7)); - i2++; - } - } - } - } - assert2(i2 == data.length * 8); - } - applyMask(mask) { - if (mask < 0 || mask > 7) - throw new RangeError("Mask value out of range"); - for (let y2 = 0; y2 < this.size; y2++) { - for (let x = 0; x < this.size; x++) { - let invert2; - switch (mask) { - case 0: - invert2 = (x + y2) % 2 == 0; - break; - case 1: - invert2 = y2 % 2 == 0; - break; - case 2: - invert2 = x % 3 == 0; - break; - case 3: - invert2 = (x + y2) % 3 == 0; - break; - case 4: - invert2 = (Math.floor(x / 3) + Math.floor(y2 / 2)) % 2 == 0; - break; - case 5: - invert2 = x * y2 % 2 + x * y2 % 3 == 0; - break; - case 6: - invert2 = (x * y2 % 2 + x * y2 % 3) % 2 == 0; - break; - case 7: - invert2 = ((x + y2) % 2 + x * y2 % 3) % 2 == 0; - break; - default: - throw new Error("Unreachable"); - } - if (!this.isFunction[y2][x] && invert2) - this.modules[y2][x] = !this.modules[y2][x]; - } - } - } - getPenaltyScore() { - let result = 0; - for (let y2 = 0; y2 < this.size; y2++) { - let runColor = false; - let runX = 0; - let runHistory = [0, 0, 0, 0, 0, 0, 0]; - for (let x = 0; x < this.size; x++) { - if (this.modules[y2][x] == runColor) { - runX++; - if (runX == 5) - result += _QrCode.PENALTY_N1; - else if (runX > 5) - result++; - } else { - this.finderPenaltyAddHistory(runX, runHistory); - if (!runColor) - result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3; - runColor = this.modules[y2][x]; - runX = 1; - } - } - result += this.finderPenaltyTerminateAndCount(runColor, runX, runHistory) * _QrCode.PENALTY_N3; - } - for (let x = 0; x < this.size; x++) { - let runColor = false; - let runY = 0; - let runHistory = [0, 0, 0, 0, 0, 0, 0]; - for (let y2 = 0; y2 < this.size; y2++) { - if (this.modules[y2][x] == runColor) { - runY++; - if (runY == 5) - result += _QrCode.PENALTY_N1; - else if (runY > 5) - result++; - } else { - this.finderPenaltyAddHistory(runY, runHistory); - if (!runColor) - result += this.finderPenaltyCountPatterns(runHistory) * _QrCode.PENALTY_N3; - runColor = this.modules[y2][x]; - runY = 1; - } - } - result += this.finderPenaltyTerminateAndCount(runColor, runY, runHistory) * _QrCode.PENALTY_N3; - } - for (let y2 = 0; y2 < this.size - 1; y2++) { - for (let x = 0; x < this.size - 1; x++) { - const color2 = this.modules[y2][x]; - if (color2 == this.modules[y2][x + 1] && color2 == this.modules[y2 + 1][x] && color2 == this.modules[y2 + 1][x + 1]) - result += _QrCode.PENALTY_N2; - } - } - let dark2 = 0; - for (const row of this.modules) - dark2 = row.reduce((sum, color2) => sum + (color2 ? 1 : 0), dark2); - const total = this.size * this.size; - const k2 = Math.ceil(Math.abs(dark2 * 20 - total * 10) / total) - 1; - assert2(0 <= k2 && k2 <= 9); - result += k2 * _QrCode.PENALTY_N4; - assert2(0 <= result && result <= 2568888); - return result; + }; +}; +function convertHttpAuthSchemesToMap(httpAuthSchemes) { + const map = /* @__PURE__ */ new Map(); + for (const scheme of httpAuthSchemes) { + map.set(scheme.schemeId, scheme); + } + return map; +} +const httpAuthSchemeMiddleware = (config2, mwOptions) => (next, context2) => async (args) => { + var _a2; + const options = config2.httpAuthSchemeProvider(await mwOptions.httpAuthSchemeParametersProvider(config2, context2, args.input)); + const authSchemes = convertHttpAuthSchemesToMap(config2.httpAuthSchemes); + const smithyContext = getSmithyContext(context2); + const failureReasons = []; + for (const option of options) { + const scheme = authSchemes.get(option.schemeId); + if (!scheme) { + failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` was not enabled for this service.`); + continue; } - getAlignmentPatternPositions() { - if (this.version == 1) - return []; - else { - const numAlign = Math.floor(this.version / 7) + 2; - const step = this.version == 32 ? 26 : Math.ceil((this.version * 4 + 4) / (numAlign * 2 - 2)) * 2; - let result = [6]; - for (let pos = this.size - 7; result.length < numAlign; pos -= step) - result.splice(1, 0, pos); - return result; - } + const identityProvider = scheme.identityProvider(await mwOptions.identityProviderConfigProvider(config2)); + if (!identityProvider) { + failureReasons.push(`HttpAuthScheme \`${option.schemeId}\` did not have an IdentityProvider configured.`); + continue; } - static getNumRawDataModules(ver) { - if (ver < _QrCode.MIN_VERSION || ver > _QrCode.MAX_VERSION) - throw new RangeError("Version number out of range"); - let result = (16 * ver + 128) * ver + 64; - if (ver >= 2) { - const numAlign = Math.floor(ver / 7) + 2; - result -= (25 * numAlign - 10) * numAlign - 55; - if (ver >= 7) - result -= 36; - } - assert2(208 <= result && result <= 29648); - return result; + const { identityProperties = {}, signingProperties = {} } = ((_a2 = option.propertiesExtractor) == null ? void 0 : _a2.call(option, config2, context2)) || {}; + option.identityProperties = Object.assign(option.identityProperties || {}, identityProperties); + option.signingProperties = Object.assign(option.signingProperties || {}, signingProperties); + smithyContext.selectedHttpAuthScheme = { + httpAuthOption: option, + identity: await identityProvider(option.identityProperties), + signer: scheme.signer + }; + break; + } + if (!smithyContext.selectedHttpAuthScheme) { + throw new Error(failureReasons.join("\n")); + } + return next(args); +}; +const resolveParamsForS3 = async (endpointParams) => { + const bucket = (endpointParams == null ? void 0 : endpointParams.Bucket) || ""; + if (typeof endpointParams.Bucket === "string") { + endpointParams.Bucket = bucket.replace(/#/g, encodeURIComponent("#")).replace(/\?/g, encodeURIComponent("?")); + } + if (isArnBucketName(bucket)) { + if (endpointParams.ForcePathStyle === true) { + throw new Error("Path-style addressing cannot be used with ARN buckets"); } - static getNumDataCodewords(ver, ecl) { - return Math.floor(_QrCode.getNumRawDataModules(ver) / 8) - _QrCode.ECC_CODEWORDS_PER_BLOCK[ecl.ordinal][ver] * _QrCode.NUM_ERROR_CORRECTION_BLOCKS[ecl.ordinal][ver]; + } else if (!isDnsCompatibleBucketName(bucket) || bucket.indexOf(".") !== -1 && !String(endpointParams.Endpoint).startsWith("http:") || bucket.toLowerCase() !== bucket || bucket.length < 3) { + endpointParams.ForcePathStyle = true; + } + if (endpointParams.DisableMultiRegionAccessPoints) { + endpointParams.disableMultiRegionAccessPoints = true; + endpointParams.DisableMRAP = true; + } + return endpointParams; +}; +const DOMAIN_PATTERN = /^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$/; +const IP_ADDRESS_PATTERN = /(\d+\.){3}\d+/; +const DOTS_PATTERN = /\.\./; +const isDnsCompatibleBucketName = (bucketName) => DOMAIN_PATTERN.test(bucketName) && !IP_ADDRESS_PATTERN.test(bucketName) && !DOTS_PATTERN.test(bucketName); +const isArnBucketName = (bucketName) => { + const [arn, partition2, service, , , bucket] = bucketName.split(":"); + const isArn = arn === "arn" && bucketName.split(":").length >= 6; + const isValidArn = Boolean(isArn && partition2 && service && bucket); + if (isArn && !isValidArn) { + throw new Error(`Invalid ARN: ${bucketName} was an invalid ARN.`); + } + return isValidArn; +}; +const createConfigValueProvider = (configKey, canonicalEndpointParamKey, config2) => { + const configProvider = async () => { + const configValue = config2[configKey] ?? config2[canonicalEndpointParamKey]; + if (typeof configValue === "function") { + return configValue(); } - static reedSolomonComputeDivisor(degree) { - if (degree < 1 || degree > 255) - throw new RangeError("Degree out of range"); - let result = []; - for (let i2 = 0; i2 < degree - 1; i2++) - result.push(0); - result.push(1); - let root2 = 1; - for (let i2 = 0; i2 < degree; i2++) { - for (let j2 = 0; j2 < result.length; j2++) { - result[j2] = _QrCode.reedSolomonMultiply(result[j2], root2); - if (j2 + 1 < result.length) - result[j2] ^= result[j2 + 1]; + return configValue; + }; + if (configKey === "credentialScope" || canonicalEndpointParamKey === "CredentialScope") { + return async () => { + const credentials = typeof config2.credentials === "function" ? await config2.credentials() : config2.credentials; + const configValue = (credentials == null ? void 0 : credentials.credentialScope) ?? (credentials == null ? void 0 : credentials.CredentialScope); + return configValue; + }; + } + if (configKey === "endpoint" || canonicalEndpointParamKey === "endpoint") { + return async () => { + const endpoint = await configProvider(); + if (endpoint && typeof endpoint === "object") { + if ("url" in endpoint) { + return endpoint.url.href; + } + if ("hostname" in endpoint) { + const { protocol, hostname, port, path } = endpoint; + return `${protocol}//${hostname}${port ? ":" + port : ""}${path}`; } - root2 = _QrCode.reedSolomonMultiply(root2, 2); - } - return result; - } - static reedSolomonComputeRemainder(data, divisor) { - let result = divisor.map((_) => 0); - for (const b2 of data) { - const factor = b2 ^ result.shift(); - result.push(0); - divisor.forEach((coef, i2) => result[i2] ^= _QrCode.reedSolomonMultiply(coef, factor)); } - return result; - } - static reedSolomonMultiply(x, y2) { - if (x >>> 8 != 0 || y2 >>> 8 != 0) - throw new RangeError("Byte out of range"); - let z = 0; - for (let i2 = 7; i2 >= 0; i2--) { - z = z << 1 ^ (z >>> 7) * 285; - z ^= (y2 >>> i2 & 1) * x; + return endpoint; + }; + } + return configProvider; +}; +const getEndpointFromConfig = async (serviceId) => void 0; +function parseQueryString(querystring) { + const query = {}; + querystring = querystring.replace(/^\?/, ""); + if (querystring) { + for (const pair of querystring.split("&")) { + let [key2, value = null] = pair.split("="); + key2 = decodeURIComponent(key2); + if (value) { + value = decodeURIComponent(value); } - assert2(z >>> 8 == 0); - return z; - } - finderPenaltyCountPatterns(runHistory) { - const n2 = runHistory[1]; - assert2(n2 <= this.size * 3); - const core2 = n2 > 0 && runHistory[2] == n2 && runHistory[3] == n2 * 3 && runHistory[4] == n2 && runHistory[5] == n2; - return (core2 && runHistory[0] >= n2 * 4 && runHistory[6] >= n2 ? 1 : 0) + (core2 && runHistory[6] >= n2 * 4 && runHistory[0] >= n2 ? 1 : 0); - } - finderPenaltyTerminateAndCount(currentRunColor, currentRunLength, runHistory) { - if (currentRunColor) { - this.finderPenaltyAddHistory(currentRunLength, runHistory); - currentRunLength = 0; + if (!(key2 in query)) { + query[key2] = value; + } else if (Array.isArray(query[key2])) { + query[key2].push(value); + } else { + query[key2] = [query[key2], value]; } - currentRunLength += this.size; - this.finderPenaltyAddHistory(currentRunLength, runHistory); - return this.finderPenaltyCountPatterns(runHistory); - } - finderPenaltyAddHistory(currentRunLength, runHistory) { - if (runHistory[0] == 0) - currentRunLength += this.size; - runHistory.pop(); - runHistory.unshift(currentRunLength); } - }; - let QrCode = _QrCode; - QrCode.MIN_VERSION = 1; - QrCode.MAX_VERSION = 40; - QrCode.PENALTY_N1 = 3; - QrCode.PENALTY_N2 = 3; - QrCode.PENALTY_N3 = 40; - QrCode.PENALTY_N4 = 10; - QrCode.ECC_CODEWORDS_PER_BLOCK = [ - [-1, 7, 10, 15, 20, 26, 18, 20, 24, 30, 18, 20, 24, 26, 30, 22, 24, 28, 30, 28, 28, 28, 28, 30, 30, 26, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - [-1, 10, 16, 26, 18, 24, 16, 18, 22, 22, 26, 30, 22, 22, 24, 24, 28, 28, 26, 26, 26, 26, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28], - [-1, 13, 22, 18, 26, 18, 24, 18, 22, 20, 24, 28, 26, 24, 20, 30, 24, 28, 28, 26, 30, 28, 30, 30, 30, 30, 28, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30], - [-1, 17, 28, 22, 16, 22, 28, 26, 26, 24, 28, 24, 28, 22, 24, 24, 30, 28, 28, 26, 28, 30, 24, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30] - ]; - QrCode.NUM_ERROR_CORRECTION_BLOCKS = [ - [-1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 4, 4, 4, 4, 4, 6, 6, 6, 6, 7, 8, 8, 9, 9, 10, 12, 12, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22, 24, 25], - [-1, 1, 1, 1, 2, 2, 4, 4, 4, 5, 5, 5, 8, 9, 9, 10, 10, 11, 13, 14, 16, 17, 17, 18, 20, 21, 23, 25, 26, 28, 29, 31, 33, 35, 37, 38, 40, 43, 45, 47, 49], - [-1, 1, 1, 2, 2, 4, 4, 6, 6, 8, 8, 8, 10, 12, 16, 12, 17, 16, 18, 21, 20, 23, 23, 25, 27, 29, 34, 34, 35, 38, 40, 43, 45, 48, 51, 53, 56, 59, 62, 65, 68], - [-1, 1, 1, 2, 4, 4, 4, 5, 6, 8, 8, 11, 11, 16, 16, 18, 16, 19, 21, 25, 25, 25, 34, 30, 32, 35, 37, 40, 42, 45, 48, 51, 54, 57, 60, 63, 66, 70, 74, 77, 81] - ]; - qrcodegen2.QrCode = QrCode; - function appendBits(val, len, bb2) { - if (len < 0 || len > 31 || val >>> len != 0) - throw new RangeError("Value out of range"); - for (let i2 = len - 1; i2 >= 0; i2--) - bb2.push(val >>> i2 & 1); } - function getBit(x, i2) { - return (x >>> i2 & 1) != 0; + return query; +} +const parseUrl = (url) => { + if (typeof url === "string") { + return parseUrl(new URL(url)); } - function assert2(cond) { - if (!cond) - throw new Error("Assertion error"); + const { hostname, pathname, port, protocol, search: search2 } = url; + let query; + if (search2) { + query = parseQueryString(search2); } - const _QrSegment = class { - constructor(mode, numChars, bitData) { - this.mode = mode; - this.numChars = numChars; - this.bitData = bitData; - if (numChars < 0) - throw new RangeError("Invalid argument"); - this.bitData = bitData.slice(); + return { + hostname, + port: port ? parseInt(port) : void 0, + protocol, + path: pathname, + query + }; +}; +const toEndpointV1 = (endpoint) => { + if (typeof endpoint === "object") { + if ("url" in endpoint) { + return parseUrl(endpoint.url); } - static makeBytes(data) { - let bb2 = []; - for (const b2 of data) - appendBits(b2, 8, bb2); - return new _QrSegment(_QrSegment.Mode.BYTE, data.length, bb2); + return endpoint; + } + return parseUrl(endpoint); +}; +const getEndpointFromInstructions = async (commandInput, instructionsSupplier, clientConfig, context2) => { + if (!clientConfig.endpoint) { + const endpointFromConfig = await getEndpointFromConfig(clientConfig.serviceId || ""); + if (endpointFromConfig) { + clientConfig.endpoint = () => Promise.resolve(toEndpointV1(endpointFromConfig)); } - static makeNumeric(digits) { - if (!_QrSegment.isNumeric(digits)) - throw new RangeError("String contains non-numeric characters"); - let bb2 = []; - for (let i2 = 0; i2 < digits.length; ) { - const n2 = Math.min(digits.length - i2, 3); - appendBits(parseInt(digits.substr(i2, n2), 10), n2 * 3 + 1, bb2); - i2 += n2; - } - return new _QrSegment(_QrSegment.Mode.NUMERIC, digits.length, bb2); + } + const endpointParams = await resolveParams(commandInput, instructionsSupplier, clientConfig); + if (typeof clientConfig.endpointProvider !== "function") { + throw new Error("config.endpointProvider is not set."); + } + const endpoint = clientConfig.endpointProvider(endpointParams, context2); + return endpoint; +}; +const resolveParams = async (commandInput, instructionsSupplier, clientConfig) => { + var _a2; + const endpointParams = {}; + const instructions = ((_a2 = instructionsSupplier == null ? void 0 : instructionsSupplier.getEndpointParameterInstructions) == null ? void 0 : _a2.call(instructionsSupplier)) || {}; + for (const [name2, instruction] of Object.entries(instructions)) { + switch (instruction.type) { + case "staticContextParams": + endpointParams[name2] = instruction.value; + break; + case "contextParams": + endpointParams[name2] = commandInput[instruction.name]; + break; + case "clientContextParams": + case "builtInParams": + endpointParams[name2] = await createConfigValueProvider(instruction.name, name2, clientConfig)(); + break; + default: + throw new Error("Unrecognized endpoint parameter instruction: " + JSON.stringify(instruction)); } - static makeAlphanumeric(text2) { - if (!_QrSegment.isAlphanumeric(text2)) - throw new RangeError("String contains unencodable characters in alphanumeric mode"); - let bb2 = []; - let i2; - for (i2 = 0; i2 + 2 <= text2.length; i2 += 2) { - let temp = _QrSegment.ALPHANUMERIC_CHARSET.indexOf(text2.charAt(i2)) * 45; - temp += _QrSegment.ALPHANUMERIC_CHARSET.indexOf(text2.charAt(i2 + 1)); - appendBits(temp, 11, bb2); + } + if (Object.keys(instructions).length === 0) { + Object.assign(endpointParams, clientConfig); + } + if (String(clientConfig.serviceId).toLowerCase() === "s3") { + await resolveParamsForS3(endpointParams); + } + return endpointParams; +}; +const endpointMiddleware = ({ config: config2, instructions }) => { + return (next, context2) => async (args) => { + var _a2, _b2, _c2; + const endpoint = await getEndpointFromInstructions(args.input, { + getEndpointParameterInstructions() { + return instructions; } - if (i2 < text2.length) - appendBits(_QrSegment.ALPHANUMERIC_CHARSET.indexOf(text2.charAt(i2)), 6, bb2); - return new _QrSegment(_QrSegment.Mode.ALPHANUMERIC, text2.length, bb2); - } - static makeSegments(text2) { - if (text2 == "") - return []; - else if (_QrSegment.isNumeric(text2)) - return [_QrSegment.makeNumeric(text2)]; - else if (_QrSegment.isAlphanumeric(text2)) - return [_QrSegment.makeAlphanumeric(text2)]; - else - return [_QrSegment.makeBytes(_QrSegment.toUtf8ByteArray(text2))]; - } - static makeEci(assignVal) { - let bb2 = []; - if (assignVal < 0) - throw new RangeError("ECI assignment value out of range"); - else if (assignVal < 1 << 7) - appendBits(assignVal, 8, bb2); - else if (assignVal < 1 << 14) { - appendBits(2, 2, bb2); - appendBits(assignVal, 14, bb2); - } else if (assignVal < 1e6) { - appendBits(6, 3, bb2); - appendBits(assignVal, 21, bb2); - } else - throw new RangeError("ECI assignment value out of range"); - return new _QrSegment(_QrSegment.Mode.ECI, 0, bb2); - } - static isNumeric(text2) { - return _QrSegment.NUMERIC_REGEX.test(text2); - } - static isAlphanumeric(text2) { - return _QrSegment.ALPHANUMERIC_REGEX.test(text2); - } - getData() { - return this.bitData.slice(); - } - static getTotalBits(segs, version2) { - let result = 0; - for (const seg of segs) { - const ccbits = seg.mode.numCharCountBits(version2); - if (seg.numChars >= 1 << ccbits) - return Infinity; - result += 4 + ccbits + seg.bitData.length; + }, { ...config2 }, context2); + context2.endpointV2 = endpoint; + context2.authSchemes = (_a2 = endpoint.properties) == null ? void 0 : _a2.authSchemes; + const authScheme = (_b2 = context2.authSchemes) == null ? void 0 : _b2[0]; + if (authScheme) { + context2["signing_region"] = authScheme.signingRegion; + context2["signing_service"] = authScheme.signingName; + const smithyContext = getSmithyContext(context2); + const httpAuthOption = (_c2 = smithyContext == null ? void 0 : smithyContext.selectedHttpAuthScheme) == null ? void 0 : _c2.httpAuthOption; + if (httpAuthOption) { + httpAuthOption.signingProperties = Object.assign(httpAuthOption.signingProperties || {}, { + signing_region: authScheme.signingRegion, + signingRegion: authScheme.signingRegion, + signing_service: authScheme.signingName, + signingName: authScheme.signingName, + signingRegionSet: authScheme.signingRegionSet + }, authScheme.properties); } - return result; } - static toUtf8ByteArray(str) { - str = encodeURI(str); - let result = []; - for (let i2 = 0; i2 < str.length; i2++) { - if (str.charAt(i2) != "%") - result.push(str.charCodeAt(i2)); - else { - result.push(parseInt(str.substr(i2 + 1, 2), 16)); - i2 += 2; + return next({ + ...args + }); + }; +}; +const deserializerMiddleware = (options, deserializer) => (next) => async (args) => { + const { response } = await next(args); + try { + const parsed = await deserializer(response, options); + return { + response, + output: parsed + }; + } catch (error) { + Object.defineProperty(error, "$response", { + value: response + }); + if (!("$metadata" in error)) { + const hint = `Deserialization error: to see the raw response, inspect the hidden field {error}.$response on this object.`; + error.message += "\n " + hint; + if (typeof error.$responseBodyText !== "undefined") { + if (error.$response) { + error.$response.body = error.$responseBodyText; } } - return result; } - }; - let QrSegment = _QrSegment; - QrSegment.NUMERIC_REGEX = /^[0-9]*$/; - QrSegment.ALPHANUMERIC_REGEX = /^[A-Z0-9 $%*+.\/:-]*$/; - QrSegment.ALPHANUMERIC_CHARSET = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:"; - qrcodegen2.QrSegment = QrSegment; -})(qrcodegen || (qrcodegen = {})); -((qrcodegen2) => { - ((QrCode2) => { - const _Ecc = class { - constructor(ordinal, formatBits) { - this.ordinal = ordinal; - this.formatBits = formatBits; - } - }; - let Ecc = _Ecc; - Ecc.LOW = new _Ecc(0, 1); - Ecc.MEDIUM = new _Ecc(1, 0); - Ecc.QUARTILE = new _Ecc(2, 3); - Ecc.HIGH = new _Ecc(3, 2); - QrCode2.Ecc = Ecc; - })(qrcodegen2.QrCode || (qrcodegen2.QrCode = {})); -})(qrcodegen || (qrcodegen = {})); -((qrcodegen2) => { - ((QrSegment2) => { - const _Mode = class { - constructor(modeBits, numBitsCharCount) { - this.modeBits = modeBits; - this.numBitsCharCount = numBitsCharCount; - } - numCharCountBits(ver) { - return this.numBitsCharCount[Math.floor((ver + 7) / 17)]; - } - }; - let Mode = _Mode; - Mode.NUMERIC = new _Mode(1, [10, 12, 14]); - Mode.ALPHANUMERIC = new _Mode(2, [9, 11, 13]); - Mode.BYTE = new _Mode(4, [8, 16, 16]); - Mode.KANJI = new _Mode(8, [8, 10, 12]); - Mode.ECI = new _Mode(7, [0, 0, 0]); - QrSegment2.Mode = Mode; - })(qrcodegen2.QrSegment || (qrcodegen2.QrSegment = {})); -})(qrcodegen || (qrcodegen = {})); -var qrcodegen_default = qrcodegen; -/** - * @license qrcode.react - * Copyright (c) Paul O'Shannessy - * SPDX-License-Identifier: ISC - */ -var ERROR_LEVEL_MAP = { - L: qrcodegen_default.QrCode.Ecc.LOW, - M: qrcodegen_default.QrCode.Ecc.MEDIUM, - Q: qrcodegen_default.QrCode.Ecc.QUARTILE, - H: qrcodegen_default.QrCode.Ecc.HIGH + throw error; + } }; -var DEFAULT_SIZE = 128; -var DEFAULT_LEVEL = "L"; -var DEFAULT_BGCOLOR = "#FFFFFF"; -var DEFAULT_FGCOLOR = "#000000"; -var DEFAULT_INCLUDEMARGIN = false; -var MARGIN_SIZE = 4; -var DEFAULT_IMG_SCALE = 0.1; -function generatePath(modules, margin = 0) { - const ops = []; - modules.forEach(function(row, y2) { - let start = null; - row.forEach(function(cell, x) { - if (!cell && start !== null) { - ops.push(`M${start + margin} ${y2 + margin}h${x - start}v1H${start + margin}z`); - start = null; - return; - } - if (x === row.length - 1) { - if (!cell) { - return; - } - if (start === null) { - ops.push(`M${x + margin},${y2 + margin} h1v1H${x + margin}z`); - } else { - ops.push(`M${start + margin},${y2 + margin} h${x + 1 - start}v1H${start + margin}z`); - } - return; - } - if (cell && start === null) { - start = x; - } - }); +const serializerMiddleware = (options, serializer) => (next, context2) => async (args) => { + var _a2; + const endpoint = ((_a2 = context2.endpointV2) == null ? void 0 : _a2.url) && options.urlParser ? async () => options.urlParser(context2.endpointV2.url) : options.endpoint; + if (!endpoint) { + throw new Error("No valid endpoint provider available."); + } + const request = await serializer(args.input, { ...options, endpoint }); + return next({ + ...args, + request }); - return ops.join(""); -} -function excavateModules(modules, excavation) { - return modules.slice().map((row, y2) => { - if (y2 < excavation.y || y2 >= excavation.y + excavation.h) { - return row; +}; +const deserializerMiddlewareOption = { + name: "deserializerMiddleware", + step: "deserialize", + tags: ["DESERIALIZER"], + override: true +}; +const serializerMiddlewareOption = { + name: "serializerMiddleware", + step: "serialize", + tags: ["SERIALIZER"], + override: true +}; +function getSerdePlugin(config2, serializer, deserializer) { + return { + applyToStack: (commandStack) => { + commandStack.add(deserializerMiddleware(config2, deserializer), deserializerMiddlewareOption); + commandStack.add(serializerMiddleware(config2, serializer), serializerMiddlewareOption); } - return row.map((cell, x) => { - if (x < excavation.x || x >= excavation.x + excavation.w) { - return cell; - } - return false; - }); - }); + }; } -function getImageSettings(cells, size2, includeMargin, imageSettings) { - if (imageSettings == null) { - return null; +const endpointMiddlewareOptions = { + step: "serialize", + tags: ["ENDPOINT_PARAMETERS", "ENDPOINT_V2", "ENDPOINT"], + name: "endpointV2Middleware", + override: true, + relation: "before", + toMiddleware: serializerMiddlewareOption.name +}; +const getEndpointPlugin = (config2, instructions) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(endpointMiddleware({ + config: config2, + instructions + }), endpointMiddlewareOptions); } - const margin = includeMargin ? MARGIN_SIZE : 0; - const numCells = cells.length + margin * 2; - const defaultSize = Math.floor(size2 * DEFAULT_IMG_SCALE); - const scale2 = numCells / size2; - const w2 = (imageSettings.width || defaultSize) * scale2; - const h2 = (imageSettings.height || defaultSize) * scale2; - const x = imageSettings.x == null ? cells.length / 2 - w2 / 2 : imageSettings.x * scale2; - const y2 = imageSettings.y == null ? cells.length / 2 - h2 / 2 : imageSettings.y * scale2; - let excavation = null; - if (imageSettings.excavate) { - let floorX = Math.floor(x); - let floorY = Math.floor(y2); - let ceilW = Math.ceil(w2 + x - floorX); - let ceilH = Math.ceil(h2 + y2 - floorY); - excavation = { x: floorX, y: floorY, w: ceilW, h: ceilH }; +}); +const resolveEndpointConfig = (input2) => { + const tls = input2.tls ?? true; + const { endpoint } = input2; + const customEndpointProvider = endpoint != null ? async () => toEndpointV1(await normalizeProvider$1(endpoint)()) : void 0; + const isCustomEndpoint = !!endpoint; + return { + ...input2, + endpoint: customEndpointProvider, + tls, + isCustomEndpoint, + useDualstackEndpoint: normalizeProvider$1(input2.useDualstackEndpoint ?? false), + useFipsEndpoint: normalizeProvider$1(input2.useFipsEndpoint ?? false) + }; +}; +const httpAuthSchemeEndpointRuleSetMiddlewareOptions = { + step: "serialize", + tags: ["HTTP_AUTH_SCHEME"], + name: "httpAuthSchemeMiddleware", + override: true, + relation: "before", + toMiddleware: endpointMiddlewareOptions.name +}; +const getHttpAuthSchemeEndpointRuleSetPlugin = (config2, { httpAuthSchemeParametersProvider, identityProviderConfigProvider }) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(httpAuthSchemeMiddleware(config2, { + httpAuthSchemeParametersProvider, + identityProviderConfigProvider + }), httpAuthSchemeEndpointRuleSetMiddlewareOptions); } - return { x, y: y2, h: h2, w: w2, excavation }; -} -var SUPPORTS_PATH2D = function() { - try { - new Path2D().addPath(new Path2D()); - } catch (e2) { - return false; +}); +({ + step: "serialize", + tags: ["HTTP_AUTH_SCHEME"], + name: "httpAuthSchemeMiddleware", + override: true, + relation: "before", + toMiddleware: serializerMiddlewareOption.name +}); +const defaultErrorHandler = (signingProperties) => (error) => { + throw error; +}; +const defaultSuccessHandler = (httpResponse, signingProperties) => { +}; +const httpSigningMiddleware = (config2) => (next, context2) => async (args) => { + if (!HttpRequest.isInstance(args.request)) { + return next(args); } - return true; -}(); -function QRCodeCanvas(props) { - const _a2 = props, { - value, - size: size2 = DEFAULT_SIZE, - level = DEFAULT_LEVEL, - bgColor = DEFAULT_BGCOLOR, - fgColor = DEFAULT_FGCOLOR, - includeMargin = DEFAULT_INCLUDEMARGIN, - style, - imageSettings - } = _a2, otherProps = __objRest(_a2, [ - "value", - "size", - "level", - "bgColor", - "fgColor", - "includeMargin", - "style", - "imageSettings" - ]); - const imgSrc = imageSettings == null ? void 0 : imageSettings.src; - const _canvas = reactExports.useRef(null); - const _image = reactExports.useRef(null); - const [isImgLoaded, setIsImageLoaded] = reactExports.useState(false); - reactExports.useEffect(() => { - if (_canvas.current != null) { - const canvas = _canvas.current; - const ctx = canvas.getContext("2d"); - if (!ctx) { - return; - } - let cells = qrcodegen_default.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules(); - const margin = includeMargin ? MARGIN_SIZE : 0; - const numCells = cells.length + margin * 2; - const calculatedImageSettings = getImageSettings(cells, size2, includeMargin, imageSettings); - const image = _image.current; - const haveImageToRender = calculatedImageSettings != null && image !== null && image.complete && image.naturalHeight !== 0 && image.naturalWidth !== 0; - if (haveImageToRender) { - if (calculatedImageSettings.excavation != null) { - cells = excavateModules(cells, calculatedImageSettings.excavation); - } - } - const pixelRatio = window.devicePixelRatio || 1; - canvas.height = canvas.width = size2 * pixelRatio; - const scale2 = size2 / numCells * pixelRatio; - ctx.scale(scale2, scale2); - ctx.fillStyle = bgColor; - ctx.fillRect(0, 0, numCells, numCells); - ctx.fillStyle = fgColor; - if (SUPPORTS_PATH2D) { - ctx.fill(new Path2D(generatePath(cells, margin))); - } else { - cells.forEach(function(row, rdx) { - row.forEach(function(cell, cdx) { - if (cell) { - ctx.fillRect(cdx + margin, rdx + margin, 1, 1); - } - }); - }); - } - if (haveImageToRender) { - ctx.drawImage(image, calculatedImageSettings.x + margin, calculatedImageSettings.y + margin, calculatedImageSettings.w, calculatedImageSettings.h); - } - } - }); - reactExports.useEffect(() => { - setIsImageLoaded(false); - }, [imgSrc]); - const canvasStyle = __spreadValues({ height: size2, width: size2 }, style); - let img2 = null; - if (imgSrc != null) { - img2 = /* @__PURE__ */ React.createElement("img", { - src: imgSrc, - key: imgSrc, - style: { display: "none" }, - onLoad: () => { - setIsImageLoaded(true); - }, - ref: _image - }); + const smithyContext = getSmithyContext(context2); + const scheme = smithyContext.selectedHttpAuthScheme; + if (!scheme) { + throw new Error(`No HttpAuthScheme was selected: unable to sign request`); } - return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("canvas", __spreadValues({ - style: canvasStyle, - height: size2, - width: size2, - ref: _canvas - }, otherProps)), img2); -} -function QRCodeSVG(props) { - const _a2 = props, { - value, - size: size2 = DEFAULT_SIZE, - level = DEFAULT_LEVEL, - bgColor = DEFAULT_BGCOLOR, - fgColor = DEFAULT_FGCOLOR, - includeMargin = DEFAULT_INCLUDEMARGIN, - imageSettings - } = _a2, otherProps = __objRest(_a2, [ - "value", - "size", - "level", - "bgColor", - "fgColor", - "includeMargin", - "imageSettings" - ]); - let cells = qrcodegen_default.QrCode.encodeText(value, ERROR_LEVEL_MAP[level]).getModules(); - const margin = includeMargin ? MARGIN_SIZE : 0; - const numCells = cells.length + margin * 2; - const calculatedImageSettings = getImageSettings(cells, size2, includeMargin, imageSettings); - let image = null; - if (imageSettings != null && calculatedImageSettings != null) { - if (calculatedImageSettings.excavation != null) { - cells = excavateModules(cells, calculatedImageSettings.excavation); + const { httpAuthOption: { signingProperties = {} }, identity, signer: signer2 } = scheme; + const output2 = await next({ + ...args, + request: await signer2.sign(args.request, identity, signingProperties) + }).catch((signer2.errorHandler || defaultErrorHandler)(signingProperties)); + (signer2.successHandler || defaultSuccessHandler)(output2.response, signingProperties); + return output2; +}; +var RETRY_MODES; +(function(RETRY_MODES2) { + RETRY_MODES2["STANDARD"] = "standard"; + RETRY_MODES2["ADAPTIVE"] = "adaptive"; +})(RETRY_MODES || (RETRY_MODES = {})); +const DEFAULT_MAX_ATTEMPTS = 3; +const DEFAULT_RETRY_MODE = RETRY_MODES.STANDARD; +const THROTTLING_ERROR_CODES = [ + "BandwidthLimitExceeded", + "EC2ThrottledException", + "LimitExceededException", + "PriorRequestNotComplete", + "ProvisionedThroughputExceededException", + "RequestLimitExceeded", + "RequestThrottled", + "RequestThrottledException", + "SlowDown", + "ThrottledException", + "Throttling", + "ThrottlingException", + "TooManyRequestsException", + "TransactionInProgressException" +]; +const TRANSIENT_ERROR_CODES = ["TimeoutError", "RequestTimeout", "RequestTimeoutException"]; +const TRANSIENT_ERROR_STATUS_CODES = [500, 502, 503, 504]; +const NODEJS_TIMEOUT_ERROR_CODES = ["ECONNRESET", "ECONNREFUSED", "EPIPE", "ETIMEDOUT"]; +const isClockSkewCorrectedError = (error) => { + var _a2; + return (_a2 = error.$metadata) == null ? void 0 : _a2.clockSkewCorrected; +}; +const isThrottlingError = (error) => { + var _a2, _b2; + return ((_a2 = error.$metadata) == null ? void 0 : _a2.httpStatusCode) === 429 || THROTTLING_ERROR_CODES.includes(error.name) || ((_b2 = error.$retryable) == null ? void 0 : _b2.throttling) == true; +}; +const isTransientError = (error) => { + var _a2; + return isClockSkewCorrectedError(error) || TRANSIENT_ERROR_CODES.includes(error.name) || NODEJS_TIMEOUT_ERROR_CODES.includes((error == null ? void 0 : error.code) || "") || TRANSIENT_ERROR_STATUS_CODES.includes(((_a2 = error.$metadata) == null ? void 0 : _a2.httpStatusCode) || 0); +}; +const isServerError = (error) => { + var _a2; + if (((_a2 = error.$metadata) == null ? void 0 : _a2.httpStatusCode) !== void 0) { + const statusCode = error.$metadata.httpStatusCode; + if (500 <= statusCode && statusCode <= 599 && !isTransientError(error)) { + return true; } - image = /* @__PURE__ */ React.createElement("image", { - xlinkHref: imageSettings.src, - height: calculatedImageSettings.h, - width: calculatedImageSettings.w, - x: calculatedImageSettings.x + margin, - y: calculatedImageSettings.y + margin, - preserveAspectRatio: "none" - }); - } - const fgPath = generatePath(cells, margin); - return /* @__PURE__ */ React.createElement("svg", __spreadValues({ - height: size2, - width: size2, - viewBox: `0 0 ${numCells} ${numCells}` - }, otherProps), /* @__PURE__ */ React.createElement("path", { - fill: bgColor, - d: `M0,0 h${numCells}v${numCells}H0z`, - shapeRendering: "crispEdges" - }), /* @__PURE__ */ React.createElement("path", { - fill: fgColor, - d: fgPath, - shapeRendering: "crispEdges" - }), image); -} -var QRCode = (props) => { - const _a2 = props, { renderAs } = _a2, otherProps = __objRest(_a2, ["renderAs"]); - if (renderAs === "svg") { - return /* @__PURE__ */ React.createElement(QRCodeSVG, __spreadValues({}, otherProps)); + return false; } - return /* @__PURE__ */ React.createElement(QRCodeCanvas, __spreadValues({}, otherProps)); + return false; }; -var Component = {}; -var toggleSelection = function() { - var selection = document.getSelection(); - if (!selection.rangeCount) { - return function() { - }; +class DefaultRateLimiter { + constructor(options) { + this.currentCapacity = 0; + this.enabled = false; + this.lastMaxRate = 0; + this.measuredTxRate = 0; + this.requestCount = 0; + this.lastTimestamp = 0; + this.timeWindow = 0; + this.beta = (options == null ? void 0 : options.beta) ?? 0.7; + this.minCapacity = (options == null ? void 0 : options.minCapacity) ?? 1; + this.minFillRate = (options == null ? void 0 : options.minFillRate) ?? 0.5; + this.scaleConstant = (options == null ? void 0 : options.scaleConstant) ?? 0.4; + this.smooth = (options == null ? void 0 : options.smooth) ?? 0.8; + const currentTimeInSeconds = this.getCurrentTimeInSeconds(); + this.lastThrottleTime = currentTimeInSeconds; + this.lastTxRateBucket = Math.floor(this.getCurrentTimeInSeconds()); + this.fillRate = this.minFillRate; + this.maxCapacity = this.minCapacity; } - var active = document.activeElement; - var ranges = []; - for (var i2 = 0; i2 < selection.rangeCount; i2++) { - ranges.push(selection.getRangeAt(i2)); + getCurrentTimeInSeconds() { + return Date.now() / 1e3; } - switch (active.tagName.toUpperCase()) { - case "INPUT": - case "TEXTAREA": - active.blur(); - break; - default: - active = null; - break; + async getSendToken() { + return this.acquireTokenBucket(1); } - selection.removeAllRanges(); - return function() { - selection.type === "Caret" && selection.removeAllRanges(); - if (!selection.rangeCount) { - ranges.forEach(function(range2) { - selection.addRange(range2); - }); + async acquireTokenBucket(amount) { + if (!this.enabled) { + return; } - active && active.focus(); - }; -}; -var deselectCurrent = toggleSelection; -var clipboardToIE11Formatting = { - "text/plain": "Text", - "text/html": "Url", - "default": "Text" -}; -var defaultMessage = "Copy to clipboard: #{key}, Enter"; -function format$1(message) { - var copyKey = (/mac os x/i.test(navigator.userAgent) ? "⌘" : "Ctrl") + "+C"; - return message.replace(/#{\s*key\s*}/g, copyKey); -} -function copy(text2, options) { - var debug2, message, reselectPrevious, range2, selection, mark, success = false; - if (!options) { - options = {}; + this.refillTokenBucket(); + if (amount > this.currentCapacity) { + const delay2 = (amount - this.currentCapacity) / this.fillRate * 1e3; + await new Promise((resolve) => setTimeout(resolve, delay2)); + } + this.currentCapacity = this.currentCapacity - amount; } - debug2 = options.debug || false; - try { - reselectPrevious = deselectCurrent(); - range2 = document.createRange(); - selection = document.getSelection(); - mark = document.createElement("span"); - mark.textContent = text2; - mark.ariaHidden = "true"; - mark.style.all = "unset"; - mark.style.position = "fixed"; - mark.style.top = 0; - mark.style.clip = "rect(0, 0, 0, 0)"; - mark.style.whiteSpace = "pre"; - mark.style.webkitUserSelect = "text"; - mark.style.MozUserSelect = "text"; - mark.style.msUserSelect = "text"; - mark.style.userSelect = "text"; - mark.addEventListener("copy", function(e2) { - e2.stopPropagation(); - if (options.format) { - e2.preventDefault(); - if (typeof e2.clipboardData === "undefined") { - debug2 && console.warn("unable to use e.clipboardData"); - debug2 && console.warn("trying IE specific stuff"); - window.clipboardData.clearData(); - var format2 = clipboardToIE11Formatting[options.format] || clipboardToIE11Formatting["default"]; - window.clipboardData.setData(format2, text2); - } else { - e2.clipboardData.clearData(); - e2.clipboardData.setData(options.format, text2); - } - } - if (options.onCopy) { - e2.preventDefault(); - options.onCopy(e2.clipboardData); - } - }); - document.body.appendChild(mark); - range2.selectNodeContents(mark); - selection.addRange(range2); - var successful = document.execCommand("copy"); - if (!successful) { - throw new Error("copy command was unsuccessful"); - } - success = true; - } catch (err) { - debug2 && console.error("unable to copy using execCommand: ", err); - debug2 && console.warn("trying IE specific stuff"); - try { - window.clipboardData.setData(options.format || "text", text2); - options.onCopy && options.onCopy(window.clipboardData); - success = true; - } catch (err2) { - debug2 && console.error("unable to copy using clipboardData: ", err2); - debug2 && console.error("falling back to prompt"); - message = format$1("message" in options ? options.message : defaultMessage); - window.prompt(message, text2); + refillTokenBucket() { + const timestamp = this.getCurrentTimeInSeconds(); + if (!this.lastTimestamp) { + this.lastTimestamp = timestamp; + return; } - } finally { - if (selection) { - if (typeof selection.removeRange == "function") { - selection.removeRange(range2); - } else { - selection.removeAllRanges(); - } + const fillAmount = (timestamp - this.lastTimestamp) * this.fillRate; + this.currentCapacity = Math.min(this.maxCapacity, this.currentCapacity + fillAmount); + this.lastTimestamp = timestamp; + } + updateClientSendingRate(response) { + let calculatedRate; + this.updateMeasuredRate(); + if (isThrottlingError(response)) { + const rateToUse = !this.enabled ? this.measuredTxRate : Math.min(this.measuredTxRate, this.fillRate); + this.lastMaxRate = rateToUse; + this.calculateTimeWindow(); + this.lastThrottleTime = this.getCurrentTimeInSeconds(); + calculatedRate = this.cubicThrottle(rateToUse); + this.enableTokenBucket(); + } else { + this.calculateTimeWindow(); + calculatedRate = this.cubicSuccess(this.getCurrentTimeInSeconds()); } - if (mark) { - document.body.removeChild(mark); + const newRate = Math.min(calculatedRate, 2 * this.measuredTxRate); + this.updateTokenBucketRate(newRate); + } + calculateTimeWindow() { + this.timeWindow = this.getPrecise(Math.pow(this.lastMaxRate * (1 - this.beta) / this.scaleConstant, 1 / 3)); + } + cubicThrottle(rateToUse) { + return this.getPrecise(rateToUse * this.beta); + } + cubicSuccess(timestamp) { + return this.getPrecise(this.scaleConstant * Math.pow(timestamp - this.lastThrottleTime - this.timeWindow, 3) + this.lastMaxRate); + } + enableTokenBucket() { + this.enabled = true; + } + updateTokenBucketRate(newRate) { + this.refillTokenBucket(); + this.fillRate = Math.max(newRate, this.minFillRate); + this.maxCapacity = Math.max(newRate, this.minCapacity); + this.currentCapacity = Math.min(this.currentCapacity, this.maxCapacity); + } + updateMeasuredRate() { + const t2 = this.getCurrentTimeInSeconds(); + const timeBucket = Math.floor(t2 * 2) / 2; + this.requestCount++; + if (timeBucket > this.lastTxRateBucket) { + const currentRate = this.requestCount / (timeBucket - this.lastTxRateBucket); + this.measuredTxRate = this.getPrecise(currentRate * this.smooth + this.measuredTxRate * (1 - this.smooth)); + this.requestCount = 0; + this.lastTxRateBucket = timeBucket; } - reselectPrevious(); } - return success; -} -var copyToClipboard = copy; -function _typeof(obj) { - "@babel/helpers - typeof"; - return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { - return typeof obj2; - } : function(obj2) { - return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; - }, _typeof(obj); -} -Object.defineProperty(Component, "__esModule", { - value: true -}); -Component.CopyToClipboard = void 0; -var _react = _interopRequireDefault(reactExports); -var _copyToClipboard = _interopRequireDefault(copyToClipboard); -var _excluded$3 = ["text", "onCopy", "options", "children"]; -function _interopRequireDefault(obj) { - return obj && obj.__esModule ? obj : { "default": obj }; -} -function ownKeys(object, enumerableOnly) { - var keys = Object.keys(object); - if (Object.getOwnPropertySymbols) { - var symbols = Object.getOwnPropertySymbols(object); - enumerableOnly && (symbols = symbols.filter(function(sym) { - return Object.getOwnPropertyDescriptor(object, sym).enumerable; - })), keys.push.apply(keys, symbols); + getPrecise(num) { + return parseFloat(num.toFixed(8)); } - return keys; } -function _objectSpread(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = null != arguments[i2] ? arguments[i2] : {}; - i2 % 2 ? ownKeys(Object(source), true).forEach(function(key2) { - _defineProperty(target, key2, source[key2]); - }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key2) { - Object.defineProperty(target, key2, Object.getOwnPropertyDescriptor(source, key2)); +const DEFAULT_RETRY_DELAY_BASE = 100; +const MAXIMUM_RETRY_DELAY = 20 * 1e3; +const THROTTLING_RETRY_DELAY_BASE = 500; +const INITIAL_RETRY_TOKENS = 500; +const RETRY_COST = 5; +const TIMEOUT_RETRY_COST = 10; +const NO_RETRY_INCREMENT = 1; +const INVOCATION_ID_HEADER = "amz-sdk-invocation-id"; +const REQUEST_HEADER = "amz-sdk-request"; +const getDefaultRetryBackoffStrategy = () => { + let delayBase = DEFAULT_RETRY_DELAY_BASE; + const computeNextBackoffDelay = (attempts) => { + return Math.floor(Math.min(MAXIMUM_RETRY_DELAY, Math.random() * 2 ** attempts * delayBase)); + }; + const setDelayBase = (delay2) => { + delayBase = delay2; + }; + return { + computeNextBackoffDelay, + setDelayBase + }; +}; +const createDefaultRetryToken = ({ retryDelay, retryCount, retryCost }) => { + const getRetryCount = () => retryCount; + const getRetryDelay = () => Math.min(MAXIMUM_RETRY_DELAY, retryDelay); + const getRetryCost = () => retryCost; + return { + getRetryCount, + getRetryDelay, + getRetryCost + }; +}; +class StandardRetryStrategy { + constructor(maxAttempts) { + this.maxAttempts = maxAttempts; + this.mode = RETRY_MODES.STANDARD; + this.capacity = INITIAL_RETRY_TOKENS; + this.retryBackoffStrategy = getDefaultRetryBackoffStrategy(); + this.maxAttemptsProvider = typeof maxAttempts === "function" ? maxAttempts : async () => maxAttempts; + } + async acquireInitialRetryToken(retryTokenScope) { + return createDefaultRetryToken({ + retryDelay: DEFAULT_RETRY_DELAY_BASE, + retryCount: 0 }); } - return target; -} -function _objectWithoutProperties(source, excluded) { - if (source == null) - return {}; - var target = _objectWithoutPropertiesLoose$1(source, excluded); - var key2, i2; - if (Object.getOwnPropertySymbols) { - var sourceSymbolKeys = Object.getOwnPropertySymbols(source); - for (i2 = 0; i2 < sourceSymbolKeys.length; i2++) { - key2 = sourceSymbolKeys[i2]; - if (excluded.indexOf(key2) >= 0) - continue; - if (!Object.prototype.propertyIsEnumerable.call(source, key2)) - continue; - target[key2] = source[key2]; + async refreshRetryTokenForRetry(token, errorInfo) { + const maxAttempts = await this.getMaxAttempts(); + if (this.shouldRetry(token, errorInfo, maxAttempts)) { + const errorType = errorInfo.errorType; + this.retryBackoffStrategy.setDelayBase(errorType === "THROTTLING" ? THROTTLING_RETRY_DELAY_BASE : DEFAULT_RETRY_DELAY_BASE); + const delayFromErrorType = this.retryBackoffStrategy.computeNextBackoffDelay(token.getRetryCount()); + const retryDelay = errorInfo.retryAfterHint ? Math.max(errorInfo.retryAfterHint.getTime() - Date.now() || 0, delayFromErrorType) : delayFromErrorType; + const capacityCost = this.getCapacityCost(errorType); + this.capacity -= capacityCost; + return createDefaultRetryToken({ + retryDelay, + retryCount: token.getRetryCount() + 1, + retryCost: capacityCost + }); } + throw new Error("No retry token available"); } - return target; -} -function _objectWithoutPropertiesLoose$1(source, excluded) { - if (source == null) - return {}; - var target = {}; - var sourceKeys = Object.keys(source); - var key2, i2; - for (i2 = 0; i2 < sourceKeys.length; i2++) { - key2 = sourceKeys[i2]; - if (excluded.indexOf(key2) >= 0) - continue; - target[key2] = source[key2]; + recordSuccess(token) { + this.capacity = Math.max(INITIAL_RETRY_TOKENS, this.capacity + (token.getRetryCost() ?? NO_RETRY_INCREMENT)); + } + getCapacity() { + return this.capacity; + } + async getMaxAttempts() { + try { + return await this.maxAttemptsProvider(); + } catch (error) { + console.warn(`Max attempts provider could not resolve. Using default of ${DEFAULT_MAX_ATTEMPTS}`); + return DEFAULT_MAX_ATTEMPTS; + } + } + shouldRetry(tokenToRenew, errorInfo, maxAttempts) { + const attempts = tokenToRenew.getRetryCount() + 1; + return attempts < maxAttempts && this.capacity >= this.getCapacityCost(errorInfo.errorType) && this.isRetryableError(errorInfo.errorType); + } + getCapacityCost(errorType) { + return errorType === "TRANSIENT" ? TIMEOUT_RETRY_COST : RETRY_COST; + } + isRetryableError(errorType) { + return errorType === "THROTTLING" || errorType === "TRANSIENT"; } - return target; } -function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); +class AdaptiveRetryStrategy { + constructor(maxAttemptsProvider, options) { + this.maxAttemptsProvider = maxAttemptsProvider; + this.mode = RETRY_MODES.ADAPTIVE; + const { rateLimiter } = options ?? {}; + this.rateLimiter = rateLimiter ?? new DefaultRateLimiter(); + this.standardRetryStrategy = new StandardRetryStrategy(maxAttemptsProvider); + } + async acquireInitialRetryToken(retryTokenScope) { + await this.rateLimiter.getSendToken(); + return this.standardRetryStrategy.acquireInitialRetryToken(retryTokenScope); + } + async refreshRetryTokenForRetry(tokenToRenew, errorInfo) { + this.rateLimiter.updateClientSendingRate(errorInfo); + return this.standardRetryStrategy.refreshRetryTokenForRetry(tokenToRenew, errorInfo); + } + recordSuccess(token) { + this.rateLimiter.updateClientSendingRate({}); + this.standardRetryStrategy.recordSuccess(token); } } -function _defineProperties(target, props) { - for (var i2 = 0; i2 < props.length; i2++) { - var descriptor = props[i2]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) - descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); +let getRandomValues$2; +const rnds8$1 = new Uint8Array(16); +function rng$1() { + if (!getRandomValues$2) { + getRandomValues$2 = typeof crypto !== "undefined" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto); + if (!getRandomValues$2) { + throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported"); + } } + return getRandomValues$2(rnds8$1); } -function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) - _defineProperties(Constructor.prototype, protoProps); - Object.defineProperty(Constructor, "prototype", { writable: false }); - return Constructor; +const byteToHex$1 = []; +for (let i = 0; i < 256; ++i) { + byteToHex$1.push((i + 256).toString(16).slice(1)); } -function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); - Object.defineProperty(subClass, "prototype", { writable: false }); - if (superClass) - _setPrototypeOf(subClass, superClass); +function unsafeStringify$1(arr, offset2 = 0) { + return byteToHex$1[arr[offset2 + 0]] + byteToHex$1[arr[offset2 + 1]] + byteToHex$1[arr[offset2 + 2]] + byteToHex$1[arr[offset2 + 3]] + "-" + byteToHex$1[arr[offset2 + 4]] + byteToHex$1[arr[offset2 + 5]] + "-" + byteToHex$1[arr[offset2 + 6]] + byteToHex$1[arr[offset2 + 7]] + "-" + byteToHex$1[arr[offset2 + 8]] + byteToHex$1[arr[offset2 + 9]] + "-" + byteToHex$1[arr[offset2 + 10]] + byteToHex$1[arr[offset2 + 11]] + byteToHex$1[arr[offset2 + 12]] + byteToHex$1[arr[offset2 + 13]] + byteToHex$1[arr[offset2 + 14]] + byteToHex$1[arr[offset2 + 15]]; } -function _setPrototypeOf(o2, p2) { - _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o3, p3) { - o3.__proto__ = p3; - return o3; - }; - return _setPrototypeOf(o2, p2); +const randomUUID$1 = typeof crypto !== "undefined" && crypto.randomUUID && crypto.randomUUID.bind(crypto); +const native$1 = { + randomUUID: randomUUID$1 +}; +function v4$1(options, buf, offset2) { + if (native$1.randomUUID && !buf && !options) { + return native$1.randomUUID(); + } + options = options || {}; + const rnds = options.random || (options.rng || rng$1)(); + rnds[6] = rnds[6] & 15 | 64; + rnds[8] = rnds[8] & 63 | 128; + return unsafeStringify$1(rnds); } -function _createSuper(Derived) { - var hasNativeReflectConstruct = _isNativeReflectConstruct(); - return function _createSuperInternal() { - var Super = _getPrototypeOf(Derived), result; - if (hasNativeReflectConstruct) { - var NewTarget = _getPrototypeOf(this).constructor; - result = Reflect.construct(Super, arguments, NewTarget); - } else { - result = Super.apply(this, arguments); +const asSdkError = (error) => { + if (error instanceof Error) + return error; + if (error instanceof Object) + return Object.assign(new Error(), error); + if (typeof error === "string") + return new Error(error); + return new Error(`AWS SDK error wrapper for ${error}`); +}; +const resolveRetryConfig = (input2) => { + const { retryStrategy } = input2; + const maxAttempts = normalizeProvider$1(input2.maxAttempts ?? DEFAULT_MAX_ATTEMPTS); + return { + ...input2, + maxAttempts, + retryStrategy: async () => { + if (retryStrategy) { + return retryStrategy; + } + const retryMode = await normalizeProvider$1(input2.retryMode)(); + if (retryMode === RETRY_MODES.ADAPTIVE) { + return new AdaptiveRetryStrategy(maxAttempts); + } + return new StandardRetryStrategy(maxAttempts); } - return _possibleConstructorReturn(this, result); }; -} -function _possibleConstructorReturn(self2, call2) { - if (call2 && (_typeof(call2) === "object" || typeof call2 === "function")) { - return call2; - } else if (call2 !== void 0) { - throw new TypeError("Derived constructors may only return object or undefined"); +}; +class NoOpLogger { + trace() { } - return _assertThisInitialized(self2); -} -function _assertThisInitialized(self2) { - if (self2 === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + debug() { } - return self2; -} -function _isNativeReflectConstruct() { - if (typeof Reflect === "undefined" || !Reflect.construct) - return false; - if (Reflect.construct.sham) - return false; - if (typeof Proxy === "function") - return true; - try { - Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { - })); - return true; - } catch (e2) { - return false; + info() { } -} -function _getPrototypeOf(o2) { - _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o3) { - return o3.__proto__ || Object.getPrototypeOf(o3); - }; - return _getPrototypeOf(o2); -} -function _defineProperty(obj, key2, value) { - if (key2 in obj) { - Object.defineProperty(obj, key2, { value, enumerable: true, configurable: true, writable: true }); - } else { - obj[key2] = value; + warn() { + } + error() { } - return obj; } -var CopyToClipboard$1 = /* @__PURE__ */ function(_React$PureComponent) { - _inherits(CopyToClipboard2, _React$PureComponent); - var _super = _createSuper(CopyToClipboard2); - function CopyToClipboard2() { - var _this; - _classCallCheck(this, CopyToClipboard2); - for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { - args[_key] = arguments[_key]; +const getAllAliases = (name2, aliases) => { + const _aliases = []; + if (name2) { + _aliases.push(name2); + } + if (aliases) { + for (const alias of aliases) { + _aliases.push(alias); } - _this = _super.call.apply(_super, [this].concat(args)); - _defineProperty(_assertThisInitialized(_this), "onClick", function(event) { - var _this$props = _this.props, text2 = _this$props.text, onCopy = _this$props.onCopy, children = _this$props.children, options = _this$props.options; - var elem = _react["default"].Children.only(children); - var result = (0, _copyToClipboard["default"])(text2, options); - if (onCopy) { - onCopy(text2, result); + } + return _aliases; +}; +const getMiddlewareNameWithAliases = (name2, aliases) => { + return `${name2 || "anonymous"}${aliases && aliases.length > 0 ? ` (a.k.a. ${aliases.join(",")})` : ""}`; +}; +const constructStack = () => { + let absoluteEntries = []; + let relativeEntries = []; + let identifyOnResolve = false; + const entriesNameSet = /* @__PURE__ */ new Set(); + const sort = (entries) => entries.sort((a2, b2) => stepWeights[b2.step] - stepWeights[a2.step] || priorityWeights[b2.priority || "normal"] - priorityWeights[a2.priority || "normal"]); + const removeByName = (toRemove) => { + let isRemoved = false; + const filterCb = (entry) => { + const aliases = getAllAliases(entry.name, entry.aliases); + if (aliases.includes(toRemove)) { + isRemoved = true; + for (const alias of aliases) { + entriesNameSet.delete(alias); + } + return false; } - if (elem && elem.props && typeof elem.props.onClick === "function") { - elem.props.onClick(event); + return true; + }; + absoluteEntries = absoluteEntries.filter(filterCb); + relativeEntries = relativeEntries.filter(filterCb); + return isRemoved; + }; + const removeByReference = (toRemove) => { + let isRemoved = false; + const filterCb = (entry) => { + if (entry.middleware === toRemove) { + isRemoved = true; + for (const alias of getAllAliases(entry.name, entry.aliases)) { + entriesNameSet.delete(alias); + } + return false; } + return true; + }; + absoluteEntries = absoluteEntries.filter(filterCb); + relativeEntries = relativeEntries.filter(filterCb); + return isRemoved; + }; + const cloneTo = (toStack) => { + var _a2; + absoluteEntries.forEach((entry) => { + toStack.add(entry.middleware, { ...entry }); }); - return _this; - } - _createClass(CopyToClipboard2, [{ - key: "render", - value: function render() { - var _this$props2 = this.props; - _this$props2.text; - _this$props2.onCopy; - _this$props2.options; - var children = _this$props2.children, props = _objectWithoutProperties(_this$props2, _excluded$3); - var elem = _react["default"].Children.only(children); - return /* @__PURE__ */ _react["default"].cloneElement(elem, _objectSpread(_objectSpread({}, props), {}, { - onClick: this.onClick - })); - } - }]); - return CopyToClipboard2; -}(_react["default"].PureComponent); -Component.CopyToClipboard = CopyToClipboard$1; -_defineProperty(CopyToClipboard$1, "defaultProps", { - onCopy: void 0, - options: void 0 -}); -var _require = Component, CopyToClipboard = _require.CopyToClipboard; -CopyToClipboard.CopyToClipboard = CopyToClipboard; -var lib = CopyToClipboard; -const Receive = () => { - const { address, chain } = useAccount(); - const { chains: chains2 } = useConfig(); - const [isCopied, setCopied] = reactExports.useState(false); - const nativeTokenInfo = getNativeTokenInfoByChainId((chain == null ? void 0 : chain.id) || 1, chains2); - reactExports.useEffect(() => { - if (isCopied) { - setTimeout(() => { - setCopied(false); - }, 4e3); - } - }, [isCopied]); - const onClickCopy = () => { - setCopied(true); + relativeEntries.forEach((entry) => { + toStack.addRelativeTo(entry.middleware, { ...entry }); + }); + (_a2 = toStack.identifyOnResolve) == null ? void 0 : _a2.call(toStack, stack.identifyOnResolve()); + return toStack; }; - const onClickShare = () => { - if (typeof window !== "undefined") { - window.open(`https://twitter.com/intent/tweet?text=Here%20is%20my%20address%20${address}`); - } + const expandRelativeMiddlewareList = (from) => { + const expandedMiddlewareList = []; + from.before.forEach((entry) => { + if (entry.before.length === 0 && entry.after.length === 0) { + expandedMiddlewareList.push(entry); + } else { + expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); + } + }); + expandedMiddlewareList.push(from); + from.after.reverse().forEach((entry) => { + if (entry.before.length === 0 && entry.after.length === 0) { + expandedMiddlewareList.push(entry); + } else { + expandedMiddlewareList.push(...expandRelativeMiddlewareList(entry)); + } + }); + return expandedMiddlewareList; }; - return jsxRuntimeExports$1.jsx(Box, { style: { paddingTop: HEADER_HEIGHT }, children: jsxRuntimeExports$1.jsxs(Box, { padding: "5", paddingTop: "3", flexDirection: "column", justifyContent: "center", alignItems: "center", gap: "4", children: [jsxRuntimeExports$1.jsx(Box, { marginTop: "1", width: "fit", background: "white", borderRadius: "md", alignItems: "center", justifyContent: "center", padding: "4", children: jsxRuntimeExports$1.jsx(QRCode, { value: address || "", size: 200, bgColor: "white", fgColor: "black", "data-id": "receiveQR" }) }), jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", alignItems: "center", justifyContent: "center", gap: "2", children: [jsxRuntimeExports$1.jsx(Text, { variant: "medium", color: "text100", textAlign: "center", lineHeight: "inherit", style: { fontWeight: "700" }, children: "My Wallet" }), jsxRuntimeExports$1.jsx(Image$1, { width: "5", src: nativeTokenInfo.logoURI, alt: "icon" })] }), jsxRuntimeExports$1.jsx(Box, { marginTop: "2", style: { maxWidth: "180px", textAlign: "center" }, children: jsxRuntimeExports$1.jsx(Text, { textAlign: "center", color: "text50", style: { - fontSize: "14px", - maxWidth: "180px", - overflowWrap: "anywhere" - }, children: address }) })] }), jsxRuntimeExports$1.jsxs(Box, { gap: "3", children: [jsxRuntimeExports$1.jsx(lib.CopyToClipboard, { text: address || "", children: jsxRuntimeExports$1.jsx(Button, { onClick: onClickCopy, leftIcon: SvgCopyIcon, label: isCopied ? "Copied!" : "Copy" }) }), jsxRuntimeExports$1.jsx(Button, { onClick: onClickShare, leftIcon: SvgShareIcon, label: "Share" })] }), jsxRuntimeExports$1.jsx(Box, { justifyContent: "center", alignItems: "center", style: { maxWidth: "260px", textAlign: "center" }, children: jsxRuntimeExports$1.jsx(Text, { color: "text100", variant: "small", style: { - maxWidth: "260px", - overflowWrap: "anywhere" - }, children: `This is a ${nativeTokenInfo.name} address. Please only send assets on the ${nativeTokenInfo.name} network.` }) })] }) }); -}; -const SendItemInfo = ({ imageUrl, name: name2, decimals, balance, symbol, fiatValue, chainId, showSquareImage }) => { - const { fiatCurrency } = useSettings(); - const formattedBalance = formatUnits$1(balance, decimals); - const balanceDisplayed = formatDisplay(formattedBalance); - return jsxRuntimeExports$1.jsxs(Box, { alignItems: "flex-end", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsxs(Box, { justifyContent: "space-between", alignItems: "center", gap: "2", children: [showSquareImage ? jsxRuntimeExports$1.jsx(Box, { style: { width: "40px" }, children: jsxRuntimeExports$1.jsx(CollectibleTileImage, { imageUrl }) }) : jsxRuntimeExports$1.jsx(TokenImage, { src: imageUrl, size: "xl" }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", alignItems: "flex-start", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", alignItems: "center", gap: "1", children: [jsxRuntimeExports$1.jsx(Text, { variant: "medium", color: "text100", children: name2 }), jsxRuntimeExports$1.jsx(NetworkImage, { chainId, size: "xs" })] }), jsxRuntimeExports$1.jsxs(Text, { color: "text50", variant: "normal", children: [" ", `${balanceDisplayed} ${symbol} available`] })] })] }), jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", alignItems: "flex-end", justifyContent: "flex-end", children: fiatValue && jsxRuntimeExports$1.jsx(Text, { variant: "normal", color: "text100", children: `${fiatCurrency.sign}${fiatValue}` }) })] }); -}; -const SendCoin = ({ chainId, contractAddress }) => { - var _a2, _b2, _c2, _d2, _e2; - const { setNavigation } = useNavigation(); - const { analytics } = useAnalyticsContext(); - const { chains: chains2 } = useConfig(); - const connectedChainId = useChainId(); - const { address: accountAddress = "", connector } = useAccount(); - const isConnectorSequenceBased = !!((_a2 = connector == null ? void 0 : connector._wallet) == null ? void 0 : _a2.isSequenceBased); - const isCorrectChainId = connectedChainId === chainId; - const showSwitchNetwork = !isCorrectChainId && !isConnectorSequenceBased; - const { switchChainAsync } = useSwitchChain(); - const amountInputRef = reactExports.useRef(null); - const { fiatCurrency } = useSettings(); - const [amount, setAmount] = reactExports.useState("0"); - const [toAddress, setToAddress] = reactExports.useState(""); - const { sendTransaction: sendTransaction2 } = useSendTransaction(); - const [isSendTxnPending, setIsSendTxnPending] = reactExports.useState(false); - const { data: balances = [], isPending: isPendingBalances } = useBalances({ - chainIds: [chainId], - accountAddress, - contractAddress - }); - const nativeTokenInfo = getNativeTokenInfoByChainId(chainId, chains2); - const tokenBalance = balances.find((b2) => b2.contractAddress === contractAddress); - const { data: coinPrices = [], isPending: isPendingCoinPrices } = useCoinPrices([ - { - chainId, - contractAddress - } - ]); - const { data: conversionRate = 1, isPending: isPendingConversionRate } = useExchangeRate(fiatCurrency.symbol); - const isPending = isPendingBalances || isPendingCoinPrices || isPendingConversionRate; - if (isPending) { - return null; - } - const isNativeCoin = compareAddress(contractAddress, AddressZero); - const decimals = isNativeCoin ? nativeTokenInfo.decimals : ((_b2 = tokenBalance == null ? void 0 : tokenBalance.contractInfo) == null ? void 0 : _b2.decimals) || 18; - const name2 = isNativeCoin ? nativeTokenInfo.name : ((_c2 = tokenBalance == null ? void 0 : tokenBalance.contractInfo) == null ? void 0 : _c2.name) || ""; - const imageUrl = isNativeCoin ? nativeTokenInfo.logoURI : (_d2 = tokenBalance == null ? void 0 : tokenBalance.contractInfo) == null ? void 0 : _d2.logoURI; - const symbol = isNativeCoin ? nativeTokenInfo.symbol : ((_e2 = tokenBalance == null ? void 0 : tokenBalance.contractInfo) == null ? void 0 : _e2.symbol) || ""; - const amountToSendFormatted = amount === "" ? "0" : amount; - const amountRaw = parseUnits$1(amountToSendFormatted, decimals); - const amountToSendFiat = computeBalanceFiat({ - balance: { - ...tokenBalance, - balance: amountRaw.toString() - }, - prices: coinPrices, - conversionRate, - decimals - }); - const insufficientFunds = amountRaw.gt((tokenBalance == null ? void 0 : tokenBalance.balance) || "0"); - const isNonZeroAmount = amountRaw.gt(0); - const handleChangeAmount = (ev) => { - const { value } = ev.target; - const formattedValue = limitDecimals(value, decimals); - setAmount(formattedValue); - }; - const handleMax = () => { - var _a3; - (_a3 = amountInputRef.current) == null ? void 0 : _a3.focus(); - const maxAmount = formatUnits$1((tokenBalance == null ? void 0 : tokenBalance.balance) || 0, decimals).toString(); - setAmount(maxAmount); - }; - const handlePaste = async () => { - const result = await navigator.clipboard.readText(); - setToAddress(result); - }; - const handleToAddressClear = () => { - setToAddress(""); - }; - const executeTransaction = async (e2) => { - var _a3, _b3; - if (!isCorrectChainId && isConnectorSequenceBased) { - await switchChainAsync({ chainId }); - } - e2.preventDefault(); - const sendAmount = parseUnits$1(amountToSendFormatted, decimals); - if (isNativeCoin) { - analytics == null ? void 0 : analytics.track({ - event: "SEND_TRANSACTION_REQUEST", - props: { - walletClient: ((_a3 = connector == null ? void 0 : connector._wallet) == null ? void 0 : _a3.id) || "unknown", - source: "sequence-kit/wallet" + const getMiddlewareList = (debug2 = false) => { + const normalizedAbsoluteEntries = []; + const normalizedRelativeEntries = []; + const normalizedEntriesNameMap = {}; + absoluteEntries.forEach((entry) => { + const normalizedEntry = { + ...entry, + before: [], + after: [] + }; + for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { + normalizedEntriesNameMap[alias] = normalizedEntry; + } + normalizedAbsoluteEntries.push(normalizedEntry); + }); + relativeEntries.forEach((entry) => { + const normalizedEntry = { + ...entry, + before: [], + after: [] + }; + for (const alias of getAllAliases(normalizedEntry.name, normalizedEntry.aliases)) { + normalizedEntriesNameMap[alias] = normalizedEntry; + } + normalizedRelativeEntries.push(normalizedEntry); + }); + normalizedRelativeEntries.forEach((entry) => { + if (entry.toMiddleware) { + const toMiddleware = normalizedEntriesNameMap[entry.toMiddleware]; + if (toMiddleware === void 0) { + if (debug2) { + return; + } + throw new Error(`${entry.toMiddleware} is not found when adding ${getMiddlewareNameWithAliases(entry.name, entry.aliases)} middleware ${entry.relation} ${entry.toMiddleware}`); } - }); - setIsSendTxnPending(true); - sendTransaction2({ - to: toAddress, - value: BigInt(sendAmount.toString()), - gas: null - }, { - onSettled: (result) => { - if (result) { - setNavigation({ - location: "home" + if (entry.relation === "after") { + toMiddleware.after.push(entry); + } + if (entry.relation === "before") { + toMiddleware.before.push(entry); + } + } + }); + const mainChain = sort(normalizedAbsoluteEntries).map(expandRelativeMiddlewareList).reduce((wholeList, expandedMiddlewareList) => { + wholeList.push(...expandedMiddlewareList); + return wholeList; + }, []); + return mainChain; + }; + const stack = { + add: (middleware, options = {}) => { + const { name: name2, override, aliases: _aliases } = options; + const entry = { + step: "initialize", + priority: "normal", + middleware, + ...options + }; + const aliases = getAllAliases(name2, _aliases); + if (aliases.length > 0) { + if (aliases.some((alias) => entriesNameSet.has(alias))) { + if (!override) + throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name2, _aliases)}'`); + for (const alias of aliases) { + const toOverrideIndex = absoluteEntries.findIndex((entry2) => { + var _a2; + return entry2.name === alias || ((_a2 = entry2.aliases) == null ? void 0 : _a2.some((a2) => a2 === alias)); }); + if (toOverrideIndex === -1) { + continue; + } + const toOverride = absoluteEntries[toOverrideIndex]; + if (toOverride.step !== entry.step || entry.priority !== toOverride.priority) { + throw new Error(`"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware with ${toOverride.priority} priority in ${toOverride.step} step cannot be overridden by "${getMiddlewareNameWithAliases(name2, _aliases)}" middleware with ${entry.priority} priority in ${entry.step} step.`); + } + absoluteEntries.splice(toOverrideIndex, 1); } - setIsSendTxnPending(false); } - }); - } else { - analytics == null ? void 0 : analytics.track({ - event: "SEND_TRANSACTION_REQUEST", - props: { - walletClient: ((_b3 = connector == null ? void 0 : connector._wallet) == null ? void 0 : _b3.id) || "unknown", - source: "sequence-kit/wallet" + for (const alias of aliases) { + entriesNameSet.add(alias); } - }); - setIsSendTxnPending(true); - sendTransaction2({ - to: tokenBalance == null ? void 0 : tokenBalance.contractAddress, - data: new Interface(ERC_20_ABI).encodeFunctionData("transfer", [ - toAddress, - sendAmount.toHexString() - ]), - gas: null - }, { - onSettled: (result) => { - if (result) { - setNavigation({ - location: "home" + } + absoluteEntries.push(entry); + }, + addRelativeTo: (middleware, options) => { + const { name: name2, override, aliases: _aliases } = options; + const entry = { + middleware, + ...options + }; + const aliases = getAllAliases(name2, _aliases); + if (aliases.length > 0) { + if (aliases.some((alias) => entriesNameSet.has(alias))) { + if (!override) + throw new Error(`Duplicate middleware name '${getMiddlewareNameWithAliases(name2, _aliases)}'`); + for (const alias of aliases) { + const toOverrideIndex = relativeEntries.findIndex((entry2) => { + var _a2; + return entry2.name === alias || ((_a2 = entry2.aliases) == null ? void 0 : _a2.some((a2) => a2 === alias)); }); + if (toOverrideIndex === -1) { + continue; + } + const toOverride = relativeEntries[toOverrideIndex]; + if (toOverride.toMiddleware !== entry.toMiddleware || toOverride.relation !== entry.relation) { + throw new Error(`"${getMiddlewareNameWithAliases(toOverride.name, toOverride.aliases)}" middleware ${toOverride.relation} "${toOverride.toMiddleware}" middleware cannot be overridden by "${getMiddlewareNameWithAliases(name2, _aliases)}" middleware ${entry.relation} "${entry.toMiddleware}" middleware.`); + } + relativeEntries.splice(toOverrideIndex, 1); } - setIsSendTxnPending(false); } + for (const alias of aliases) { + entriesNameSet.add(alias); + } + } + relativeEntries.push(entry); + }, + clone: () => cloneTo(constructStack()), + use: (plugin) => { + plugin.applyToStack(stack); + }, + remove: (toRemove) => { + if (typeof toRemove === "string") + return removeByName(toRemove); + else + return removeByReference(toRemove); + }, + removeByTag: (toRemove) => { + let isRemoved = false; + const filterCb = (entry) => { + const { tags, name: name2, aliases: _aliases } = entry; + if (tags && tags.includes(toRemove)) { + const aliases = getAllAliases(name2, _aliases); + for (const alias of aliases) { + entriesNameSet.delete(alias); + } + isRemoved = true; + return false; + } + return true; + }; + absoluteEntries = absoluteEntries.filter(filterCb); + relativeEntries = relativeEntries.filter(filterCb); + return isRemoved; + }, + concat: (from) => { + var _a2; + const cloned = cloneTo(constructStack()); + cloned.use(from); + cloned.identifyOnResolve(identifyOnResolve || cloned.identifyOnResolve() || (((_a2 = from.identifyOnResolve) == null ? void 0 : _a2.call(from)) ?? false)); + return cloned; + }, + applyToStack: cloneTo, + identify: () => { + return getMiddlewareList(true).map((mw) => { + const step = mw.step ?? mw.relation + " " + mw.toMiddleware; + return getMiddlewareNameWithAliases(mw.name, mw.aliases) + " - " + step; }); + }, + identifyOnResolve(toggle) { + if (typeof toggle === "boolean") + identifyOnResolve = toggle; + return identifyOnResolve; + }, + resolve: (handler, context2) => { + for (const middleware of getMiddlewareList().map((entry) => entry.middleware).reverse()) { + handler = middleware(handler, context2); + } + if (identifyOnResolve) { + console.log(stack.identify()); + } + return handler; } }; - return jsxRuntimeExports$1.jsxs(Box, { padding: "5", paddingTop: "3", style: { - marginTop: HEADER_HEIGHT - }, gap: "2", flexDirection: "column", as: "form", onSubmit: executeTransaction, pointerEvents: isSendTxnPending ? "none" : "auto", children: [jsxRuntimeExports$1.jsxs(Box, { background: "backgroundSecondary", borderRadius: "md", padding: "4", gap: "2", flexDirection: "column", children: [jsxRuntimeExports$1.jsx(SendItemInfo, { imageUrl, decimals, name: name2, symbol, balance: (tokenBalance == null ? void 0 : tokenBalance.balance) || "0", fiatValue: computeBalanceFiat({ - balance: tokenBalance, - prices: coinPrices, - conversionRate, - decimals - }), chainId }), jsxRuntimeExports$1.jsx(NumericInput, { ref: amountInputRef, style: { fontSize: vars.fontSizes.xlarge, fontWeight: vars.fontWeights.bold }, name: "amount", value: amount, onChange: handleChangeAmount, controls: jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [jsxRuntimeExports$1.jsx(Text, { variant: "small", color: "text50", whiteSpace: "nowrap", children: `~${fiatCurrency.sign}${amountToSendFiat}` }), jsxRuntimeExports$1.jsx(Button, { size: "xs", shape: "square", label: "Max", onClick: handleMax, "data-id": "maxCoin", flexShrink: "0" }), jsxRuntimeExports$1.jsx(Text, { fontSize: "xlarge", fontWeight: "bold", color: "text100", children: symbol })] }) }), insufficientFunds && jsxRuntimeExports$1.jsx(Text, { as: "div", variant: "normal", color: "negative", marginTop: "2", children: "Insufficient Funds" })] }), jsxRuntimeExports$1.jsxs(Box, { background: "backgroundSecondary", borderRadius: "md", padding: "4", gap: "2", flexDirection: "column", children: [jsxRuntimeExports$1.jsx(Text, { fontSize: "normal", color: "text50", children: "To" }), isEthAddress(toAddress) ? jsxRuntimeExports$1.jsxs(Card, { clickable: true, width: "full", flexDirection: "row", justifyContent: "space-between", alignItems: "center", onClick: handleToAddressClear, style: { height: "52px" }, children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", justifyContent: "center", alignItems: "center", gap: "2", children: [jsxRuntimeExports$1.jsx(GradientAvatar, { address: toAddress, style: { width: "20px" } }), jsxRuntimeExports$1.jsx(Text, { color: "text100", children: `0x${truncateAtMiddle(toAddress.substring(2), 8)}` })] }), jsxRuntimeExports$1.jsx(SvgCloseIcon, { size: "xs" })] }) : jsxRuntimeExports$1.jsx(TextInput, { value: toAddress, onChange: (ev) => setToAddress(ev.target.value), placeholder: `${nativeTokenInfo.name} Address (0x...)`, name: "to-address", "data-1p-ignore": true, controls: jsxRuntimeExports$1.jsx(Button, { size: "xs", shape: "square", label: "Paste", onClick: handlePaste, "data-id": "to-address", flexShrink: "0", leftIcon: SvgCopyIcon }) })] }), showSwitchNetwork && jsxRuntimeExports$1.jsxs(Box, { marginTop: "3", children: [jsxRuntimeExports$1.jsx(Text, { variant: "small", color: "negative", marginBottom: "2", children: "The wallet is connected to the wrong network. Please switch network before proceeding" }), jsxRuntimeExports$1.jsx(Button, { marginTop: "2", width: "full", variant: "primary", type: "button", label: "Switch Network", onClick: async () => await switchChainAsync({ chainId }), disabled: isCorrectChainId, style: { height: "52px", borderRadius: vars.radii.md } })] }), jsxRuntimeExports$1.jsx(Box, { style: { height: "52px" }, alignItems: "center", justifyContent: "center", children: isSendTxnPending ? jsxRuntimeExports$1.jsx(Spinner, {}) : jsxRuntimeExports$1.jsx(Button, { color: "text100", marginTop: "3", width: "full", variant: "primary", type: "submit", disabled: !isNonZeroAmount || !isEthAddress(toAddress) || insufficientFunds || !isCorrectChainId && !isConnectorSequenceBased, label: "Send", rightIcon: SvgChevronRightIcon, style: { height: "52px", borderRadius: vars.radii.md } }) })] }); + return stack; }; -const SendCollectible = ({ chainId, contractAddress, tokenId }) => { - var _a2, _b2, _c2, _d2, _e2; - const { setNavigation } = useNavigation(); - const { analytics } = useAnalyticsContext(); - const { chains: chains2 } = useConfig(); - const connectedChainId = useChainId(); - const { address: accountAddress = "", connector } = useAccount(); - const isConnectorSequenceBased = !!((_a2 = connector == null ? void 0 : connector._wallet) == null ? void 0 : _a2.isSequenceBased); - const isCorrectChainId = connectedChainId === chainId; - const showSwitchNetwork = !isCorrectChainId && !isConnectorSequenceBased; - const { switchChain: switchChain2 } = useSwitchChain(); - const amountInputRef = reactExports.useRef(null); - const [amount, setAmount] = reactExports.useState("0"); - const [toAddress, setToAddress] = reactExports.useState(""); - const [showAmountControls, setShowAmountControls] = reactExports.useState(false); - const { sendTransaction: sendTransaction2 } = useSendTransaction(); - const [isSendTxnPending, setIsSendTxnPending] = reactExports.useState(false); - const { data: tokenBalance, isPending: isPendingBalances } = useCollectibleBalance({ - accountAddress, - chainId, - contractAddress, - tokenId, - verifiedOnly: false - }); - const { contractType } = tokenBalance; - reactExports.useEffect(() => { - if (tokenBalance) { - if (contractType === "ERC721") { - setAmount("1"); - setShowAmountControls(false); - } else if (contractType === "ERC1155") { - if (Number(formatUnits$1((tokenBalance == null ? void 0 : tokenBalance.balance) || 0, decimals)) >= 1) { - setAmount("1"); +const stepWeights = { + initialize: 5, + serialize: 4, + build: 3, + finalizeRequest: 2, + deserialize: 1 +}; +const priorityWeights = { + high: 3, + normal: 2, + low: 1 +}; +class Client { + constructor(config2) { + this.middlewareStack = constructStack(); + this.config = config2; + } + send(command, optionsOrCb, cb2) { + const options = typeof optionsOrCb !== "function" ? optionsOrCb : void 0; + const callback = typeof optionsOrCb === "function" ? optionsOrCb : cb2; + const handler = command.resolveMiddleware(this.middlewareStack, this.config, options); + if (callback) { + handler(command).then((result) => callback(null, result.output), (err) => callback(err)).catch(() => { + }); + } else { + return handler(command).then((result) => result.output); + } + } + destroy() { + if (this.config.requestHandler.destroy) + this.config.requestHandler.destroy(); + } +} +const alphabetByEncoding = {}; +const alphabetByValue = new Array(64); +for (let i = 0, start = "A".charCodeAt(0), limit = "Z".charCodeAt(0); i + start <= limit; i++) { + const char = String.fromCharCode(i + start); + alphabetByEncoding[char] = i; + alphabetByValue[i] = char; +} +for (let i = 0, start = "a".charCodeAt(0), limit = "z".charCodeAt(0); i + start <= limit; i++) { + const char = String.fromCharCode(i + start); + const index2 = i + 26; + alphabetByEncoding[char] = index2; + alphabetByValue[index2] = char; +} +for (let i = 0; i < 10; i++) { + alphabetByEncoding[i.toString(10)] = i + 52; + const char = i.toString(10); + const index2 = i + 52; + alphabetByEncoding[char] = index2; + alphabetByValue[index2] = char; +} +alphabetByEncoding["+"] = 62; +alphabetByValue[62] = "+"; +alphabetByEncoding["/"] = 63; +alphabetByValue[63] = "/"; +const bitsPerLetter = 6; +const bitsPerByte = 8; +const maxLetterValue = 63; +const fromBase64 = (input2) => { + let totalByteLength = input2.length / 4 * 3; + if (input2.slice(-2) === "==") { + totalByteLength -= 2; + } else if (input2.slice(-1) === "=") { + totalByteLength--; + } + const out = new ArrayBuffer(totalByteLength); + const dataView = new DataView(out); + for (let i = 0; i < input2.length; i += 4) { + let bits = 0; + let bitLength = 0; + for (let j2 = i, limit = i + 3; j2 <= limit; j2++) { + if (input2[j2] !== "=") { + if (!(input2[j2] in alphabetByEncoding)) { + throw new TypeError(`Invalid character ${input2[j2]} in base64 string.`); } - setShowAmountControls(true); + bits |= alphabetByEncoding[input2[j2]] << (limit - j2) * bitsPerLetter; + bitLength += bitsPerLetter; + } else { + bits >>= bitsPerLetter; } } - }, [tokenBalance]); - const nativeTokenInfo = getNativeTokenInfoByChainId(chainId, chains2); - const isPending = isPendingBalances; - if (isPending) { - return null; + const chunkOffset = i / 4 * 3; + bits >>= bitLength % bitsPerByte; + const byteLength2 = Math.floor(bitLength / bitsPerByte); + for (let k2 = 0; k2 < byteLength2; k2++) { + const offset2 = (byteLength2 - k2 - 1) * bitsPerByte; + dataView.setUint8(chunkOffset + k2, (bits & 255 << offset2) >> offset2); + } } - const decimals = ((_b2 = tokenBalance == null ? void 0 : tokenBalance.tokenMetadata) == null ? void 0 : _b2.decimals) || 0; - const name2 = ((_c2 = tokenBalance == null ? void 0 : tokenBalance.tokenMetadata) == null ? void 0 : _c2.name) || "Unknown"; - const imageUrl = ((_d2 = tokenBalance == null ? void 0 : tokenBalance.tokenMetadata) == null ? void 0 : _d2.image) || ((_e2 = tokenBalance == null ? void 0 : tokenBalance.contractInfo) == null ? void 0 : _e2.logoURI) || ""; - const amountToSendFormatted = amount === "" ? "0" : amount; - const amountRaw = parseUnits$1(amountToSendFormatted, decimals); - const insufficientFunds = amountRaw.gt((tokenBalance == null ? void 0 : tokenBalance.balance) || "0"); - const isNonZeroAmount = amountRaw.gt(0); - const handleChangeAmount = (ev) => { - const { value } = ev.target; - const formattedValue = limitDecimals(value, decimals); - setAmount(formattedValue); - }; - const handleSubtractOne = () => { - var _a3; - (_a3 = amountInputRef.current) == null ? void 0 : _a3.focus(); - const decrementedAmount = Number(amount) - 1; - const newAmount = Math.max(decrementedAmount, 0).toString(); - setAmount(newAmount); - }; - const handleAddOne = () => { - var _a3; - (_a3 = amountInputRef.current) == null ? void 0 : _a3.focus(); - const incrementedAmount = Number(amount) + 1; - const maxAmount2 = Number(formatUnits$1((tokenBalance == null ? void 0 : tokenBalance.balance) || 0, decimals)); - const newAmount = Math.min(incrementedAmount, maxAmount2).toString(); - setAmount(newAmount); - }; - const handleMax = () => { - var _a3; - (_a3 = amountInputRef.current) == null ? void 0 : _a3.focus(); - const maxAmount2 = formatUnits$1((tokenBalance == null ? void 0 : tokenBalance.balance) || 0, decimals).toString(); - setAmount(maxAmount2); - }; - const handlePaste = async () => { - const result = await navigator.clipboard.readText(); - setToAddress(result); - }; - const handleToAddressClear = () => { - setToAddress(""); - }; - const executeTransaction = async (e2) => { - var _a3, _b3; - e2.preventDefault(); - if (!isCorrectChainId && isConnectorSequenceBased) { - switchChain2({ chainId }); + return new Uint8Array(out); +}; +const fromUtf8$3 = (input2) => new TextEncoder().encode(input2); +const toUint8Array = (data) => { + if (typeof data === "string") { + return fromUtf8$3(data); + } + if (ArrayBuffer.isView(data)) { + return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); + } + return new Uint8Array(data); +}; +const toUtf8$3 = (input2) => { + if (typeof input2 === "string") { + return input2; + } + if (typeof input2 !== "object" || typeof input2.byteOffset !== "number" || typeof input2.byteLength !== "number") { + throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array."); + } + return new TextDecoder("utf-8").decode(input2); +}; +function toBase64(_input) { + let input2; + if (typeof _input === "string") { + input2 = fromUtf8$3(_input); + } else { + input2 = _input; + } + const isArrayLike = typeof input2 === "object" && typeof input2.length === "number"; + const isUint8Array = typeof input2 === "object" && typeof input2.byteOffset === "number" && typeof input2.byteLength === "number"; + if (!isArrayLike && !isUint8Array) { + throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array."); + } + let str = ""; + for (let i = 0; i < input2.length; i += 3) { + let bits = 0; + let bitLength = 0; + for (let j2 = i, limit = Math.min(i + 3, input2.length); j2 < limit; j2++) { + bits |= input2[j2] << (limit - j2 - 1) * bitsPerByte; + bitLength += bitsPerByte; } - const sendAmount = parseUnits$1(amountToSendFormatted, decimals); - switch (contractType) { - case "ERC721": - analytics == null ? void 0 : analytics.track({ - event: "SEND_TRANSACTION_REQUEST", - props: { - walletClient: ((_a3 = connector == null ? void 0 : connector._wallet) == null ? void 0 : _a3.id) || "unknown", - source: "sequence-kit/wallet" - } - }); - setIsSendTxnPending(true); - sendTransaction2({ - to: tokenBalance.contractAddress, - data: new Interface(ERC_721_ABI).encodeFunctionData("safeTransferFrom", [ - accountAddress, - toAddress, - tokenId - ]), - gas: null - }, { - onSettled: (result) => { - if (result) { - setNavigation({ - location: "home" - }); - } - setIsSendTxnPending(false); - } - }); - break; - case "ERC1155": + const bitClusterCount = Math.ceil(bitLength / bitsPerLetter); + bits <<= bitClusterCount * bitsPerLetter - bitLength; + for (let k2 = 1; k2 <= bitClusterCount; k2++) { + const offset2 = (bitClusterCount - k2) * bitsPerLetter; + str += alphabetByValue[(bits & maxLetterValue << offset2) >> offset2]; + } + str += "==".slice(0, 4 - bitClusterCount); + } + return str; +} +function transformToString(payload, encoding = "utf-8") { + if (encoding === "base64") { + return toBase64(payload); + } + return toUtf8$3(payload); +} +function transformFromString(str, encoding) { + if (encoding === "base64") { + return Uint8ArrayBlobAdapter.mutate(fromBase64(str)); + } + return Uint8ArrayBlobAdapter.mutate(fromUtf8$3(str)); +} +class Uint8ArrayBlobAdapter extends Uint8Array { + static fromString(source, encoding = "utf-8") { + switch (typeof source) { + case "string": + return transformFromString(source, encoding); default: - analytics == null ? void 0 : analytics.track({ - event: "SEND_TRANSACTION_REQUEST", - props: { - walletClient: ((_b3 = connector == null ? void 0 : connector._wallet) == null ? void 0 : _b3.id) || "unknown", - source: "sequence-kit/wallet" - } - }); - setIsSendTxnPending(true); - sendTransaction2({ - to: tokenBalance.contractAddress, - data: new Interface(ERC_1155_ABI).encodeFunctionData("safeBatchTransferFrom", [ - accountAddress, - toAddress, - [tokenId], - [sendAmount.toHexString()], - [] - ]), - gas: null - }, { - onSettled: (result) => { - if (result) { - setNavigation({ - location: "home" - }); - } - setIsSendTxnPending(false); - } - }); + throw new Error(`Unsupported conversion from ${typeof source} to Uint8ArrayBlobAdapter.`); } - }; - const maxAmount = formatUnits$1((tokenBalance == null ? void 0 : tokenBalance.balance) || 0, decimals).toString(); - const isMinimum = Number(amount) === 0; - const isMaximum = Number(amount) >= Number(maxAmount); - return jsxRuntimeExports$1.jsxs(Box, { padding: "5", paddingTop: "3", style: { - marginTop: HEADER_HEIGHT - }, gap: "2", flexDirection: "column", as: "form", onSubmit: executeTransaction, pointerEvents: isSendTxnPending ? "none" : "auto", children: [jsxRuntimeExports$1.jsxs(Box, { background: "backgroundSecondary", borderRadius: "md", padding: "4", gap: "2", flexDirection: "column", children: [jsxRuntimeExports$1.jsx(SendItemInfo, { imageUrl, showSquareImage: true, decimals, name: name2, symbol: "", balance: (tokenBalance == null ? void 0 : tokenBalance.balance) || "0", chainId }), jsxRuntimeExports$1.jsx(NumericInput, { ref: amountInputRef, style: { fontSize: vars.fontSizes.xlarge, fontWeight: vars.fontWeights.bold }, name: "amount", value: amount, onChange: handleChangeAmount, disabled: !showAmountControls, controls: jsxRuntimeExports$1.jsx(jsxRuntimeExports$1.Fragment, { children: showAmountControls && jsxRuntimeExports$1.jsxs(Box, { gap: "2", children: [jsxRuntimeExports$1.jsx(Button, { disabled: isMinimum, size: "xs", onClick: handleSubtractOne, leftIcon: SvgSubtractIcon }), jsxRuntimeExports$1.jsx(Button, { disabled: isMaximum, size: "xs", onClick: handleAddOne, leftIcon: SvgAddIcon }), jsxRuntimeExports$1.jsx(Button, { size: "xs", shape: "square", label: "Max", onClick: handleMax, "data-id": "maxCoin", flexShrink: "0" })] }) }) }), insufficientFunds && jsxRuntimeExports$1.jsx(Text, { as: "div", variant: "normal", color: "negative", marginTop: "2", children: "Insufficient Balance" })] }), jsxRuntimeExports$1.jsxs(Box, { background: "backgroundSecondary", borderRadius: "md", padding: "4", gap: "2", flexDirection: "column", children: [jsxRuntimeExports$1.jsx(Text, { fontSize: "normal", color: "text50", children: "To" }), isEthAddress(toAddress) ? jsxRuntimeExports$1.jsxs(Card, { clickable: true, width: "full", flexDirection: "row", justifyContent: "space-between", alignItems: "center", onClick: handleToAddressClear, style: { height: "52px" }, children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", justifyContent: "center", alignItems: "center", gap: "2", children: [jsxRuntimeExports$1.jsx(GradientAvatar, { address: toAddress, style: { width: "20px" } }), jsxRuntimeExports$1.jsx(Text, { color: "text100", children: `0x${truncateAtMiddle(toAddress.substring(2), 8)}` })] }), jsxRuntimeExports$1.jsx(SvgCloseIcon, { size: "xs" })] }) : jsxRuntimeExports$1.jsx(TextInput, { value: toAddress, onChange: (ev) => setToAddress(ev.target.value), placeholder: `${nativeTokenInfo.name} Address (0x...)`, name: "to-address", "data-1p-ignore": true, controls: jsxRuntimeExports$1.jsx(Button, { size: "xs", shape: "square", label: "Paste", onClick: handlePaste, "data-id": "to-address", flexShrink: "0", leftIcon: SvgCopyIcon }) })] }), showSwitchNetwork && jsxRuntimeExports$1.jsxs(Box, { marginTop: "3", children: [jsxRuntimeExports$1.jsx(Text, { variant: "small", color: "negative", marginBottom: "2", children: "The wallet is connected to the wrong network. Please switch network before proceeding" }), jsxRuntimeExports$1.jsx(Button, { marginTop: "2", width: "full", variant: "primary", type: "button", label: "Switch Network", onClick: () => switchChain2({ chainId }), disabled: isCorrectChainId, style: { height: "52px", borderRadius: vars.radii.md } })] }), jsxRuntimeExports$1.jsx(Box, { style: { height: "52px" }, alignItems: "center", justifyContent: "center", children: isSendTxnPending ? jsxRuntimeExports$1.jsx(Spinner, {}) : jsxRuntimeExports$1.jsx(Button, { color: "text100", marginTop: "3", width: "full", variant: "primary", type: "submit", disabled: !isNonZeroAmount || !isEthAddress(toAddress) || insufficientFunds || !isCorrectChainId && !isConnectorSequenceBased, label: "Send", rightIcon: SvgChevronRightIcon, style: { height: "52px", borderRadius: vars.radii.md } }) })] }); -}; -var dayjs_min = { exports: {} }; -(function(module2, exports) { - !function(t2, e2) { - module2.exports = e2(); - }(commonjsGlobal, function() { - var t2 = 1e3, e2 = 6e4, n2 = 36e5, r2 = "millisecond", i2 = "second", s2 = "minute", u2 = "hour", a2 = "day", o2 = "week", c2 = "month", f2 = "quarter", h2 = "year", d2 = "date", l2 = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y2 = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M2 = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(t3) { - var e3 = ["th", "st", "nd", "rd"], n3 = t3 % 100; - return "[" + t3 + (e3[(n3 - 20) % 10] || e3[n3] || e3[0]) + "]"; - } }, m2 = function(t3, e3, n3) { - var r3 = String(t3); - return !r3 || r3.length >= e3 ? t3 : "" + Array(e3 + 1 - r3.length).join(n3) + t3; - }, v3 = { s: m2, z: function(t3) { - var e3 = -t3.utcOffset(), n3 = Math.abs(e3), r3 = Math.floor(n3 / 60), i3 = n3 % 60; - return (e3 <= 0 ? "+" : "-") + m2(r3, 2, "0") + ":" + m2(i3, 2, "0"); - }, m: function t3(e3, n3) { - if (e3.date() < n3.date()) - return -t3(n3, e3); - var r3 = 12 * (n3.year() - e3.year()) + (n3.month() - e3.month()), i3 = e3.clone().add(r3, c2), s3 = n3 - i3 < 0, u3 = e3.clone().add(r3 + (s3 ? -1 : 1), c2); - return +(-(r3 + (n3 - i3) / (s3 ? i3 - u3 : u3 - i3)) || 0); - }, a: function(t3) { - return t3 < 0 ? Math.ceil(t3) || 0 : Math.floor(t3); - }, p: function(t3) { - return { M: c2, y: h2, w: o2, d: a2, D: d2, h: u2, m: s2, s: i2, ms: r2, Q: f2 }[t3] || String(t3 || "").toLowerCase().replace(/s$/, ""); - }, u: function(t3) { - return void 0 === t3; - } }, g2 = "en", D2 = {}; - D2[g2] = M2; - var p2 = "$isDayjsObject", S2 = function(t3) { - return t3 instanceof _ || !(!t3 || !t3[p2]); - }, w2 = function t3(e3, n3, r3) { - var i3; - if (!e3) - return g2; - if ("string" == typeof e3) { - var s3 = e3.toLowerCase(); - D2[s3] && (i3 = s3), n3 && (D2[s3] = n3, i3 = s3); - var u3 = e3.split("-"); - if (!i3 && u3.length > 1) - return t3(u3[0]); - } else { - var a3 = e3.name; - D2[a3] = e3, i3 = a3; - } - return !r3 && i3 && (g2 = i3), i3 || !r3 && g2; - }, O2 = function(t3, e3) { - if (S2(t3)) - return t3.clone(); - var n3 = "object" == typeof e3 ? e3 : {}; - return n3.date = t3, n3.args = arguments, new _(n3); - }, b2 = v3; - b2.l = w2, b2.i = S2, b2.w = function(t3, e3) { - return O2(t3, { locale: e3.$L, utc: e3.$u, x: e3.$x, $offset: e3.$offset }); - }; - var _ = function() { - function M3(t3) { - this.$L = w2(t3.locale, null, true), this.parse(t3), this.$x = this.$x || t3.x || {}, this[p2] = true; + } + static mutate(source) { + Object.setPrototypeOf(source, Uint8ArrayBlobAdapter.prototype); + return source; + } + transformToString(encoding = "utf-8") { + return transformToString(this, encoding); + } +} +const escapeUri = (uri) => encodeURIComponent(uri).replace(/[!'()*]/g, hexEncode); +const hexEncode = (c2) => `%${c2.charCodeAt(0).toString(16).toUpperCase()}`; +function buildQueryString(query) { + const parts = []; + for (let key2 of Object.keys(query).sort()) { + const value = query[key2]; + key2 = escapeUri(key2); + if (Array.isArray(value)) { + for (let i = 0, iLen = value.length; i < iLen; i++) { + parts.push(`${key2}=${escapeUri(value[i])}`); } - var m3 = M3.prototype; - return m3.parse = function(t3) { - this.$d = function(t4) { - var e3 = t4.date, n3 = t4.utc; - if (null === e3) - return /* @__PURE__ */ new Date(NaN); - if (b2.u(e3)) - return /* @__PURE__ */ new Date(); - if (e3 instanceof Date) - return new Date(e3); - if ("string" == typeof e3 && !/Z$/i.test(e3)) { - var r3 = e3.match($); - if (r3) { - var i3 = r3[2] - 1 || 0, s3 = (r3[7] || "0").substring(0, 3); - return n3 ? new Date(Date.UTC(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3)) : new Date(r3[1], i3, r3[3] || 1, r3[4] || 0, r3[5] || 0, r3[6] || 0, s3); - } - } - return new Date(e3); - }(t3), this.init(); - }, m3.init = function() { - var t3 = this.$d; - this.$y = t3.getFullYear(), this.$M = t3.getMonth(), this.$D = t3.getDate(), this.$W = t3.getDay(), this.$H = t3.getHours(), this.$m = t3.getMinutes(), this.$s = t3.getSeconds(), this.$ms = t3.getMilliseconds(); - }, m3.$utils = function() { - return b2; - }, m3.isValid = function() { - return !(this.$d.toString() === l2); - }, m3.isSame = function(t3, e3) { - var n3 = O2(t3); - return this.startOf(e3) <= n3 && n3 <= this.endOf(e3); - }, m3.isAfter = function(t3, e3) { - return O2(t3) < this.startOf(e3); - }, m3.isBefore = function(t3, e3) { - return this.endOf(e3) < O2(t3); - }, m3.$g = function(t3, e3, n3) { - return b2.u(t3) ? this[e3] : this.set(n3, t3); - }, m3.unix = function() { - return Math.floor(this.valueOf() / 1e3); - }, m3.valueOf = function() { - return this.$d.getTime(); - }, m3.startOf = function(t3, e3) { - var n3 = this, r3 = !!b2.u(e3) || e3, f3 = b2.p(t3), l3 = function(t4, e4) { - var i3 = b2.w(n3.$u ? Date.UTC(n3.$y, e4, t4) : new Date(n3.$y, e4, t4), n3); - return r3 ? i3 : i3.endOf(a2); - }, $2 = function(t4, e4) { - return b2.w(n3.toDate()[t4].apply(n3.toDate("s"), (r3 ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e4)), n3); - }, y3 = this.$W, M4 = this.$M, m4 = this.$D, v5 = "set" + (this.$u ? "UTC" : ""); - switch (f3) { - case h2: - return r3 ? l3(1, 0) : l3(31, 11); - case c2: - return r3 ? l3(1, M4) : l3(0, M4 + 1); - case o2: - var g3 = this.$locale().weekStart || 0, D3 = (y3 < g3 ? y3 + 7 : y3) - g3; - return l3(r3 ? m4 - D3 : m4 + (6 - D3), M4); - case a2: - case d2: - return $2(v5 + "Hours", 0); - case u2: - return $2(v5 + "Minutes", 1); - case s2: - return $2(v5 + "Seconds", 2); - case i2: - return $2(v5 + "Milliseconds", 3); - default: - return this.clone(); - } - }, m3.endOf = function(t3) { - return this.startOf(t3, false); - }, m3.$set = function(t3, e3) { - var n3, o3 = b2.p(t3), f3 = "set" + (this.$u ? "UTC" : ""), l3 = (n3 = {}, n3[a2] = f3 + "Date", n3[d2] = f3 + "Date", n3[c2] = f3 + "Month", n3[h2] = f3 + "FullYear", n3[u2] = f3 + "Hours", n3[s2] = f3 + "Minutes", n3[i2] = f3 + "Seconds", n3[r2] = f3 + "Milliseconds", n3)[o3], $2 = o3 === a2 ? this.$D + (e3 - this.$W) : e3; - if (o3 === c2 || o3 === h2) { - var y3 = this.clone().set(d2, 1); - y3.$d[l3]($2), y3.init(), this.$d = y3.set(d2, Math.min(this.$D, y3.daysInMonth())).$d; - } else - l3 && this.$d[l3]($2); - return this.init(), this; - }, m3.set = function(t3, e3) { - return this.clone().$set(t3, e3); - }, m3.get = function(t3) { - return this[b2.p(t3)](); - }, m3.add = function(r3, f3) { - var d3, l3 = this; - r3 = Number(r3); - var $2 = b2.p(f3), y3 = function(t3) { - var e3 = O2(l3); - return b2.w(e3.date(e3.date() + Math.round(t3 * r3)), l3); - }; - if ($2 === c2) - return this.set(c2, this.$M + r3); - if ($2 === h2) - return this.set(h2, this.$y + r3); - if ($2 === a2) - return y3(1); - if ($2 === o2) - return y3(7); - var M4 = (d3 = {}, d3[s2] = e2, d3[u2] = n2, d3[i2] = t2, d3)[$2] || 1, m4 = this.$d.getTime() + r3 * M4; - return b2.w(m4, this); - }, m3.subtract = function(t3, e3) { - return this.add(-1 * t3, e3); - }, m3.format = function(t3) { - var e3 = this, n3 = this.$locale(); - if (!this.isValid()) - return n3.invalidDate || l2; - var r3 = t3 || "YYYY-MM-DDTHH:mm:ssZ", i3 = b2.z(this), s3 = this.$H, u3 = this.$m, a3 = this.$M, o3 = n3.weekdays, c3 = n3.months, f3 = n3.meridiem, h3 = function(t4, n4, i4, s4) { - return t4 && (t4[n4] || t4(e3, r3)) || i4[n4].slice(0, s4); - }, d3 = function(t4) { - return b2.s(s3 % 12 || 12, t4, "0"); - }, $2 = f3 || function(t4, e4, n4) { - var r4 = t4 < 12 ? "AM" : "PM"; - return n4 ? r4.toLowerCase() : r4; - }; - return r3.replace(y2, function(t4, r4) { - return r4 || function(t5) { - switch (t5) { - case "YY": - return String(e3.$y).slice(-2); - case "YYYY": - return b2.s(e3.$y, 4, "0"); - case "M": - return a3 + 1; - case "MM": - return b2.s(a3 + 1, 2, "0"); - case "MMM": - return h3(n3.monthsShort, a3, c3, 3); - case "MMMM": - return h3(c3, a3); - case "D": - return e3.$D; - case "DD": - return b2.s(e3.$D, 2, "0"); - case "d": - return String(e3.$W); - case "dd": - return h3(n3.weekdaysMin, e3.$W, o3, 2); - case "ddd": - return h3(n3.weekdaysShort, e3.$W, o3, 3); - case "dddd": - return o3[e3.$W]; - case "H": - return String(s3); - case "HH": - return b2.s(s3, 2, "0"); - case "h": - return d3(1); - case "hh": - return d3(2); - case "a": - return $2(s3, u3, true); - case "A": - return $2(s3, u3, false); - case "m": - return String(u3); - case "mm": - return b2.s(u3, 2, "0"); - case "s": - return String(e3.$s); - case "ss": - return b2.s(e3.$s, 2, "0"); - case "SSS": - return b2.s(e3.$ms, 3, "0"); - case "Z": - return i3; - } - return null; - }(t4) || i3.replace(":", ""); - }); - }, m3.utcOffset = function() { - return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); - }, m3.diff = function(r3, d3, l3) { - var $2, y3 = this, M4 = b2.p(d3), m4 = O2(r3), v5 = (m4.utcOffset() - this.utcOffset()) * e2, g3 = this - m4, D3 = function() { - return b2.m(y3, m4); - }; - switch (M4) { - case h2: - $2 = D3() / 12; - break; - case c2: - $2 = D3(); - break; - case f2: - $2 = D3() / 3; - break; - case o2: - $2 = (g3 - v5) / 6048e5; - break; - case a2: - $2 = (g3 - v5) / 864e5; - break; - case u2: - $2 = g3 / n2; - break; - case s2: - $2 = g3 / e2; - break; - case i2: - $2 = g3 / t2; - break; - default: - $2 = g3; - } - return l3 ? $2 : b2.a($2); - }, m3.daysInMonth = function() { - return this.endOf(c2).$D; - }, m3.$locale = function() { - return D2[this.$L]; - }, m3.locale = function(t3, e3) { - if (!t3) - return this.$L; - var n3 = this.clone(), r3 = w2(t3, e3, true); - return r3 && (n3.$L = r3), n3; - }, m3.clone = function() { - return b2.w(this.$d, this); - }, m3.toDate = function() { - return new Date(this.valueOf()); - }, m3.toJSON = function() { - return this.isValid() ? this.toISOString() : null; - }, m3.toISOString = function() { - return this.$d.toISOString(); - }, m3.toString = function() { - return this.$d.toUTCString(); - }, M3; - }(), k2 = _.prototype; - return O2.prototype = k2, [["$ms", r2], ["$s", i2], ["$m", s2], ["$H", u2], ["$W", a2], ["$M", c2], ["$y", h2], ["$D", d2]].forEach(function(t3) { - k2[t3[1]] = function(e3) { - return this.$g(e3, t3[0], t3[1]); - }; - }), O2.extend = function(t3, e3) { - return t3.$i || (t3(e3, _, O2), t3.$i = true), O2; - }, O2.locale = w2, O2.isDayjs = S2, O2.unix = function(t3) { - return O2(1e3 * t3); - }, O2.en = D2[g2], O2.Ls = D2, O2.p = {}, O2; - }); -})(dayjs_min); -var dayjs_minExports = dayjs_min.exports; -const dayjs = /* @__PURE__ */ getDefaultExportFromCjs$1(dayjs_minExports); -const TransactionHistoryItem = ({ transaction: transaction2 }) => { - var _a2; - const { chains: chains2 } = useConfig(); - const { fiatCurrency } = useSettings(); - const { setNavigation } = useNavigation(); - const onClickTransaction = () => { - setNavigation({ - location: "transaction-details", - params: { - transaction: transaction2 + } else { + let qsEntry = key2; + if (value || typeof value === "string") { + qsEntry += `=${escapeUri(value)}`; } - }); - }; - const tokenContractAddresses = []; - (_a2 = transaction2.transfers) == null ? void 0 : _a2.forEach((transfer) => { - const tokenContractAddress = transfer.contractAddress; - if (!tokenContractAddresses.includes(tokenContractAddress)) { - tokenContractAddresses.push(tokenContractAddress); + parts.push(qsEntry); + } + } + return parts.join("&"); +} +function requestTimeout(timeoutInMs = 0) { + return new Promise((resolve, reject) => { + if (timeoutInMs) { + setTimeout(() => { + const timeoutError = new Error(`Request did not complete within ${timeoutInMs} ms`); + timeoutError.name = "TimeoutError"; + reject(timeoutError); + }, timeoutInMs); } }); - const { data: coinPrices = [], isPending: isPendingCoinPrices } = useCoinPrices(tokenContractAddresses.map((contractAddress) => ({ - contractAddress, - chainId: transaction2.chainId - }))); - const { data: conversionRate = 1, isPending: isPendingConversionRate } = useExchangeRate(fiatCurrency.symbol); - const isPending = isPendingCoinPrices || isPendingConversionRate; - const { transfers } = transaction2; - const getTransactionIconByType = (transferType) => { - switch (transferType) { - case TxnTransferType.SEND: - return jsxRuntimeExports$1.jsx(SvgArrowRightIcon, { style: { - transform: "rotate(270deg)", - width: "16px" - } }); - case TxnTransferType.RECEIVE: - return jsxRuntimeExports$1.jsx(SvgArrowRightIcon, { style: { - transform: "rotate(90deg)", - width: "16px" - } }); - case TxnTransferType.UNKNOWN: - default: - return jsxRuntimeExports$1.jsx(SvgTransactionIcon, { style: { width: "14px" } }); +} +const keepAliveSupport = { + supported: Boolean(typeof Request !== "undefined" && "keepalive" in new Request("https://[::1]")) +}; +class FetchHttpHandler { + static create(instanceOrOptions) { + if (typeof (instanceOrOptions == null ? void 0 : instanceOrOptions.handle) === "function") { + return instanceOrOptions; } - }; - const getTansactionLabelByType = (transferType) => { - switch (transferType) { - case TxnTransferType.SEND: - return "Sent"; - case TxnTransferType.RECEIVE: - return "Received"; - case TxnTransferType.UNKNOWN: - default: - return "Transacted"; + return new FetchHttpHandler(instanceOrOptions); + } + constructor(options) { + if (typeof options === "function") { + this.configProvider = options().then((opts) => opts || {}); + } else { + this.config = options ?? {}; + this.configProvider = Promise.resolve(this.config); } - }; - const getTransferAmountLabel = (amount, symbol, transferType) => { - let sign3 = ""; - if (transferType === TxnTransferType.SEND) { - sign3 = "-"; - } else if (transferType === TxnTransferType.RECEIVE) { - sign3 = "+"; + } + destroy() { + } + async handle(request, { abortSignal } = {}) { + if (!this.config) { + this.config = await this.configProvider; } - let textColor = "text50"; - if (transferType === TxnTransferType.SEND) { - textColor = vars.colors.negative; - } else if (transferType === TxnTransferType.RECEIVE) { - textColor = vars.colors.positive; + const requestTimeoutInMs = this.config.requestTimeout; + const keepAlive = this.config.keepAlive === true; + if (abortSignal == null ? void 0 : abortSignal.aborted) { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + return Promise.reject(abortError); } - return jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", fontSize: "normal", style: { color: textColor }, children: `${sign3}${amount} ${symbol}` }); - }; - const getTransfer = ({ transfer, isFirstItem }) => { - const { amounts } = transfer; - const date = dayjs(transaction2.timestamp).format("MMM DD, YYYY"); - return jsxRuntimeExports$1.jsxs(Box, { gap: "2", width: "full", flexDirection: "column", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsxs(Box, { color: "text50", gap: "1", flexDirection: "row", justifyContent: "center", alignItems: "center", children: [getTransactionIconByType(transfer.transferType), jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", fontSize: "normal", color: "text100", children: getTansactionLabelByType(transfer.transferType) }), jsxRuntimeExports$1.jsx(NetworkImage, { chainId: transaction2.chainId, size: "xs" })] }), isFirstItem && jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", fontSize: "normal", color: "text50", children: date }) })] }), amounts.map((amount, index2) => { - var _a3, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2; - const nativeTokenInfo = getNativeTokenInfoByChainId(transaction2.chainId, chains2); - const isNativeToken = compareAddress(transfer.contractAddress, AddressZero); - const isCollectible = ((_a3 = transfer.contractInfo) == null ? void 0 : _a3.type) === "ERC721" || ((_b2 = transfer.contractInfo) == null ? void 0 : _b2.type) === "ERC1155"; - let decimals; - const tokenId = (_c2 = transfer.tokenIds) == null ? void 0 : _c2[index2]; - if (isCollectible && tokenId) { - decimals = ((_e2 = (_d2 = transfer.tokenMetadata) == null ? void 0 : _d2[tokenId]) == null ? void 0 : _e2.decimals) || 0; - } else { - decimals = isNativeToken ? nativeTokenInfo.decimals : (_f2 = transfer.contractInfo) == null ? void 0 : _f2.decimals; - } - const amountValue = formatUnits$1(amount, decimals); - const symbol = isNativeToken ? nativeTokenInfo.symbol : ((_g2 = transfer.contractInfo) == null ? void 0 : _g2.symbol) || ""; - const tokenLogoUri = isNativeToken ? nativeTokenInfo.logoURI : (_h2 = transfer.contractInfo) == null ? void 0 : _h2.logoURI; - const fiatConversionRate = (_j2 = (_i2 = coinPrices.find((coinPrice) => compareAddress(coinPrice.token.contractAddress, transfer.contractAddress))) == null ? void 0 : _i2.price) == null ? void 0 : _j2.value; - return jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", gap: "2", justifyContent: "center", alignItems: "center", children: [tokenLogoUri && jsxRuntimeExports$1.jsx(Image$1, { src: tokenLogoUri, width: "5", alt: "token logo" }), getTransferAmountLabel(formatDisplay(amountValue), symbol, transfer.transferType)] }), isPending && jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "35px", height: "20px" } }), fiatConversionRate && jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", fontSize: "normal", color: "text50", children: `${fiatCurrency.sign}${(Number(amountValue) * fiatConversionRate * conversionRate).toFixed(2)}` })] }, index2); - })] }); - }; - return jsxRuntimeExports$1.jsx(Box, { background: "backgroundSecondary", borderRadius: "md", padding: "4", gap: "2", alignItems: "center", justifyContent: "center", flexDirection: "column", userSelect: "none", cursor: "pointer", opacity: { hover: "80" }, onClick: () => onClickTransaction(), children: transfers == null ? void 0 : transfers.map((transfer, position) => { - return jsxRuntimeExports$1.jsx(Box, { width: "full", children: getTransfer({ - transfer, - isFirstItem: position === 0 - }) }, `${transaction2.txnHash}-${position}`); - }) }); -}; -const TransactionHistorySkeleton = () => { - const getTransactionItem = () => { - return jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "2", width: "full", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "65px", height: "20px" } }), jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "75px", height: "17px" } })] }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "120px", height: "20px" } }), jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "35px", height: "17px" } })] })] }); - }; - return jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "3", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "70px", height: "17px" } }), jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", gap: "2", children: Array(8).fill(null).map((_, index2) => { - return jsxRuntimeExports$1.jsx(Box, { borderRadius: "md", padding: "4", gap: "2", alignItems: "center", justifyContent: "center", flexDirection: "column", background: "backgroundSecondary", children: getTransactionItem() }, index2); - }) })] }); -}; -const TransactionHistoryList = ({ transactions: transactions2, isPending, isFetchingNextPage }) => { - const transactionPeriods = [ - { - id: "today", - label: "Today" - }, - { - id: "yesterday", - label: "Yesterday" - }, - { - id: "week", - label: "Last Week" - }, - { - id: "month", - label: "Last Month" - }, - { - id: "year", - label: "Last Year" - }, - { - id: "years", - label: "Past Years" + let path = request.path; + const queryString = buildQueryString(request.query || {}); + if (queryString) { + path += `?${queryString}`; } - ]; - const transactionsByTime = reactExports.useMemo(() => { - const todayTreshold = new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)).getTime(); - const yesterdayTreshold = new Date((/* @__PURE__ */ new Date()).setDate(new Date(todayTreshold).getDate() - 1)).getTime(); - const weekTreshold = new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 7)).getTime(); - const monthTreshold = new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 30)).getTime(); - const yearTreshold = new Date((/* @__PURE__ */ new Date()).setDate((/* @__PURE__ */ new Date()).getDate() - 365)).getTime(); - const transactionsByTime2 = { - today: [], - yesterday: [], - week: [], - month: [], - year: [], - years: [] + if (request.fragment) { + path += `#${request.fragment}`; + } + let auth2 = ""; + if (request.username != null || request.password != null) { + const username = request.username ?? ""; + const password = request.password ?? ""; + auth2 = `${username}:${password}@`; + } + const { port, method } = request; + const url = `${request.protocol}//${auth2}${request.hostname}${port ? `:${port}` : ""}${path}`; + const body = method === "GET" || method === "HEAD" ? void 0 : request.body; + const requestOptions = { + body, + headers: new Headers(request.headers), + method }; - transactions2.forEach((transaction2) => { - const transactionTime = new Date(transaction2.timestamp).getTime(); - if (transactionTime > todayTreshold) { - transactionsByTime2.today.push(transaction2); - } else if (transactionTime > yesterdayTreshold) { - transactionsByTime2.yesterday.push(transaction2); - } else if (transactionTime > weekTreshold) { - transactionsByTime2.week.push(transaction2); - } else if (transactionTime > monthTreshold) { - transactionsByTime2.month.push(transaction2); - } else if (transactionTime > yearTreshold) { - transactionsByTime2.year.push(transaction2); - } else { - transactionsByTime2.years.push(transaction2); - } - }); - return transactionsByTime2; - }, [transactions2]); - if (isPending) { - return jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", gap: "2", children: jsxRuntimeExports$1.jsx(TransactionHistorySkeleton, {}) }); - } - const TimeLabel = ({ label }) => { - return jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(Text, { color: "text50", fontWeight: "medium", fontSize: "normal", children: label }) }); - }; - const TransactionsList = ({ transactions: transactions3 }) => { - return jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", gap: "2", children: transactions3.map((transaction2, index2) => { - return jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", gap: "2", children: jsxRuntimeExports$1.jsx(TransactionHistoryItem, { transaction: transaction2 }) }, `${transaction2.txnHash}-${index2}`); - }) }); - }; - return jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "5", children: [transactionPeriods.map((period) => { - const txs = transactionsByTime[period.id]; - if (txs.length === 0) { - return null; + if (body) { + requestOptions.duplex = "half"; } - return jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "3", children: [jsxRuntimeExports$1.jsx(TimeLabel, { label: period.label }), jsxRuntimeExports$1.jsx(TransactionsList, { transactions: txs })] }, period.id); - }), transactions2.length === 0 && jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "3", children: [jsxRuntimeExports$1.jsx(TimeLabel, { label: "History" }), jsxRuntimeExports$1.jsx(Text, { color: "text100", children: "No Recent Transaction History Found" })] }), isFetchingNextPage && jsxRuntimeExports$1.jsx(Box, { margin: "4", alignItems: "center", justifyContent: "center", children: jsxRuntimeExports$1.jsx(Spinner, {}) })] }); -}; -const History = () => { - const { selectedNetworks } = useSettings(); - const { address: accountAddress } = useAccount(); - const { data: transactionHistory = [], isPending: isPendingTransactionHistory } = useTransactionHistorySummary({ - accountAddress: accountAddress || "", - chainIds: selectedNetworks - }); - return jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(Box, { paddingX: "4", paddingBottom: "5", paddingTop: "3", children: jsxRuntimeExports$1.jsx(TransactionHistoryList, { transactions: transactionHistory, isPending: isPendingTransactionHistory, isFetchingNextPage: false }) }) }); -}; -function isArray(value) { - return !Array.isArray ? getTag(value) === "[object Array]" : Array.isArray(value); -} -const INFINITY = 1 / 0; -function baseToString(value) { - if (typeof value == "string") { - return value; + if (typeof AbortController !== "undefined") { + requestOptions.signal = abortSignal; + } + if (keepAliveSupport.supported) { + requestOptions.keepalive = keepAlive; + } + const fetchRequest = new Request(url, requestOptions); + const raceOfPromises = [ + fetch(fetchRequest).then((response) => { + const fetchHeaders = response.headers; + const transformedHeaders = {}; + for (const pair of fetchHeaders.entries()) { + transformedHeaders[pair[0]] = pair[1]; + } + const hasReadableStream = response.body != void 0; + if (!hasReadableStream) { + return response.blob().then((body2) => ({ + response: new HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: body2 + }) + })); + } + return { + response: new HttpResponse({ + headers: transformedHeaders, + reason: response.statusText, + statusCode: response.status, + body: response.body + }) + }; + }), + requestTimeout(requestTimeoutInMs) + ]; + if (abortSignal) { + raceOfPromises.push(new Promise((resolve, reject) => { + abortSignal.onabort = () => { + const abortError = new Error("Request aborted"); + abortError.name = "AbortError"; + reject(abortError); + }; + })); + } + return Promise.race(raceOfPromises); } - let result = value + ""; - return result == "0" && 1 / value == -INFINITY ? "-0" : result; -} -function toString(value) { - return value == null ? "" : baseToString(value); -} -function isString(value) { - return typeof value === "string"; -} -function isNumber(value) { - return typeof value === "number"; -} -function isBoolean(value) { - return value === true || value === false || isObjectLike(value) && getTag(value) == "[object Boolean]"; -} -function isObject(value) { - return typeof value === "object"; -} -function isObjectLike(value) { - return isObject(value) && value !== null; -} -function isDefined(value) { - return value !== void 0 && value !== null; -} -function isBlank(value) { - return !value.trim().length; -} -function getTag(value) { - return value == null ? value === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(value); -} -const EXTENDED_SEARCH_UNAVAILABLE = "Extended search is not available"; -const INCORRECT_INDEX_TYPE = "Incorrect 'index' type"; -const LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key2) => `Invalid value for key ${key2}`; -const PATTERN_LENGTH_TOO_LARGE = (max2) => `Pattern length exceeds max of ${max2}.`; -const MISSING_KEY_PROPERTY = (name2) => `Missing ${name2} property in key`; -const INVALID_KEY_WEIGHT_VALUE = (key2) => `Property 'weight' in key '${key2}' must be a positive integer`; -const hasOwn = Object.prototype.hasOwnProperty; -class KeyStore { - constructor(keys) { - this._keys = []; - this._keyMap = {}; - let totalWeight = 0; - keys.forEach((key2) => { - let obj = createKey(key2); - totalWeight += obj.weight; - this._keys.push(obj); - this._keyMap[obj.id] = obj; - totalWeight += obj.weight; - }); - this._keys.forEach((key2) => { - key2.weight /= totalWeight; + updateHttpClientConfig(key2, value) { + this.config = void 0; + this.configProvider = this.configProvider.then((config2) => { + config2[key2] = value; + return config2; }); } - get(keyId) { - return this._keyMap[keyId]; - } - keys() { - return this._keys; + httpHandlerConfigs() { + return this.config ?? {}; } - toJSON() { - return JSON.stringify(this._keys); +} +const streamCollector = (stream) => { + if (typeof Blob === "function" && stream instanceof Blob) { + return collectBlob(stream); } + return collectStream(stream); +}; +async function collectBlob(blob) { + const base64 = await readToBase64(blob); + const arrayBuffer = fromBase64(base64); + return new Uint8Array(arrayBuffer); } -function createKey(key2) { - let path = null; - let id2 = null; - let src = null; - let weight = 1; - let getFn = null; - if (isString(key2) || isArray(key2)) { - src = key2; - path = createKeyPath(key2); - id2 = createKeyId(key2); - } else { - if (!hasOwn.call(key2, "name")) { - throw new Error(MISSING_KEY_PROPERTY("name")); - } - const name2 = key2.name; - src = name2; - if (hasOwn.call(key2, "weight")) { - weight = key2.weight; - if (weight <= 0) { - throw new Error(INVALID_KEY_WEIGHT_VALUE(name2)); - } +async function collectStream(stream) { + const chunks = []; + const reader2 = stream.getReader(); + let isDone = false; + let length = 0; + while (!isDone) { + const { done, value } = await reader2.read(); + if (value) { + chunks.push(value); + length += value.length; } - path = createKeyPath(name2); - id2 = createKeyId(name2); - getFn = key2.getFn; + isDone = done; } - return { path, id: id2, weight, src, getFn }; + const collected = new Uint8Array(length); + let offset2 = 0; + for (const chunk of chunks) { + collected.set(chunk, offset2); + offset2 += chunk.length; + } + return collected; } -function createKeyPath(key2) { - return isArray(key2) ? key2 : key2.split("."); +function readToBase64(blob) { + return new Promise((resolve, reject) => { + const reader2 = new FileReader(); + reader2.onloadend = () => { + if (reader2.readyState !== 2) { + return reject(new Error("Reader aborted too early")); + } + const result = reader2.result ?? ""; + const commaIndex = result.indexOf(","); + const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length; + resolve(result.substring(dataOffset)); + }; + reader2.onabort = () => reject(new Error("Read aborted")); + reader2.onerror = () => reject(reader2.error); + reader2.readAsDataURL(blob); + }); } -function createKeyId(key2) { - return isArray(key2) ? key2.join(".") : key2; +const SHORT_TO_HEX = {}; +const HEX_TO_SHORT = {}; +for (let i = 0; i < 256; i++) { + let encodedByte = i.toString(16).toLowerCase(); + if (encodedByte.length === 1) { + encodedByte = `0${encodedByte}`; + } + SHORT_TO_HEX[i] = encodedByte; + HEX_TO_SHORT[encodedByte] = i; } -function get(obj, path) { - let list2 = []; - let arr = false; - const deepGet = (obj2, path2, index2) => { - if (!isDefined(obj2)) { - return; - } - if (!path2[index2]) { - list2.push(obj2); +function fromHex(encoded) { + if (encoded.length % 2 !== 0) { + throw new Error("Hex encoded strings must have an even number length"); + } + const out = new Uint8Array(encoded.length / 2); + for (let i = 0; i < encoded.length; i += 2) { + const encodedByte = encoded.slice(i, i + 2).toLowerCase(); + if (encodedByte in HEX_TO_SHORT) { + out[i / 2] = HEX_TO_SHORT[encodedByte]; } else { - let key2 = path2[index2]; - const value = obj2[key2]; - if (!isDefined(value)) { - return; - } - if (index2 === path2.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) { - list2.push(toString(value)); - } else if (isArray(value)) { - arr = true; - for (let i2 = 0, len = value.length; i2 < len; i2 += 1) { - deepGet(value[i2], path2, index2 + 1); - } - } else if (path2.length) { - deepGet(value, path2, index2 + 1); - } - } - }; - deepGet(obj, isString(path) ? path.split(".") : path, 0); - return arr ? list2 : list2[0]; -} -const MatchOptions = { - // Whether the matches should be included in the result set. When `true`, each record in the result - // set will include the indices of the matched characters. - // These can consequently be used for highlighting purposes. - includeMatches: false, - // When `true`, the matching function will continue to the end of a search pattern even if - // a perfect match has already been located in the string. - findAllMatches: false, - // Minimum number of characters that must be matched before a result is considered a match - minMatchCharLength: 1 -}; -const BasicOptions = { - // When `true`, the algorithm continues searching to the end of the input even if a perfect - // match is found before the end of the same input. - isCaseSensitive: false, - // When true, the matching function will continue to the end of a search pattern even if - includeScore: false, - // List of properties that will be searched. This also supports nested properties. - keys: [], - // Whether to sort the result list, by score - shouldSort: true, - // Default sort function: sort by ascending score, ascending index - sortFn: (a2, b2) => a2.score === b2.score ? a2.idx < b2.idx ? -1 : 1 : a2.score < b2.score ? -1 : 1 -}; -const FuzzyOptions = { - // Approximately where in the text is the pattern expected to be found? - location: 0, - // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match - // (of both letters and location), a threshold of '1.0' would match anything. - threshold: 0.6, - // Determines how close the match must be to the fuzzy location (specified above). - // An exact letter match which is 'distance' characters away from the fuzzy location - // would score as a complete mismatch. A distance of '0' requires the match be at - // the exact location specified, a threshold of '1000' would require a perfect match - // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. - distance: 100 -}; -const AdvancedOptions = { - // When `true`, it enables the use of unix-like search commands - useExtendedSearch: false, - // The get function to use when fetching an object's properties. - // The default will search nested paths *ie foo.bar.baz* - getFn: get, - // When `true`, search will ignore `location` and `distance`, so it won't matter - // where in the string the pattern appears. - // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score - ignoreLocation: false, - // When `true`, the calculation for the relevance score (used for sorting) will - // ignore the field-length norm. - // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm - ignoreFieldNorm: false, - // The weight to determine how much field length norm effects scoring. - fieldNormWeight: 1 -}; -var Config = { - ...BasicOptions, - ...MatchOptions, - ...FuzzyOptions, - ...AdvancedOptions -}; -const SPACE$1 = /[^ ]+/g; -function norm(weight = 1, mantissa = 3) { - const cache = /* @__PURE__ */ new Map(); - const m2 = Math.pow(10, mantissa); - return { - get(value) { - const numTokens = value.match(SPACE$1).length; - if (cache.has(numTokens)) { - return cache.get(numTokens); - } - const norm2 = 1 / Math.pow(numTokens, 0.5 * weight); - const n2 = parseFloat(Math.round(norm2 * m2) / m2); - cache.set(numTokens, n2); - return n2; - }, - clear() { - cache.clear(); + throw new Error(`Cannot decode unrecognized sequence ${encodedByte} as hexadecimal`); } - }; + } + return out; } -class FuseIndex { - constructor({ - getFn = Config.getFn, - fieldNormWeight = Config.fieldNormWeight - } = {}) { - this.norm = norm(fieldNormWeight, 3); - this.getFn = getFn; - this.isCreated = false; - this.setIndexRecords(); +function toHex(bytes3) { + let out = ""; + for (let i = 0; i < bytes3.byteLength; i++) { + out += SHORT_TO_HEX[bytes3[i]]; } - setSources(docs = []) { - this.docs = docs; + return out; +} +const collectBody = async (streamBody = new Uint8Array(), context2) => { + if (streamBody instanceof Uint8Array) { + return Uint8ArrayBlobAdapter.mutate(streamBody); } - setIndexRecords(records = []) { - this.records = records; + if (!streamBody) { + return Uint8ArrayBlobAdapter.mutate(new Uint8Array()); } - setKeys(keys = []) { - this.keys = keys; - this._keysMap = {}; - keys.forEach((key2, idx) => { - this._keysMap[key2.id] = idx; - }); + const fromContext = context2.streamCollector(streamBody); + return Uint8ArrayBlobAdapter.mutate(await fromContext); +}; +class Command { + constructor() { + this.middlewareStack = constructStack(); } - create() { - if (this.isCreated || !this.docs.length) { - return; - } - this.isCreated = true; - if (isString(this.docs[0])) { - this.docs.forEach((doc, docIndex) => { - this._addString(doc, docIndex); - }); - } else { - this.docs.forEach((doc, docIndex) => { - this._addObject(doc, docIndex); - }); - } - this.norm.clear(); + static classBuilder() { + return new ClassBuilder(); } - // Adds a doc to the end of the index - add(doc) { - const idx = this.size(); - if (isString(doc)) { - this._addString(doc, idx); - } else { - this._addObject(doc, idx); + resolveMiddlewareWithContext(clientStack, configuration, options, { middlewareFn, clientName, commandName, inputFilterSensitiveLog, outputFilterSensitiveLog, smithyContext, additionalContext, CommandCtor }) { + for (const mw of middlewareFn.bind(this)(CommandCtor, clientStack, configuration, options)) { + this.middlewareStack.use(mw); } + const stack = clientStack.concat(this.middlewareStack); + const { logger: logger2 } = configuration; + const handlerExecutionContext = { + logger: logger2, + clientName, + commandName, + inputFilterSensitiveLog, + outputFilterSensitiveLog, + [SMITHY_CONTEXT_KEY]: { + ...smithyContext + }, + ...additionalContext + }; + const { requestHandler } = configuration; + return stack.resolve((request) => requestHandler.handle(request.request, options || {}), handlerExecutionContext); } - // Removes the doc at the specified index of the index - removeAt(idx) { - this.records.splice(idx, 1); - for (let i2 = idx, len = this.size(); i2 < len; i2 += 1) { - this.records[i2].i -= 1; - } +} +class ClassBuilder { + constructor() { + this._init = () => { + }; + this._ep = {}; + this._middlewareFn = () => []; + this._commandName = ""; + this._clientName = ""; + this._additionalContext = {}; + this._smithyContext = {}; + this._inputFilterSensitiveLog = (_) => _; + this._outputFilterSensitiveLog = (_) => _; + this._serializer = null; + this._deserializer = null; } - getValueForItemAtKeyId(item2, keyId) { - return item2[this._keysMap[keyId]]; + init(cb2) { + this._init = cb2; } - size() { - return this.records.length; + ep(endpointParameterInstructions) { + this._ep = endpointParameterInstructions; + return this; } - _addString(doc, docIndex) { - if (!isDefined(doc) || isBlank(doc)) { - return; - } - let record = { - v: doc, - i: docIndex, - n: this.norm.get(doc) + m(middlewareSupplier) { + this._middlewareFn = middlewareSupplier; + return this; + } + s(service, operation, smithyContext = {}) { + this._smithyContext = { + service, + operation, + ...smithyContext }; - this.records.push(record); + return this; } - _addObject(doc, docIndex) { - let record = { i: docIndex, $: {} }; - this.keys.forEach((key2, keyIndex) => { - let value = key2.getFn ? key2.getFn(doc) : this.getFn(doc, key2.path); - if (!isDefined(value)) { - return; + c(additionalContext = {}) { + this._additionalContext = additionalContext; + return this; + } + n(clientName, commandName) { + this._clientName = clientName; + this._commandName = commandName; + return this; + } + f(inputFilter = (_) => _, outputFilter = (_) => _) { + this._inputFilterSensitiveLog = inputFilter; + this._outputFilterSensitiveLog = outputFilter; + return this; + } + ser(serializer) { + this._serializer = serializer; + return this; + } + de(deserializer) { + this._deserializer = deserializer; + return this; + } + build() { + const closure = this; + let CommandRef; + return CommandRef = class extends Command { + static getEndpointParameterInstructions() { + return closure._ep; } - if (isArray(value)) { - let subRecords = []; - const stack = [{ nestedArrIndex: -1, value }]; - while (stack.length) { - const { nestedArrIndex, value: value2 } = stack.pop(); - if (!isDefined(value2)) { - continue; - } - if (isString(value2) && !isBlank(value2)) { - let subRecord = { - v: value2, - i: nestedArrIndex, - n: this.norm.get(value2) - }; - subRecords.push(subRecord); - } else if (isArray(value2)) { - value2.forEach((item2, k2) => { - stack.push({ - nestedArrIndex: k2, - value: item2 - }); - }); - } else - ; - } - record.$[keyIndex] = subRecords; - } else if (isString(value) && !isBlank(value)) { - let subRecord = { - v: value, - n: this.norm.get(value) - }; - record.$[keyIndex] = subRecord; + constructor(...[input2]) { + super(); + this.serialize = closure._serializer; + this.deserialize = closure._deserializer; + this.input = input2 ?? {}; + closure._init(this); + } + resolveMiddleware(stack, configuration, options) { + return this.resolveMiddlewareWithContext(stack, configuration, options, { + CommandCtor: CommandRef, + middlewareFn: closure._middlewareFn, + clientName: closure._clientName, + commandName: closure._commandName, + inputFilterSensitiveLog: closure._inputFilterSensitiveLog, + outputFilterSensitiveLog: closure._outputFilterSensitiveLog, + smithyContext: closure._smithyContext, + additionalContext: closure._additionalContext + }); } - }); - this.records.push(record); - } - toJSON() { - return { - keys: this.keys, - records: this.records }; } } -function createIndex(keys, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { - const myIndex = new FuseIndex({ getFn, fieldNormWeight }); - myIndex.setKeys(keys.map(createKey)); - myIndex.setSources(docs); - myIndex.create(); - return myIndex; -} -function parseIndex(data, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { - const { keys, records } = data; - const myIndex = new FuseIndex({ getFn, fieldNormWeight }); - myIndex.setKeys(keys); - myIndex.setIndexRecords(records); - return myIndex; +const SENSITIVE_STRING = "***SensitiveInformation***"; +class ServiceException extends Error { + constructor(options) { + super(options.message); + Object.setPrototypeOf(this, ServiceException.prototype); + this.name = options.name; + this.$fault = options.$fault; + this.$metadata = options.$metadata; + } } -function computeScore$1(pattern, { - errors: errors2 = 0, - currentLocation = 0, - expectedLocation = 0, - distance: distance2 = Config.distance, - ignoreLocation = Config.ignoreLocation -} = {}) { - const accuracy = errors2 / pattern.length; - if (ignoreLocation) { - return accuracy; +const decorateServiceException = (exception, additions = {}) => { + Object.entries(additions).filter(([, v3]) => v3 !== void 0).forEach(([k2, v3]) => { + if (exception[k2] == void 0 || exception[k2] === "") { + exception[k2] = v3; + } + }); + const message = exception.message || exception.Message || "UnknownError"; + exception.message = message; + delete exception.Message; + return exception; +}; +const throwDefaultError$1 = ({ output: output2, parsedBody, exceptionCtor, errorCode }) => { + const $metadata = deserializeMetadata$1(output2); + const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : void 0; + const response = new exceptionCtor({ + name: (parsedBody == null ? void 0 : parsedBody.code) || (parsedBody == null ? void 0 : parsedBody.Code) || errorCode || statusCode || "UnknownError", + $fault: "client", + $metadata + }); + throw decorateServiceException(response, parsedBody); +}; +const withBaseException = (ExceptionCtor) => { + return ({ output: output2, parsedBody, errorCode }) => { + throwDefaultError$1({ output: output2, parsedBody, exceptionCtor: ExceptionCtor, errorCode }); + }; +}; +const deserializeMetadata$1 = (output2) => ({ + httpStatusCode: output2.statusCode, + requestId: output2.headers["x-amzn-requestid"] ?? output2.headers["x-amzn-request-id"] ?? output2.headers["x-amz-request-id"], + extendedRequestId: output2.headers["x-amz-id-2"], + cfId: output2.headers["x-amz-cf-id"] +}); +const loadConfigsForDefaultMode = (mode) => { + switch (mode) { + case "standard": + return { + retryMode: "standard", + connectionTimeout: 3100 + }; + case "in-region": + return { + retryMode: "standard", + connectionTimeout: 1100 + }; + case "cross-region": + return { + retryMode: "standard", + connectionTimeout: 3100 + }; + case "mobile": + return { + retryMode: "standard", + connectionTimeout: 3e4 + }; + default: + return {}; } - const proximity = Math.abs(expectedLocation - currentLocation); - if (!distance2) { - return proximity ? 1 : accuracy; +}; +const getChecksumConfiguration = (runtimeConfig) => { + const checksumAlgorithms = []; + for (const id2 in AlgorithmId) { + const algorithmId = AlgorithmId[id2]; + if (runtimeConfig[algorithmId] === void 0) { + continue; + } + checksumAlgorithms.push({ + algorithmId: () => algorithmId, + checksumConstructor: () => runtimeConfig[algorithmId] + }); } - return accuracy + proximity / distance2; -} -function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMatchCharLength) { - let indices = []; - let start = -1; - let end = -1; - let i2 = 0; - for (let len = matchmask.length; i2 < len; i2 += 1) { - let match = matchmask[i2]; - if (match && start === -1) { - start = i2; - } else if (!match && start !== -1) { - end = i2 - 1; - if (end - start + 1 >= minMatchCharLength) { - indices.push([start, end]); - } - start = -1; + return { + _checksumAlgorithms: checksumAlgorithms, + addChecksumAlgorithm(algo) { + this._checksumAlgorithms.push(algo); + }, + checksumAlgorithms() { + return this._checksumAlgorithms; + } + }; +}; +const resolveChecksumRuntimeConfig = (clientConfig) => { + const runtimeConfig = {}; + clientConfig.checksumAlgorithms().forEach((checksumAlgorithm) => { + runtimeConfig[checksumAlgorithm.algorithmId()] = checksumAlgorithm.checksumConstructor(); + }); + return runtimeConfig; +}; +const getRetryConfiguration = (runtimeConfig) => { + let _retryStrategy = runtimeConfig.retryStrategy; + return { + setRetryStrategy(retryStrategy) { + _retryStrategy = retryStrategy; + }, + retryStrategy() { + return _retryStrategy; } + }; +}; +const resolveRetryRuntimeConfig = (retryStrategyConfiguration) => { + const runtimeConfig = {}; + runtimeConfig.retryStrategy = retryStrategyConfiguration.retryStrategy(); + return runtimeConfig; +}; +const getDefaultExtensionConfiguration = (runtimeConfig) => { + return { + ...getChecksumConfiguration(runtimeConfig), + ...getRetryConfiguration(runtimeConfig) + }; +}; +const resolveDefaultRuntimeConfig = (config2) => { + return { + ...resolveChecksumRuntimeConfig(config2), + ...resolveRetryRuntimeConfig(config2) + }; +}; +const StringWrapper = function() { + const Class = Object.getPrototypeOf(this).constructor; + const Constructor = Function.bind.apply(String, [null, ...arguments]); + const instance = new Constructor(); + Object.setPrototypeOf(instance, Class.prototype); + return instance; +}; +StringWrapper.prototype = Object.create(String.prototype, { + constructor: { + value: StringWrapper, + enumerable: false, + writable: true, + configurable: true } - if (matchmask[i2 - 1] && i2 - start >= minMatchCharLength) { - indices.push([start, i2 - 1]); +}); +Object.setPrototypeOf(StringWrapper, String); +const _json = (obj) => { + if (obj == null) { + return {}; } - return indices; -} -const MAX_BITS = 32; -function search(text2, pattern, patternAlphabet, { - location: location2 = Config.location, - distance: distance2 = Config.distance, - threshold = Config.threshold, - findAllMatches = Config.findAllMatches, - minMatchCharLength = Config.minMatchCharLength, - includeMatches = Config.includeMatches, - ignoreLocation = Config.ignoreLocation -} = {}) { - if (pattern.length > MAX_BITS) { - throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS)); + if (Array.isArray(obj)) { + return obj.filter((_) => _ != null).map(_json); } - const patternLen = pattern.length; - const textLen = text2.length; - const expectedLocation = Math.max(0, Math.min(location2, textLen)); - let currentThreshold = threshold; - let bestLocation = expectedLocation; - const computeMatches = minMatchCharLength > 1 || includeMatches; - const matchMask = computeMatches ? Array(textLen) : []; - let index2; - while ((index2 = text2.indexOf(pattern, bestLocation)) > -1) { - let score = computeScore$1(pattern, { - currentLocation: index2, - expectedLocation, - distance: distance2, - ignoreLocation - }); - currentThreshold = Math.min(score, currentThreshold); - bestLocation = index2 + patternLen; - if (computeMatches) { - let i2 = 0; - while (i2 < patternLen) { - matchMask[index2 + i2] = 1; - i2 += 1; + if (typeof obj === "object") { + const target = {}; + for (const key2 of Object.keys(obj)) { + if (obj[key2] == null) { + continue; } + target[key2] = _json(obj[key2]); } + return target; } - bestLocation = -1; - let lastBitArr = []; - let finalScore = 1; - let binMax = patternLen + textLen; - const mask = 1 << patternLen - 1; - for (let i2 = 0; i2 < patternLen; i2 += 1) { - let binMin = 0; - let binMid = binMax; - while (binMin < binMid) { - const score2 = computeScore$1(pattern, { - errors: i2, - currentLocation: expectedLocation + binMid, - expectedLocation, - distance: distance2, - ignoreLocation - }); - if (score2 <= currentThreshold) { - binMin = binMid; - } else { - binMax = binMid; - } - binMid = Math.floor((binMax - binMin) / 2 + binMin); + return obj; +}; +const isStreamingPayload = (request) => (request == null ? void 0 : request.body) instanceof ReadableStream; +const retryMiddleware = (options) => (next, context2) => async (args) => { + var _a2; + let retryStrategy = await options.retryStrategy(); + const maxAttempts = await options.maxAttempts(); + if (isRetryStrategyV2(retryStrategy)) { + retryStrategy = retryStrategy; + let retryToken = await retryStrategy.acquireInitialRetryToken(context2["partition_id"]); + let lastError = new Error(); + let attempts = 0; + let totalRetryDelay = 0; + const { request } = args; + const isRequest = HttpRequest.isInstance(request); + if (isRequest) { + request.headers[INVOCATION_ID_HEADER] = v4$1(); } - binMax = binMid; - let start = Math.max(1, expectedLocation - binMid + 1); - let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen; - let bitArr = Array(finish + 2); - bitArr[finish + 1] = (1 << i2) - 1; - for (let j2 = finish; j2 >= start; j2 -= 1) { - let currentLocation = j2 - 1; - let charMatch = patternAlphabet[text2.charAt(currentLocation)]; - if (computeMatches) { - matchMask[currentLocation] = +!!charMatch; - } - bitArr[j2] = (bitArr[j2 + 1] << 1 | 1) & charMatch; - if (i2) { - bitArr[j2] |= (lastBitArr[j2 + 1] | lastBitArr[j2]) << 1 | 1 | lastBitArr[j2 + 1]; - } - if (bitArr[j2] & mask) { - finalScore = computeScore$1(pattern, { - errors: i2, - currentLocation, - expectedLocation, - distance: distance2, - ignoreLocation - }); - if (finalScore <= currentThreshold) { - currentThreshold = finalScore; - bestLocation = currentLocation; - if (bestLocation <= expectedLocation) { - break; + while (true) { + try { + if (isRequest) { + request.headers[REQUEST_HEADER] = `attempt=${attempts + 1}; max=${maxAttempts}`; + } + const { response, output: output2 } = await next(args); + retryStrategy.recordSuccess(retryToken); + output2.$metadata.attempts = attempts + 1; + output2.$metadata.totalRetryDelay = totalRetryDelay; + return { response, output: output2 }; + } catch (e2) { + const retryErrorInfo = getRetryErrorInfo(e2); + lastError = asSdkError(e2); + if (isRequest && isStreamingPayload(request)) { + (_a2 = context2.logger instanceof NoOpLogger ? console : context2.logger) == null ? void 0 : _a2.warn("An error was encountered in a non-retryable streaming request."); + throw lastError; + } + try { + retryToken = await retryStrategy.refreshRetryTokenForRetry(retryToken, retryErrorInfo); + } catch (refreshError) { + if (!lastError.$metadata) { + lastError.$metadata = {}; } - start = Math.max(1, 2 * expectedLocation - bestLocation); + lastError.$metadata.attempts = attempts + 1; + lastError.$metadata.totalRetryDelay = totalRetryDelay; + throw lastError; } + attempts = retryToken.getRetryCount(); + const delay2 = retryToken.getRetryDelay(); + totalRetryDelay += delay2; + await new Promise((resolve) => setTimeout(resolve, delay2)); } } - const score = computeScore$1(pattern, { - errors: i2 + 1, - currentLocation: expectedLocation, - expectedLocation, - distance: distance2, - ignoreLocation - }); - if (score > currentThreshold) { - break; - } - lastBitArr = bitArr; + } else { + retryStrategy = retryStrategy; + if (retryStrategy == null ? void 0 : retryStrategy.mode) + context2.userAgent = [...context2.userAgent || [], ["cfg/retry-mode", retryStrategy.mode]]; + return retryStrategy.retry(next, args); } - const result = { - isMatch: bestLocation >= 0, - // Count exact matches (those with a score of 0) to be "almost" exact - score: Math.max(1e-3, finalScore) +}; +const isRetryStrategyV2 = (retryStrategy) => typeof retryStrategy.acquireInitialRetryToken !== "undefined" && typeof retryStrategy.refreshRetryTokenForRetry !== "undefined" && typeof retryStrategy.recordSuccess !== "undefined"; +const getRetryErrorInfo = (error) => { + const errorInfo = { + error, + errorType: getRetryErrorType(error) }; - if (computeMatches) { - const indices = convertMaskToIndices(matchMask, minMatchCharLength); - if (!indices.length) { - result.isMatch = false; - } else if (includeMatches) { - result.indices = indices; - } + const retryAfterHint = getRetryAfterHint(error.$response); + if (retryAfterHint) { + errorInfo.retryAfterHint = retryAfterHint; } - return result; -} -function createPatternAlphabet(pattern) { - let mask = {}; - for (let i2 = 0, len = pattern.length; i2 < len; i2 += 1) { - const char = pattern.charAt(i2); - mask[char] = (mask[char] || 0) | 1 << len - i2 - 1; + return errorInfo; +}; +const getRetryErrorType = (error) => { + if (isThrottlingError(error)) + return "THROTTLING"; + if (isTransientError(error)) + return "TRANSIENT"; + if (isServerError(error)) + return "SERVER_ERROR"; + return "CLIENT_ERROR"; +}; +const retryMiddlewareOptions = { + name: "retryMiddleware", + tags: ["RETRY"], + step: "finalizeRequest", + priority: "high", + override: true +}; +const getRetryPlugin = (options) => ({ + applyToStack: (clientStack) => { + clientStack.add(retryMiddleware(options), retryMiddlewareOptions); } - return mask; -} -class BitapSearch { - constructor(pattern, { - location: location2 = Config.location, - threshold = Config.threshold, - distance: distance2 = Config.distance, - includeMatches = Config.includeMatches, - findAllMatches = Config.findAllMatches, - minMatchCharLength = Config.minMatchCharLength, - isCaseSensitive = Config.isCaseSensitive, - ignoreLocation = Config.ignoreLocation - } = {}) { - this.options = { - location: location2, - threshold, - distance: distance2, - includeMatches, - findAllMatches, - minMatchCharLength, - isCaseSensitive, - ignoreLocation - }; - this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase(); - this.chunks = []; - if (!this.pattern.length) { - return; - } - const addChunk = (pattern2, startIndex) => { - this.chunks.push({ - pattern: pattern2, - alphabet: createPatternAlphabet(pattern2), - startIndex - }); - }; - const len = this.pattern.length; - if (len > MAX_BITS) { - let i2 = 0; - const remainder = len % MAX_BITS; - const end = len - remainder; - while (i2 < end) { - addChunk(this.pattern.substr(i2, MAX_BITS), i2); - i2 += MAX_BITS; - } - if (remainder) { - const startIndex = len - MAX_BITS; - addChunk(this.pattern.substr(startIndex), startIndex); - } - } else { - addChunk(this.pattern, 0); - } +}); +const getRetryAfterHint = (response) => { + if (!HttpResponse.isInstance(response)) + return; + const retryAfterHeaderName = Object.keys(response.headers).find((key2) => key2.toLowerCase() === "retry-after"); + if (!retryAfterHeaderName) + return; + const retryAfter = response.headers[retryAfterHeaderName]; + const retryAfterSeconds = Number(retryAfter); + if (!Number.isNaN(retryAfterSeconds)) + return new Date(retryAfterSeconds * 1e3); + const retryAfterDate = new Date(retryAfter); + return retryAfterDate; +}; +const httpSigningMiddlewareOptions = { + step: "finalizeRequest", + tags: ["HTTP_SIGNING"], + name: "httpSigningMiddleware", + aliases: ["apiKeyMiddleware", "tokenMiddleware", "awsAuthMiddleware"], + override: true, + relation: "after", + toMiddleware: retryMiddlewareOptions.name +}; +const getHttpSigningPlugin = (config2) => ({ + applyToStack: (clientStack) => { + clientStack.addRelativeTo(httpSigningMiddleware(), httpSigningMiddlewareOptions); } - searchIn(text2) { - const { isCaseSensitive, includeMatches } = this.options; - if (!isCaseSensitive) { - text2 = text2.toLowerCase(); - } - if (this.pattern === text2) { - let result2 = { - isMatch: true, - score: 0 - }; - if (includeMatches) { - result2.indices = [[0, text2.length - 1]]; - } - return result2; - } - const { - location: location2, - distance: distance2, - threshold, - findAllMatches, - minMatchCharLength, - ignoreLocation - } = this.options; - let allIndices = []; - let totalScore = 0; - let hasMatches = false; - this.chunks.forEach(({ pattern, alphabet, startIndex }) => { - const { isMatch, score, indices } = search(text2, pattern, alphabet, { - location: location2 + startIndex, - distance: distance2, - threshold, - findAllMatches, - minMatchCharLength, - includeMatches, - ignoreLocation - }); - if (isMatch) { - hasMatches = true; - } - totalScore += score; - if (isMatch && indices) { - allIndices = [...allIndices, ...indices]; +}); +class DefaultIdentityProviderConfig { + constructor(config2) { + this.authSchemes = /* @__PURE__ */ new Map(); + for (const [key2, value] of Object.entries(config2)) { + if (value !== void 0) { + this.authSchemes.set(key2, value); } - }); - let result = { - isMatch: hasMatches, - score: hasMatches ? totalScore / this.chunks.length : 1 - }; - if (hasMatches && includeMatches) { - result.indices = allIndices; } - return result; - } -} -class BaseMatch { - constructor(pattern) { - this.pattern = pattern; - } - static isMultiMatch(pattern) { - return getMatch(pattern, this.multiRegex); - } - static isSingleMatch(pattern) { - return getMatch(pattern, this.singleRegex); } - search() { + getIdentityProvider(schemeId) { + return this.authSchemes.get(schemeId); } } -function getMatch(pattern, exp) { - const matches = pattern.match(exp); - return matches ? matches[1] : null; -} -class ExactMatch extends BaseMatch { - constructor(pattern) { - super(pattern); - } - static get type() { - return "exact"; - } - static get multiRegex() { - return /^="(.*)"$/; - } - static get singleRegex() { - return /^=(.*)$/; - } - search(text2) { - const isMatch = text2 === this.pattern; - return { - isMatch, - score: isMatch ? 0 : 1, - indices: [0, this.pattern.length - 1] - }; +class NoAuthSigner { + async sign(httpRequest, identity, signingProperties) { + return httpRequest; } } -class InverseExactMatch extends BaseMatch { - constructor(pattern) { - super(pattern); - } - static get type() { - return "inverse-exact"; - } - static get multiRegex() { - return /^!"(.*)"$/; - } - static get singleRegex() { - return /^!(.*)$/; +const createIsIdentityExpiredFunction = (expirationMs) => (identity) => doesIdentityRequireRefresh(identity) && identity.expiration.getTime() - Date.now() < expirationMs; +const EXPIRATION_MS = 3e5; +const isIdentityExpired = createIsIdentityExpiredFunction(EXPIRATION_MS); +const doesIdentityRequireRefresh = (identity) => identity.expiration !== void 0; +const memoizeIdentityProvider = (provider2, isExpired, requiresRefresh) => { + if (provider2 === void 0) { + return void 0; } - search(text2) { - const index2 = text2.indexOf(this.pattern); - const isMatch = index2 === -1; - return { - isMatch, - score: isMatch ? 0 : 1, - indices: [0, text2.length - 1] + const normalizedProvider = typeof provider2 !== "function" ? async () => Promise.resolve(provider2) : provider2; + let resolved; + let pending; + let hasResult; + let isConstant = false; + const coalesceProvider = async (options) => { + if (!pending) { + pending = normalizedProvider(options); + } + try { + resolved = await pending; + hasResult = true; + isConstant = false; + } finally { + pending = void 0; + } + return resolved; + }; + if (isExpired === void 0) { + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(options); + } + return resolved; }; } + return async (options) => { + if (!hasResult || (options == null ? void 0 : options.forceRefresh)) { + resolved = await coalesceProvider(options); + } + if (isConstant) { + return resolved; + } + if (!requiresRefresh(resolved)) { + isConstant = true; + return resolved; + } + if (isExpired(resolved)) { + await coalesceProvider(options); + return resolved; + } + return resolved; + }; +}; +const normalizeProvider = (input2) => { + if (typeof input2 === "function") + return input2; + const promisified = Promise.resolve(input2); + return () => promisified; +}; +const CONTENT_LENGTH_HEADER = "content-length"; +function contentLengthMiddleware(bodyLengthChecker) { + return (next) => async (args) => { + const request = args.request; + if (HttpRequest.isInstance(request)) { + const { body, headers } = request; + if (body && Object.keys(headers).map((str) => str.toLowerCase()).indexOf(CONTENT_LENGTH_HEADER) === -1) { + try { + const length = bodyLengthChecker(body); + request.headers = { + ...request.headers, + [CONTENT_LENGTH_HEADER]: String(length) + }; + } catch (error) { + } + } + } + return next({ + ...args, + request + }); + }; } -class PrefixExactMatch extends BaseMatch { - constructor(pattern) { - super(pattern); +const contentLengthMiddlewareOptions = { + step: "build", + tags: ["SET_CONTENT_LENGTH", "CONTENT_LENGTH"], + name: "contentLengthMiddleware", + override: true +}; +const getContentLengthPlugin = (options) => ({ + applyToStack: (clientStack) => { + clientStack.add(contentLengthMiddleware(options.bodyLengthChecker), contentLengthMiddlewareOptions); } - static get type() { - return "prefix-exact"; +}); +const getDateHeader = (response) => { + var _a2, _b2; + return HttpResponse.isInstance(response) ? ((_a2 = response.headers) == null ? void 0 : _a2.date) ?? ((_b2 = response.headers) == null ? void 0 : _b2.Date) : void 0; +}; +const getSkewCorrectedDate = (systemClockOffset) => new Date(Date.now() + systemClockOffset); +const isClockSkewed = (clockTime, systemClockOffset) => Math.abs(getSkewCorrectedDate(systemClockOffset).getTime() - clockTime) >= 3e5; +const getUpdatedSystemClockOffset = (clockTime, currentSystemClockOffset) => { + const clockTimeInMs = Date.parse(clockTime); + if (isClockSkewed(clockTimeInMs, currentSystemClockOffset)) { + return clockTimeInMs - Date.now(); } - static get multiRegex() { - return /^\^"(.*)"$/; + return currentSystemClockOffset; +}; +const throwSigningPropertyError = (name2, property) => { + if (!property) { + throw new Error(`Property \`${name2}\` is not resolved for AWS SDK SigV4Auth`); } - static get singleRegex() { - return /^\^(.*)$/; + return property; +}; +const validateSigningProperties = async (signingProperties) => { + var _a2, _b2, _c2; + const context2 = throwSigningPropertyError("context", signingProperties.context); + const config2 = throwSigningPropertyError("config", signingProperties.config); + const authScheme = (_c2 = (_b2 = (_a2 = context2.endpointV2) == null ? void 0 : _a2.properties) == null ? void 0 : _b2.authSchemes) == null ? void 0 : _c2[0]; + const signerFunction = throwSigningPropertyError("signer", config2.signer); + const signer2 = await signerFunction(authScheme); + const signingRegion = signingProperties == null ? void 0 : signingProperties.signingRegion; + const signingName = signingProperties == null ? void 0 : signingProperties.signingName; + return { + config: config2, + signer: signer2, + signingRegion, + signingName + }; +}; +class AwsSdkSigV4Signer { + async sign(httpRequest, identity, signingProperties) { + if (!HttpRequest.isInstance(httpRequest)) { + throw new Error("The request is not an instance of `HttpRequest` and cannot be signed"); + } + const { config: config2, signer: signer2, signingRegion, signingName } = await validateSigningProperties(signingProperties); + const signedRequest = await signer2.sign(httpRequest, { + signingDate: getSkewCorrectedDate(config2.systemClockOffset), + signingRegion, + signingService: signingName + }); + return signedRequest; } - search(text2) { - const isMatch = text2.startsWith(this.pattern); - return { - isMatch, - score: isMatch ? 0 : 1, - indices: [0, this.pattern.length - 1] + errorHandler(signingProperties) { + return (error) => { + const serverTime = error.ServerTime ?? getDateHeader(error.$response); + if (serverTime) { + const config2 = throwSigningPropertyError("config", signingProperties.config); + const initialSystemClockOffset = config2.systemClockOffset; + config2.systemClockOffset = getUpdatedSystemClockOffset(serverTime, config2.systemClockOffset); + const clockSkewCorrected = config2.systemClockOffset !== initialSystemClockOffset; + if (clockSkewCorrected && error.$metadata) { + error.$metadata.clockSkewCorrected = true; + } + } + throw error; }; } -} -class InversePrefixExactMatch extends BaseMatch { - constructor(pattern) { - super(pattern); - } - static get type() { - return "inverse-prefix-exact"; - } - static get multiRegex() { - return /^!\^"(.*)"$/; - } - static get singleRegex() { - return /^!\^(.*)$/; - } - search(text2) { - const isMatch = !text2.startsWith(this.pattern); - return { - isMatch, - score: isMatch ? 0 : 1, - indices: [0, text2.length - 1] - }; + successHandler(httpResponse, signingProperties) { + const dateHeader = getDateHeader(httpResponse); + if (dateHeader) { + const config2 = throwSigningPropertyError("config", signingProperties.config); + config2.systemClockOffset = getUpdatedSystemClockOffset(dateHeader, config2.systemClockOffset); + } } } -class SuffixExactMatch extends BaseMatch { - constructor(pattern) { - super(pattern); - } - static get type() { - return "suffix-exact"; - } - static get multiRegex() { - return /^"(.*)"\$$/; +const ALGORITHM_QUERY_PARAM = "X-Amz-Algorithm"; +const CREDENTIAL_QUERY_PARAM = "X-Amz-Credential"; +const AMZ_DATE_QUERY_PARAM = "X-Amz-Date"; +const SIGNED_HEADERS_QUERY_PARAM = "X-Amz-SignedHeaders"; +const EXPIRES_QUERY_PARAM = "X-Amz-Expires"; +const SIGNATURE_QUERY_PARAM = "X-Amz-Signature"; +const TOKEN_QUERY_PARAM = "X-Amz-Security-Token"; +const AUTH_HEADER = "authorization"; +const AMZ_DATE_HEADER = AMZ_DATE_QUERY_PARAM.toLowerCase(); +const DATE_HEADER = "date"; +const GENERATED_HEADERS = [AUTH_HEADER, AMZ_DATE_HEADER, DATE_HEADER]; +const SIGNATURE_HEADER = SIGNATURE_QUERY_PARAM.toLowerCase(); +const SHA256_HEADER = "x-amz-content-sha256"; +const TOKEN_HEADER = TOKEN_QUERY_PARAM.toLowerCase(); +const ALWAYS_UNSIGNABLE_HEADERS = { + authorization: true, + "cache-control": true, + connection: true, + expect: true, + from: true, + "keep-alive": true, + "max-forwards": true, + pragma: true, + referer: true, + te: true, + trailer: true, + "transfer-encoding": true, + upgrade: true, + "user-agent": true, + "x-amzn-trace-id": true +}; +const PROXY_HEADER_PATTERN = /^proxy-/; +const SEC_HEADER_PATTERN = /^sec-/; +const ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256"; +const EVENT_ALGORITHM_IDENTIFIER = "AWS4-HMAC-SHA256-PAYLOAD"; +const UNSIGNED_PAYLOAD = "UNSIGNED-PAYLOAD"; +const MAX_CACHE_SIZE = 50; +const KEY_TYPE_IDENTIFIER = "aws4_request"; +const MAX_PRESIGNED_TTL = 60 * 60 * 24 * 7; +const signingKeyCache = {}; +const cacheQueue = []; +const createScope = (shortDate, region, service) => `${shortDate}/${region}/${service}/${KEY_TYPE_IDENTIFIER}`; +const getSigningKey = async (sha256Constructor, credentials, shortDate, region, service) => { + const credsHash = await hmac2(sha256Constructor, credentials.secretAccessKey, credentials.accessKeyId); + const cacheKey2 = `${shortDate}:${region}:${service}:${toHex(credsHash)}:${credentials.sessionToken}`; + if (cacheKey2 in signingKeyCache) { + return signingKeyCache[cacheKey2]; } - static get singleRegex() { - return /^(.*)\$$/; + cacheQueue.push(cacheKey2); + while (cacheQueue.length > MAX_CACHE_SIZE) { + delete signingKeyCache[cacheQueue.shift()]; } - search(text2) { - const isMatch = text2.endsWith(this.pattern); - return { - isMatch, - score: isMatch ? 0 : 1, - indices: [text2.length - this.pattern.length, text2.length - 1] - }; + let key2 = `AWS4${credentials.secretAccessKey}`; + for (const signable of [shortDate, region, service, KEY_TYPE_IDENTIFIER]) { + key2 = await hmac2(sha256Constructor, key2, signable); } -} -class InverseSuffixExactMatch extends BaseMatch { - constructor(pattern) { - super(pattern); + return signingKeyCache[cacheKey2] = key2; +}; +const hmac2 = (ctor, secret, data) => { + const hash2 = new ctor(secret); + hash2.update(toUint8Array(data)); + return hash2.digest(); +}; +const getCanonicalHeaders = ({ headers }, unsignableHeaders, signableHeaders) => { + const canonical = {}; + for (const headerName of Object.keys(headers).sort()) { + if (headers[headerName] == void 0) { + continue; + } + const canonicalHeaderName = headerName.toLowerCase(); + if (canonicalHeaderName in ALWAYS_UNSIGNABLE_HEADERS || (unsignableHeaders == null ? void 0 : unsignableHeaders.has(canonicalHeaderName)) || PROXY_HEADER_PATTERN.test(canonicalHeaderName) || SEC_HEADER_PATTERN.test(canonicalHeaderName)) { + if (!signableHeaders || signableHeaders && !signableHeaders.has(canonicalHeaderName)) { + continue; + } + } + canonical[canonicalHeaderName] = headers[headerName].trim().replace(/\s+/g, " "); } - static get type() { - return "inverse-suffix-exact"; + return canonical; +}; +const getCanonicalQuery = ({ query = {} }) => { + const keys = []; + const serialized = {}; + for (const key2 of Object.keys(query).sort()) { + if (key2.toLowerCase() === SIGNATURE_HEADER) { + continue; + } + keys.push(key2); + const value = query[key2]; + if (typeof value === "string") { + serialized[key2] = `${escapeUri(key2)}=${escapeUri(value)}`; + } else if (Array.isArray(value)) { + serialized[key2] = value.slice(0).reduce((encoded, value2) => encoded.concat([`${escapeUri(key2)}=${escapeUri(value2)}`]), []).sort().join("&"); + } } - static get multiRegex() { - return /^!"(.*)"\$$/; + return keys.map((key2) => serialized[key2]).filter((serialized2) => serialized2).join("&"); +}; +const isArrayBuffer = (arg) => typeof ArrayBuffer === "function" && arg instanceof ArrayBuffer || Object.prototype.toString.call(arg) === "[object ArrayBuffer]"; +const getPayloadHash = async ({ headers, body }, hashConstructor) => { + for (const headerName of Object.keys(headers)) { + if (headerName.toLowerCase() === SHA256_HEADER) { + return headers[headerName]; + } } - static get singleRegex() { - return /^!(.*)\$$/; + if (body == void 0) { + return "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"; + } else if (typeof body === "string" || ArrayBuffer.isView(body) || isArrayBuffer(body)) { + const hashCtor = new hashConstructor(); + hashCtor.update(toUint8Array(body)); + return toHex(await hashCtor.digest()); } - search(text2) { - const isMatch = !text2.endsWith(this.pattern); - return { - isMatch, - score: isMatch ? 0 : 1, - indices: [0, text2.length - 1] - }; + return UNSIGNED_PAYLOAD; +}; +class HeaderFormatter { + format(headers) { + const chunks = []; + for (const headerName of Object.keys(headers)) { + const bytes3 = fromUtf8$3(headerName); + chunks.push(Uint8Array.from([bytes3.byteLength]), bytes3, this.formatHeaderValue(headers[headerName])); + } + const out = new Uint8Array(chunks.reduce((carry, bytes3) => carry + bytes3.byteLength, 0)); + let position = 0; + for (const chunk of chunks) { + out.set(chunk, position); + position += chunk.byteLength; + } + return out; } -} -class FuzzyMatch extends BaseMatch { - constructor(pattern, { - location: location2 = Config.location, - threshold = Config.threshold, - distance: distance2 = Config.distance, - includeMatches = Config.includeMatches, - findAllMatches = Config.findAllMatches, - minMatchCharLength = Config.minMatchCharLength, - isCaseSensitive = Config.isCaseSensitive, - ignoreLocation = Config.ignoreLocation - } = {}) { - super(pattern); - this._bitapSearch = new BitapSearch(pattern, { - location: location2, - threshold, - distance: distance2, - includeMatches, - findAllMatches, - minMatchCharLength, - isCaseSensitive, - ignoreLocation - }); - } - static get type() { - return "fuzzy"; - } - static get multiRegex() { - return /^"(.*)"$/; - } - static get singleRegex() { - return /^(.*)$/; - } - search(text2) { - return this._bitapSearch.searchIn(text2); - } -} -class IncludeMatch extends BaseMatch { - constructor(pattern) { - super(pattern); - } - static get type() { - return "include"; - } - static get multiRegex() { - return /^'"(.*)"$/; - } - static get singleRegex() { - return /^'(.*)$/; - } - search(text2) { - let location2 = 0; - let index2; - const indices = []; - const patternLen = this.pattern.length; - while ((index2 = text2.indexOf(this.pattern, location2)) > -1) { - location2 = index2 + patternLen; - indices.push([index2, location2 - 1]); + formatHeaderValue(header) { + switch (header.type) { + case "boolean": + return Uint8Array.from([header.value ? 0 : 1]); + case "byte": + return Uint8Array.from([2, header.value]); + case "short": + const shortView = new DataView(new ArrayBuffer(3)); + shortView.setUint8(0, 3); + shortView.setInt16(1, header.value, false); + return new Uint8Array(shortView.buffer); + case "integer": + const intView = new DataView(new ArrayBuffer(5)); + intView.setUint8(0, 4); + intView.setInt32(1, header.value, false); + return new Uint8Array(intView.buffer); + case "long": + const longBytes = new Uint8Array(9); + longBytes[0] = 5; + longBytes.set(header.value.bytes, 1); + return longBytes; + case "binary": + const binView = new DataView(new ArrayBuffer(3 + header.value.byteLength)); + binView.setUint8(0, 6); + binView.setUint16(1, header.value.byteLength, false); + const binBytes = new Uint8Array(binView.buffer); + binBytes.set(header.value, 3); + return binBytes; + case "string": + const utf8Bytes = fromUtf8$3(header.value); + const strView = new DataView(new ArrayBuffer(3 + utf8Bytes.byteLength)); + strView.setUint8(0, 7); + strView.setUint16(1, utf8Bytes.byteLength, false); + const strBytes = new Uint8Array(strView.buffer); + strBytes.set(utf8Bytes, 3); + return strBytes; + case "timestamp": + const tsBytes = new Uint8Array(9); + tsBytes[0] = 8; + tsBytes.set(Int64.fromNumber(header.value.valueOf()).bytes, 1); + return tsBytes; + case "uuid": + if (!UUID_PATTERN.test(header.value)) { + throw new Error(`Invalid UUID received: ${header.value}`); + } + const uuidBytes = new Uint8Array(17); + uuidBytes[0] = 9; + uuidBytes.set(fromHex(header.value.replace(/\-/g, "")), 1); + return uuidBytes; } - const isMatch = !!indices.length; - return { - isMatch, - score: isMatch ? 0 : 1, - indices - }; } } -const searchers = [ - ExactMatch, - IncludeMatch, - PrefixExactMatch, - InversePrefixExactMatch, - InverseSuffixExactMatch, - SuffixExactMatch, - InverseExactMatch, - FuzzyMatch -]; -const searchersLen = searchers.length; -const SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/; -const OR_TOKEN = "|"; -function parseQuery(pattern, options = {}) { - return pattern.split(OR_TOKEN).map((item2) => { - let query = item2.trim().split(SPACE_RE).filter((item3) => item3 && !!item3.trim()); - let results2 = []; - for (let i2 = 0, len = query.length; i2 < len; i2 += 1) { - const queryItem = query[i2]; - let found = false; - let idx = -1; - while (!found && ++idx < searchersLen) { - const searcher = searchers[idx]; - let token = searcher.isMultiMatch(queryItem); - if (token) { - results2.push(new searcher(token, options)); - found = true; - } - } - if (found) { - continue; - } - idx = -1; - while (++idx < searchersLen) { - const searcher = searchers[idx]; - let token = searcher.isSingleMatch(queryItem); - if (token) { - results2.push(new searcher(token, options)); - break; - } - } +var HEADER_VALUE_TYPE; +(function(HEADER_VALUE_TYPE2) { + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolTrue"] = 0] = "boolTrue"; + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["boolFalse"] = 1] = "boolFalse"; + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byte"] = 2] = "byte"; + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["short"] = 3] = "short"; + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["integer"] = 4] = "integer"; + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["long"] = 5] = "long"; + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["byteArray"] = 6] = "byteArray"; + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["string"] = 7] = "string"; + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["timestamp"] = 8] = "timestamp"; + HEADER_VALUE_TYPE2[HEADER_VALUE_TYPE2["uuid"] = 9] = "uuid"; +})(HEADER_VALUE_TYPE || (HEADER_VALUE_TYPE = {})); +const UUID_PATTERN = /^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/; +class Int64 { + constructor(bytes3) { + this.bytes = bytes3; + if (bytes3.byteLength !== 8) { + throw new Error("Int64 buffers must be exactly 8 bytes"); } - return results2; - }); -} -const MultiMatchSet = /* @__PURE__ */ new Set([FuzzyMatch.type, IncludeMatch.type]); -class ExtendedSearch { - constructor(pattern, { - isCaseSensitive = Config.isCaseSensitive, - includeMatches = Config.includeMatches, - minMatchCharLength = Config.minMatchCharLength, - ignoreLocation = Config.ignoreLocation, - findAllMatches = Config.findAllMatches, - location: location2 = Config.location, - threshold = Config.threshold, - distance: distance2 = Config.distance - } = {}) { - this.query = null; - this.options = { - isCaseSensitive, - includeMatches, - minMatchCharLength, - findAllMatches, - ignoreLocation, - location: location2, - threshold, - distance: distance2 - }; - this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase(); - this.query = parseQuery(this.pattern, this.options); - } - static condition(_, options) { - return options.useExtendedSearch; } - searchIn(text2) { - const query = this.query; - if (!query) { - return { - isMatch: false, - score: 1 - }; + static fromNumber(number2) { + if (number2 > 9223372036854776e3 || number2 < -9223372036854776e3) { + throw new Error(`${number2} is too large (or, if negative, too small) to represent as an Int64`); } - const { includeMatches, isCaseSensitive } = this.options; - text2 = isCaseSensitive ? text2 : text2.toLowerCase(); - let numMatches = 0; - let allIndices = []; - let totalScore = 0; - for (let i2 = 0, qLen = query.length; i2 < qLen; i2 += 1) { - const searchers2 = query[i2]; - allIndices.length = 0; - numMatches = 0; - for (let j2 = 0, pLen = searchers2.length; j2 < pLen; j2 += 1) { - const searcher = searchers2[j2]; - const { isMatch, indices, score } = searcher.search(text2); - if (isMatch) { - numMatches += 1; - totalScore += score; - if (includeMatches) { - const type = searcher.constructor.type; - if (MultiMatchSet.has(type)) { - allIndices = [...allIndices, ...indices]; - } else { - allIndices.push(indices); - } - } - } else { - totalScore = 0; - numMatches = 0; - allIndices.length = 0; - break; - } - } - if (numMatches) { - let result = { - isMatch: true, - score: totalScore / numMatches - }; - if (includeMatches) { - result.indices = allIndices; - } - return result; - } + const bytes3 = new Uint8Array(8); + for (let i = 7, remaining = Math.abs(Math.round(number2)); i > -1 && remaining > 0; i--, remaining /= 256) { + bytes3[i] = remaining; } - return { - isMatch: false, - score: 1 - }; - } -} -const registeredSearchers = []; -function register(...args) { - registeredSearchers.push(...args); -} -function createSearcher(pattern, options) { - for (let i2 = 0, len = registeredSearchers.length; i2 < len; i2 += 1) { - let searcherClass = registeredSearchers[i2]; - if (searcherClass.condition(pattern, options)) { - return new searcherClass(pattern, options); + if (number2 < 0) { + negate(bytes3); } + return new Int64(bytes3); } - return new BitapSearch(pattern, options); -} -const LogicalOperator = { - AND: "$and", - OR: "$or" -}; -const KeyType = { - PATH: "$path", - PATTERN: "$val" -}; -const isExpression = (query) => !!(query[LogicalOperator.AND] || query[LogicalOperator.OR]); -const isPath = (query) => !!query[KeyType.PATH]; -const isLeaf = (query) => !isArray(query) && isObject(query) && !isExpression(query); -const convertToExplicit = (query) => ({ - [LogicalOperator.AND]: Object.keys(query).map((key2) => ({ - [key2]: query[key2] - })) -}); -function parse$1(query, options, { auto: auto2 = true } = {}) { - const next = (query2) => { - let keys = Object.keys(query2); - const isQueryPath = isPath(query2); - if (!isQueryPath && keys.length > 1 && !isExpression(query2)) { - return next(convertToExplicit(query2)); - } - if (isLeaf(query2)) { - const key2 = isQueryPath ? query2[KeyType.PATH] : keys[0]; - const pattern = isQueryPath ? query2[KeyType.PATTERN] : query2[key2]; - if (!isString(pattern)) { - throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key2)); - } - const obj = { - keyId: createKeyId(key2), - pattern - }; - if (auto2) { - obj.searcher = createSearcher(pattern, options); - } - return obj; + valueOf() { + const bytes3 = this.bytes.slice(0); + const negative = bytes3[0] & 128; + if (negative) { + negate(bytes3); } - let node = { - children: [], - operator: keys[0] - }; - keys.forEach((key2) => { - const value = query2[key2]; - if (isArray(value)) { - value.forEach((item2) => { - node.children.push(next(item2)); - }); - } - }); - return node; - }; - if (!isExpression(query)) { - query = convertToExplicit(query); + return parseInt(toHex(bytes3), 16) * (negative ? -1 : 1); } - return next(query); -} -function computeScore(results2, { ignoreFieldNorm = Config.ignoreFieldNorm }) { - results2.forEach((result) => { - let totalScore = 1; - result.matches.forEach(({ key: key2, norm: norm2, score }) => { - const weight = key2 ? key2.weight : null; - totalScore *= Math.pow( - score === 0 && weight ? Number.EPSILON : score, - (weight || 1) * (ignoreFieldNorm ? 1 : norm2) - ); - }); - result.score = totalScore; - }); -} -function transformMatches(result, data) { - const matches = result.matches; - data.matches = []; - if (!isDefined(matches)) { - return; + toString() { + return String(this.valueOf()); } - matches.forEach((match) => { - if (!isDefined(match.indices) || !match.indices.length) { - return; - } - const { indices, value } = match; - let obj = { - indices, - value - }; - if (match.key) { - obj.key = match.key.src; - } - if (match.idx > -1) { - obj.refIndex = match.idx; - } - data.matches.push(obj); - }); -} -function transformScore(result, data) { - data.score = result.score; } -function format(results2, docs, { - includeMatches = Config.includeMatches, - includeScore = Config.includeScore -} = {}) { - const transformers = []; - if (includeMatches) - transformers.push(transformMatches); - if (includeScore) - transformers.push(transformScore); - return results2.map((result) => { - const { idx } = result; - const data = { - item: docs[idx], - refIndex: idx - }; - if (transformers.length) { - transformers.forEach((transformer) => { - transformer(result, data); - }); - } - return data; - }); +function negate(bytes3) { + for (let i = 0; i < 8; i++) { + bytes3[i] ^= 255; + } + for (let i = 7; i > -1; i--) { + bytes3[i]++; + if (bytes3[i] !== 0) + break; + } } -class Fuse { - constructor(docs, options = {}, index2) { - this.options = { ...Config, ...options }; - if (this.options.useExtendedSearch && false) { - throw new Error(EXTENDED_SEARCH_UNAVAILABLE); +const hasHeader = (soughtHeader, headers) => { + soughtHeader = soughtHeader.toLowerCase(); + for (const headerName of Object.keys(headers)) { + if (soughtHeader === headerName.toLowerCase()) { + return true; } - this._keyStore = new KeyStore(this.options.keys); - this.setCollection(docs, index2); } - setCollection(docs, index2) { - this._docs = docs; - if (index2 && !(index2 instanceof FuseIndex)) { - throw new Error(INCORRECT_INDEX_TYPE); + return false; +}; +const cloneRequest = ({ headers, query, ...rest }) => ({ + ...rest, + headers: { ...headers }, + query: query ? cloneQuery(query) : void 0 +}); +const cloneQuery = (query) => Object.keys(query).reduce((carry, paramName) => { + const param = query[paramName]; + return { + ...carry, + [paramName]: Array.isArray(param) ? [...param] : param + }; +}, {}); +const moveHeadersToQuery = (request, options = {}) => { + var _a2; + const { headers, query = {} } = typeof request.clone === "function" ? request.clone() : cloneRequest(request); + for (const name2 of Object.keys(headers)) { + const lname = name2.toLowerCase(); + if (lname.slice(0, 6) === "x-amz-" && !((_a2 = options.unhoistableHeaders) == null ? void 0 : _a2.has(lname))) { + query[name2] = headers[name2]; + delete headers[name2]; } - this._myIndex = index2 || createIndex(this.options.keys, this._docs, { - getFn: this.options.getFn, - fieldNormWeight: this.options.fieldNormWeight - }); } - add(doc) { - if (!isDefined(doc)) { - return; + return { + ...request, + headers, + query + }; +}; +const prepareRequest = (request) => { + request = typeof request.clone === "function" ? request.clone() : cloneRequest(request); + for (const headerName of Object.keys(request.headers)) { + if (GENERATED_HEADERS.indexOf(headerName.toLowerCase()) > -1) { + delete request.headers[headerName]; } - this._docs.push(doc); - this._myIndex.add(doc); } - remove(predicate = () => false) { - const results2 = []; - for (let i2 = 0, len = this._docs.length; i2 < len; i2 += 1) { - const doc = this._docs[i2]; - if (predicate(doc, i2)) { - this.removeAt(i2); - i2 -= 1; - len -= 1; - results2.push(doc); - } - } - return results2; + return request; +}; +const iso8601 = (time2) => toDate(time2).toISOString().replace(/\.\d{3}Z$/, "Z"); +const toDate = (time2) => { + if (typeof time2 === "number") { + return new Date(time2 * 1e3); } - removeAt(idx) { - this._docs.splice(idx, 1); - this._myIndex.removeAt(idx); + if (typeof time2 === "string") { + if (Number(time2)) { + return new Date(Number(time2) * 1e3); + } + return new Date(time2); } - getIndex() { - return this._myIndex; + return time2; +}; +class SignatureV4 { + constructor({ applyChecksum, credentials, region, service, sha256: sha2562, uriEscapePath = true }) { + this.headerFormatter = new HeaderFormatter(); + this.service = service; + this.sha256 = sha2562; + this.uriEscapePath = uriEscapePath; + this.applyChecksum = typeof applyChecksum === "boolean" ? applyChecksum : true; + this.regionProvider = normalizeProvider$1(region); + this.credentialProvider = normalizeProvider$1(credentials); } - search(query, { limit = -1 } = {}) { - const { - includeMatches, - includeScore, - shouldSort, - sortFn, - ignoreFieldNorm - } = this.options; - let results2 = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query); - computeScore(results2, { ignoreFieldNorm }); - if (shouldSort) { - results2.sort(sortFn); + async presign(originalRequest, options = {}) { + const { signingDate = /* @__PURE__ */ new Date(), expiresIn = 3600, unsignableHeaders, unhoistableHeaders, signableHeaders, signingRegion, signingService } = options; + const credentials = await this.credentialProvider(); + this.validateResolvedCredentials(credentials); + const region = signingRegion ?? await this.regionProvider(); + const { longDate, shortDate } = formatDate(signingDate); + if (expiresIn > MAX_PRESIGNED_TTL) { + return Promise.reject("Signature version 4 presigned URLs must have an expiration date less than one week in the future"); } - if (isNumber(limit) && limit > -1) { - results2 = results2.slice(0, limit); + const scope = createScope(shortDate, region, signingService ?? this.service); + const request = moveHeadersToQuery(prepareRequest(originalRequest), { unhoistableHeaders }); + if (credentials.sessionToken) { + request.query[TOKEN_QUERY_PARAM] = credentials.sessionToken; } - return format(results2, this._docs, { - includeMatches, - includeScore - }); + request.query[ALGORITHM_QUERY_PARAM] = ALGORITHM_IDENTIFIER; + request.query[CREDENTIAL_QUERY_PARAM] = `${credentials.accessKeyId}/${scope}`; + request.query[AMZ_DATE_QUERY_PARAM] = longDate; + request.query[EXPIRES_QUERY_PARAM] = expiresIn.toString(10); + const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders); + request.query[SIGNED_HEADERS_QUERY_PARAM] = getCanonicalHeaderList(canonicalHeaders); + request.query[SIGNATURE_QUERY_PARAM] = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, await getPayloadHash(originalRequest, this.sha256))); + return request; } - _searchStringList(query) { - const searcher = createSearcher(query, this.options); - const { records } = this._myIndex; - const results2 = []; - records.forEach(({ v: text2, i: idx, n: norm2 }) => { - if (!isDefined(text2)) { - return; - } - const { isMatch, score, indices } = searcher.searchIn(text2); - if (isMatch) { - results2.push({ - item: text2, - idx, - matches: [{ score, value: text2, norm: norm2, indices }] - }); - } - }); - return results2; + async sign(toSign, options) { + if (typeof toSign === "string") { + return this.signString(toSign, options); + } else if (toSign.headers && toSign.payload) { + return this.signEvent(toSign, options); + } else if (toSign.message) { + return this.signMessage(toSign, options); + } else { + return this.signRequest(toSign, options); + } } - _searchLogical(query) { - const expression = parse$1(query, this.options); - const evaluate2 = (node, item2, idx) => { - if (!node.children) { - const { keyId, searcher } = node; - const matches = this._findMatches({ - key: this._keyStore.get(keyId), - value: this._myIndex.getValueForItemAtKeyId(item2, keyId), - searcher - }); - if (matches && matches.length) { - return [ - { - idx, - item: item2, - matches - } - ]; - } - return []; - } - const res = []; - for (let i2 = 0, len = node.children.length; i2 < len; i2 += 1) { - const child = node.children[i2]; - const result = evaluate2(child, item2, idx); - if (result.length) { - res.push(...result); - } else if (node.operator === LogicalOperator.AND) { - return []; - } - } - return res; - }; - const records = this._myIndex.records; - const resultMap = {}; - const results2 = []; - records.forEach(({ $: item2, i: idx }) => { - if (isDefined(item2)) { - let expResults = evaluate2(expression, item2, idx); - if (expResults.length) { - if (!resultMap[idx]) { - resultMap[idx] = { idx, item: item2, matches: [] }; - results2.push(resultMap[idx]); - } - expResults.forEach(({ matches }) => { - resultMap[idx].matches.push(...matches); - }); - } - } - }); - return results2; + async signEvent({ headers, payload }, { signingDate = /* @__PURE__ */ new Date(), priorSignature, signingRegion, signingService }) { + const region = signingRegion ?? await this.regionProvider(); + const { shortDate, longDate } = formatDate(signingDate); + const scope = createScope(shortDate, region, signingService ?? this.service); + const hashedPayload = await getPayloadHash({ headers: {}, body: payload }, this.sha256); + const hash2 = new this.sha256(); + hash2.update(headers); + const hashedHeaders = toHex(await hash2.digest()); + const stringToSign = [ + EVENT_ALGORITHM_IDENTIFIER, + longDate, + scope, + priorSignature, + hashedHeaders, + hashedPayload + ].join("\n"); + return this.signString(stringToSign, { signingDate, signingRegion: region, signingService }); } - _searchObjectList(query) { - const searcher = createSearcher(query, this.options); - const { keys, records } = this._myIndex; - const results2 = []; - records.forEach(({ $: item2, i: idx }) => { - if (!isDefined(item2)) { - return; - } - let matches = []; - keys.forEach((key2, keyIndex) => { - matches.push( - ...this._findMatches({ - key: key2, - value: item2[keyIndex], - searcher - }) - ); - }); - if (matches.length) { - results2.push({ - idx, - item: item2, - matches - }); - } + async signMessage(signableMessage, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService }) { + const promise = this.signEvent({ + headers: this.headerFormatter.format(signableMessage.message.headers), + payload: signableMessage.message.body + }, { + signingDate, + signingRegion, + signingService, + priorSignature: signableMessage.priorSignature + }); + return promise.then((signature2) => { + return { message: signableMessage.message, signature: signature2 }; }); - return results2; } - _findMatches({ key: key2, value, searcher }) { - if (!isDefined(value)) { - return []; + async signString(stringToSign, { signingDate = /* @__PURE__ */ new Date(), signingRegion, signingService } = {}) { + const credentials = await this.credentialProvider(); + this.validateResolvedCredentials(credentials); + const region = signingRegion ?? await this.regionProvider(); + const { shortDate } = formatDate(signingDate); + const hash2 = new this.sha256(await this.getSigningKey(credentials, region, shortDate, signingService)); + hash2.update(toUint8Array(stringToSign)); + return toHex(await hash2.digest()); + } + async signRequest(requestToSign, { signingDate = /* @__PURE__ */ new Date(), signableHeaders, unsignableHeaders, signingRegion, signingService } = {}) { + const credentials = await this.credentialProvider(); + this.validateResolvedCredentials(credentials); + const region = signingRegion ?? await this.regionProvider(); + const request = prepareRequest(requestToSign); + const { longDate, shortDate } = formatDate(signingDate); + const scope = createScope(shortDate, region, signingService ?? this.service); + request.headers[AMZ_DATE_HEADER] = longDate; + if (credentials.sessionToken) { + request.headers[TOKEN_HEADER] = credentials.sessionToken; } - let matches = []; - if (isArray(value)) { - value.forEach(({ v: text2, i: idx, n: norm2 }) => { - if (!isDefined(text2)) { - return; - } - const { isMatch, score, indices } = searcher.searchIn(text2); - if (isMatch) { - matches.push({ - score, - key: key2, - value: text2, - idx, - norm: norm2, - indices - }); + const payloadHash = await getPayloadHash(request, this.sha256); + if (!hasHeader(SHA256_HEADER, request.headers) && this.applyChecksum) { + request.headers[SHA256_HEADER] = payloadHash; + } + const canonicalHeaders = getCanonicalHeaders(request, unsignableHeaders, signableHeaders); + const signature2 = await this.getSignature(longDate, scope, this.getSigningKey(credentials, region, shortDate, signingService), this.createCanonicalRequest(request, canonicalHeaders, payloadHash)); + request.headers[AUTH_HEADER] = `${ALGORITHM_IDENTIFIER} Credential=${credentials.accessKeyId}/${scope}, SignedHeaders=${getCanonicalHeaderList(canonicalHeaders)}, Signature=${signature2}`; + return request; + } + createCanonicalRequest(request, canonicalHeaders, payloadHash) { + const sortedHeaders = Object.keys(canonicalHeaders).sort(); + return `${request.method} +${this.getCanonicalPath(request)} +${getCanonicalQuery(request)} +${sortedHeaders.map((name2) => `${name2}:${canonicalHeaders[name2]}`).join("\n")} + +${sortedHeaders.join(";")} +${payloadHash}`; + } + async createStringToSign(longDate, credentialScope, canonicalRequest) { + const hash2 = new this.sha256(); + hash2.update(toUint8Array(canonicalRequest)); + const hashedRequest = await hash2.digest(); + return `${ALGORITHM_IDENTIFIER} +${longDate} +${credentialScope} +${toHex(hashedRequest)}`; + } + getCanonicalPath({ path }) { + if (this.uriEscapePath) { + const normalizedPathSegments = []; + for (const pathSegment of path.split("/")) { + if ((pathSegment == null ? void 0 : pathSegment.length) === 0) + continue; + if (pathSegment === ".") + continue; + if (pathSegment === "..") { + normalizedPathSegments.pop(); + } else { + normalizedPathSegments.push(pathSegment); } - }); - } else { - const { v: text2, n: norm2 } = value; - const { isMatch, score, indices } = searcher.searchIn(text2); - if (isMatch) { - matches.push({ score, key: key2, value: text2, norm: norm2, indices }); } + const normalizedPath = `${(path == null ? void 0 : path.startsWith("/")) ? "/" : ""}${normalizedPathSegments.join("/")}${normalizedPathSegments.length > 0 && (path == null ? void 0 : path.endsWith("/")) ? "/" : ""}`; + const doubleEncoded = escapeUri(normalizedPath); + return doubleEncoded.replace(/%2F/g, "/"); } - return matches; + return path; } -} -Fuse.version = "6.6.2"; -Fuse.createIndex = createIndex; -Fuse.parseIndex = parseIndex; -Fuse.config = Config; -{ - Fuse.parseQuery = parse$1; -} -{ - register(ExtendedSearch); -} -const BalanceItem = ({ balance }) => { - var _a2, _b2, _c2; - const { chains: chains2 } = useConfig(); - const { setNavigation } = useNavigation(); - const isNativeToken = compareAddress(balance.contractAddress, AddressZero); - const nativeTokenInfo = getNativeTokenInfoByChainId(balance.chainId, chains2); - const logoURI = isNativeToken ? nativeTokenInfo.logoURI : (_a2 = balance == null ? void 0 : balance.contractInfo) == null ? void 0 : _a2.logoURI; - const tokenName = isNativeToken ? nativeTokenInfo.name : ((_b2 = balance == null ? void 0 : balance.contractInfo) == null ? void 0 : _b2.name) || "Unknown"; - const symbol = isNativeToken ? nativeTokenInfo.symbol : (_c2 = balance == null ? void 0 : balance.contractInfo) == null ? void 0 : _c2.symbol; - const getQuantity = () => { - var _a3, _b3; - if (balance.contractType === "ERC721" || balance.contractType === "ERC1155") { - return balance.balance; + async getSignature(longDate, credentialScope, keyPromise, canonicalRequest) { + const stringToSign = await this.createStringToSign(longDate, credentialScope, canonicalRequest); + const hash2 = new this.sha256(await keyPromise); + hash2.update(toUint8Array(stringToSign)); + return toHex(await hash2.digest()); + } + getSigningKey(credentials, region, shortDate, service) { + return getSigningKey(this.sha256, credentials, shortDate, region, service || this.service); + } + validateResolvedCredentials(credentials) { + if (typeof credentials !== "object" || typeof credentials.accessKeyId !== "string" || typeof credentials.secretAccessKey !== "string") { + throw new Error("Resolved credential object is not valid"); } - const decimals = isNativeToken ? nativeTokenInfo.decimals : (_a3 = balance == null ? void 0 : balance.contractInfo) == null ? void 0 : _a3.decimals; - const bal = formatUnits$1(balance.balance, decimals || 0); - const displayBalance = formatDisplay(bal); - const symbol2 = isNativeToken ? nativeTokenInfo.symbol : (_b3 = balance == null ? void 0 : balance.contractInfo) == null ? void 0 : _b3.symbol; - return `${displayBalance} ${symbol2}`; + } +} +const formatDate = (now2) => { + const longDate = iso8601(now2).replace(/[\-:]/g, ""); + return { + longDate, + shortDate: longDate.slice(0, 8) }; - const onClick = () => { - const isCollection = balance.contractType === "ERC721" || balance.contractType === "ERC1155"; - if (isCollection) { - setNavigation({ - location: "collection-details", - params: { - contractAddress: balance.contractAddress, - chainId: balance.chainId - } - }); +}; +const getCanonicalHeaderList = (headers) => Object.keys(headers).sort().join(";"); +const resolveAwsSdkSigV4Config = (config2) => { + let normalizedCreds; + if (config2.credentials) { + normalizedCreds = memoizeIdentityProvider(config2.credentials, isIdentityExpired, doesIdentityRequireRefresh); + } + if (!normalizedCreds) { + if (config2.credentialDefaultProvider) { + normalizedCreds = normalizeProvider(config2.credentialDefaultProvider(Object.assign({}, config2, { + parentClientConfig: config2 + }))); } else { - setNavigation({ - location: "coin-details", - params: { - contractAddress: balance.contractAddress, - chainId: balance.chainId - } - }); + normalizedCreds = async () => { + throw new Error("`credentials` is missing"); + }; } + } + const { signingEscapePath = true, systemClockOffset = config2.systemClockOffset || 0, sha256: sha2562 } = config2; + let signer2; + if (config2.signer) { + signer2 = normalizeProvider(config2.signer); + } else if (config2.regionInfoProvider) { + signer2 = () => normalizeProvider(config2.region)().then(async (region) => [ + await config2.regionInfoProvider(region, { + useFipsEndpoint: await config2.useFipsEndpoint(), + useDualstackEndpoint: await config2.useDualstackEndpoint() + }) || {}, + region + ]).then(([regionInfo, region]) => { + const { signingRegion, signingService } = regionInfo; + config2.signingRegion = config2.signingRegion || signingRegion || region; + config2.signingName = config2.signingName || signingService || config2.serviceId; + const params = { + ...config2, + credentials: normalizedCreds, + region: config2.signingRegion, + service: config2.signingName, + sha256: sha2562, + uriEscapePath: signingEscapePath + }; + const SignerCtor = config2.signerConstructor || SignatureV4; + return new SignerCtor(params); + }); + } else { + signer2 = async (authScheme) => { + authScheme = Object.assign({}, { + name: "sigv4", + signingName: config2.signingName || config2.defaultSigningName, + signingRegion: await normalizeProvider(config2.region)(), + properties: {} + }, authScheme); + const signingRegion = authScheme.signingRegion; + const signingService = authScheme.signingName; + config2.signingRegion = config2.signingRegion || signingRegion; + config2.signingName = config2.signingName || signingService || config2.serviceId; + const params = { + ...config2, + credentials: normalizedCreds, + region: config2.signingRegion, + service: config2.signingName, + sha256: sha2562, + uriEscapePath: signingEscapePath + }; + const SignerCtor = config2.signerConstructor || SignatureV4; + return new SignerCtor(params); + }; + } + return { + ...config2, + systemClockOffset, + signingEscapePath, + credentials: normalizedCreds, + signer: signer2 }; - return jsxRuntimeExports$1.jsxs(Box, { onClick, width: "full", flexDirection: "row", justifyContent: "space-between", alignItems: "center", userSelect: "none", cursor: "pointer", opacity: { hover: "80" }, children: [jsxRuntimeExports$1.jsxs(Box, { gap: "3", flexDirection: "row", alignItems: "center", justifyContent: "center", children: [jsxRuntimeExports$1.jsx(TokenImage, { src: logoURI, symbol, size: "md" }), jsxRuntimeExports$1.jsxs(Box, { gap: "1", flexDirection: "row", alignItems: "center", justifyContent: "center", children: [jsxRuntimeExports$1.jsx(Text, { color: "text100", fontWeight: "bold", fontSize: "normal", style: { - textOverflow: "ellipsis", - overflow: "hidden", - maxWidth: "250px", - // @ts-ignore-next-line - textWrap: "nowrap" - }, children: tokenName }), jsxRuntimeExports$1.jsx(NetworkImage, { chainId: balance.chainId, size: "xs" })] })] }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", alignItems: "center", justifyContent: "center", gap: "1", children: [jsxRuntimeExports$1.jsx(Text, { color: "text50", fontWeight: "bold", fontSize: "normal", children: getQuantity() }), jsxRuntimeExports$1.jsx(SvgChevronRightIcon, { color: "text50" })] })] }, balance.contractAddress); }; -const WalletLink = ({ toLocation, label }) => { - const { setNavigation } = useNavigation(); - const onClick = () => { - setNavigation(toLocation); - }; - return jsxRuntimeExports$1.jsxs(Box, { onClick, width: "full", flexDirection: "row", justifyContent: "space-between", alignItems: "center", userSelect: "none", cursor: "pointer", opacity: { hover: "80" }, children: [jsxRuntimeExports$1.jsx(Text, { color: "text50", fontSize: "normal", fontWeight: "medium", children: label }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", justifyContent: "center", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Text, { color: "text50", fontSize: "normal", fontWeight: "medium", children: "View all" }), jsxRuntimeExports$1.jsx(SvgChevronRightIcon, { color: "text50", size: "sm" })] })] }); +const collectBodyString = (streamBody, context2) => collectBody(streamBody, context2).then((body) => context2.utf8Encoder(body)); +const parseJsonBody = (streamBody, context2) => collectBodyString(streamBody, context2).then((encoded) => { + if (encoded.length) { + try { + return JSON.parse(encoded); + } catch (e2) { + if ((e2 == null ? void 0 : e2.name) === "SyntaxError") { + Object.defineProperty(e2, "$responseBodyText", { + value: encoded + }); + } + throw e2; + } + } + return {}; +}); +const parseJsonErrorBody = async (errorBody, context2) => { + const value = await parseJsonBody(errorBody, context2); + value.message = value.message ?? value.Message; + return value; }; -const SearchWallet = () => { - const { chains: chains2 } = useConfig(); - const { fiatCurrency, hideUnlistedTokens, selectedNetworks } = useSettings(); - const [search2, setSearch] = reactExports.useState(""); - const { address: accountAddress } = useAccount(); - const { data: tokenBalancesData, isPending: isPendingTokenBalances } = useBalances({ - chainIds: selectedNetworks, - accountAddress: accountAddress || "", - verifiedOnly: hideUnlistedTokens - }); - const coinBalancesUnordered = (tokenBalancesData == null ? void 0 : tokenBalancesData.filter((b2) => b2.contractType === "ERC20" || compareAddress(b2.contractAddress, AddressZero))) || []; - const { data: coinPrices = [], isPending: isPendingCoinPrices } = useCoinPrices(coinBalancesUnordered.map((token) => ({ - chainId: token.chainId, - contractAddress: token.contractAddress - }))); - const { data: conversionRate = 1, isPending: isPendingConversionRate } = useExchangeRate(fiatCurrency.symbol); - const coinBalances = coinBalancesUnordered.sort((a2, b2) => { - var _a2, _b2; - const isHigherFiat = Number(computeBalanceFiat({ - balance: b2, - prices: coinPrices, - conversionRate, - decimals: ((_a2 = b2.contractInfo) == null ? void 0 : _a2.decimals) || 18 - })) - Number(computeBalanceFiat({ - balance: a2, - prices: coinPrices, - conversionRate, - decimals: ((_b2 = b2.contractInfo) == null ? void 0 : _b2.decimals) || 18 - })); - return isHigherFiat; - }); - const collectionBalancesUnordered = (tokenBalancesData == null ? void 0 : tokenBalancesData.filter((b2) => b2.contractType === "ERC721" || b2.contractType === "ERC1155")) || []; - const collectionBalances = collectionBalancesUnordered.sort((a2, b2) => { - return Number(b2.balance) - Number(a2.balance); - }); - const isPending = isPendingTokenBalances || isPendingCoinPrices || isPendingConversionRate; - const indexedCollectionBalances = collectionBalances.map((balance, index2) => { - var _a2; - return { - index: index2, - name: ((_a2 = balance.contractInfo) == null ? void 0 : _a2.name) || "Unknown" - }; - }); - const indexedCoinBalances = coinBalances.map((balance, index2) => { - var _a2; - if (compareAddress(balance.contractAddress, AddressZero)) { - const nativeTokenInfo = getNativeTokenInfoByChainId(balance.chainId, chains2); - return { - index: index2, - name: nativeTokenInfo.name - }; - } else { - return { - index: index2, - name: ((_a2 = balance.contractInfo) == null ? void 0 : _a2.name) || "Unknown" - }; +const loadRestJsonErrorCode = (output2, data) => { + const findKey = (object, key2) => Object.keys(object).find((k2) => k2.toLowerCase() === key2.toLowerCase()); + const sanitizeErrorCode = (rawValue) => { + let cleanValue = rawValue; + if (typeof cleanValue === "number") { + cleanValue = cleanValue.toString(); } - }); - const coinBalancesAmount = coinBalances.length; - const collectionBalancesAmount = collectionBalances.length; - const fuzzySearchCoinBalances = new Fuse(indexedCoinBalances, { - keys: ["name"] - }); - const fuzzySearchCollections = new Fuse(indexedCollectionBalances, { - keys: ["name"] - }); - const foundCoinBalances = (search2 === "" ? indexedCoinBalances : fuzzySearchCoinBalances.search(search2).map((result) => result.item)).slice(0, 5); - const foundCollectionBalances = (search2 === "" ? indexedCollectionBalances : fuzzySearchCollections.search(search2).map((result) => result.item)).slice(0, 5); - return jsxRuntimeExports$1.jsxs(Box, { paddingX: "4", paddingBottom: "5", paddingTop: "3", flexDirection: "column", gap: "10", alignItems: "center", justifyContent: "center", children: [jsxRuntimeExports$1.jsx(Box, { width: "full", children: jsxRuntimeExports$1.jsx(TextInput, { autoFocus: true, name: "search wallet", leftIcon: SvgSearchIcon, value: search2, onChange: (ev) => setSearch(ev.target.value), placeholder: "Search your wallet", "data-1p-ignore": true }) }), jsxRuntimeExports$1.jsxs(Box, { width: "full", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "5", children: [jsxRuntimeExports$1.jsx(WalletLink, { toLocation: { - location: "search-view-all", - params: { - defaultTab: "collections" + if (cleanValue.indexOf(",") >= 0) { + cleanValue = cleanValue.split(",")[0]; } - }, label: `Collections (${collectionBalancesAmount})` }), isPending ? Array(5).fill(null).map((_, i2) => jsxRuntimeExports$1.jsx(Skeleton, { width: "full", height: "8" }, i2)) : foundCollectionBalances.length === 0 ? jsxRuntimeExports$1.jsx(Text, { color: "text100", children: "No collections found" }) : foundCollectionBalances.map((indexedItem, index2) => { - const balance = collectionBalances[indexedItem.index]; - return jsxRuntimeExports$1.jsx(BalanceItem, { balance }, index2); - })] }), jsxRuntimeExports$1.jsxs(Box, { width: "full", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "5", children: [jsxRuntimeExports$1.jsx(WalletLink, { toLocation: { - location: "search-view-all", - params: { - defaultTab: "coins" + if (cleanValue.indexOf(":") >= 0) { + cleanValue = cleanValue.split(":")[0]; } - }, label: `Coins (${coinBalancesAmount})` }), isPending ? Array(5).fill(null).map((_, i2) => jsxRuntimeExports$1.jsx(Skeleton, { width: "full", height: "8" }, i2)) : foundCoinBalances.length === 0 ? jsxRuntimeExports$1.jsx(Text, { color: "text100", children: "No coins found" }) : foundCoinBalances.map((indexItem, index2) => { - const balance = coinBalances[indexItem.index]; - return jsxRuntimeExports$1.jsx(BalanceItem, { balance }, index2); - })] })] }); + if (cleanValue.indexOf("#") >= 0) { + cleanValue = cleanValue.split("#")[1]; + } + return cleanValue; + }; + const headerKey = findKey(output2.headers, "x-amzn-errortype"); + if (headerKey !== void 0) { + return sanitizeErrorCode(output2.headers[headerKey]); + } + if (data.code !== void 0) { + return sanitizeErrorCode(data.code); + } + if (data["__type"] !== void 0) { + return sanitizeErrorCode(data["__type"]); + } }; -const SearchWalletViewAll = ({ defaultTab }) => { - const { chains: chains2 } = useConfig(); - const { fiatCurrency, hideUnlistedTokens, selectedNetworks } = useSettings(); - const [search2, setSearch] = reactExports.useState(""); - const [selectedTab, setSelectedTab] = reactExports.useState(defaultTab); - reactExports.useEffect(() => { - setSearch(""); - }, [selectedTab]); - const { address: accountAddress } = useAccount(); - const { data: tokenBalancesData, isPending: isPendingTokenBalances } = useBalances({ - chainIds: selectedNetworks, - accountAddress: accountAddress || "", - verifiedOnly: hideUnlistedTokens - }); - const coinBalancesUnordered = (tokenBalancesData == null ? void 0 : tokenBalancesData.filter((b2) => b2.contractType === "ERC20" || compareAddress(b2.contractAddress, AddressZero))) || []; - const { data: coinPrices = [], isPending: isPendingCoinPrices } = useCoinPrices(coinBalancesUnordered.map((token) => ({ - chainId: token.chainId, - contractAddress: token.contractAddress - }))); - const { data: conversionRate = 1, isPending: isPendingConversionRate } = useExchangeRate(fiatCurrency.symbol); - const coinBalances = coinBalancesUnordered.sort((a2, b2) => { - var _a2, _b2; - const isHigherFiat = Number(computeBalanceFiat({ - balance: b2, - prices: coinPrices, - conversionRate, - decimals: ((_a2 = b2.contractInfo) == null ? void 0 : _a2.decimals) || 18 - })) - Number(computeBalanceFiat({ - balance: a2, - prices: coinPrices, - conversionRate, - decimals: ((_b2 = a2.contractInfo) == null ? void 0 : _b2.decimals) || 18 - })); - return isHigherFiat; - }); - const collectionBalancesUnordered = (tokenBalancesData == null ? void 0 : tokenBalancesData.filter((b2) => b2.contractType === "ERC721" || b2.contractType === "ERC1155")) || []; - const collectionBalances = collectionBalancesUnordered.sort((a2, b2) => { - return Number(b2.balance) - Number(a2.balance); - }); - const coinBalancesAmount = coinBalances.length; - const collectionBalancesAmount = collectionBalances.length; - const isPending = isPendingTokenBalances || isPendingCoinPrices || isPendingConversionRate; - const indexedCollectionBalances = collectionBalances.map((balance, index2) => { - var _a2; - return { - index: index2, - name: ((_a2 = balance.contractInfo) == null ? void 0 : _a2.name) || "Unknown" - }; - }); - const indexedCoinBalances = coinBalances.map((balance, index2) => { - var _a2; - if (compareAddress(balance.contractAddress, AddressZero)) { - const nativeTokenInfo = getNativeTokenInfoByChainId(balance.chainId, chains2); - return { - index: index2, - name: nativeTokenInfo.name - }; - } else { - return { - index: index2, - name: ((_a2 = balance.contractInfo) == null ? void 0 : _a2.name) || "Unknown" - }; - } - }); - const fuzzySearchCoinBalances = new Fuse(indexedCoinBalances, { - keys: ["name"] - }); - const fuzzySearchCollections = new Fuse(indexedCollectionBalances, { - keys: ["name"] - }); - const foundCoinBalances = search2 === "" ? indexedCoinBalances : fuzzySearchCoinBalances.search(search2).map((result) => result.item); - const foundCollectionBalances = search2 === "" ? indexedCollectionBalances : fuzzySearchCollections.search(search2).map((result) => result.item); - const TabsHeaderSkeleton = () => { - return jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "360px", height: "48px" } }); - }; - const ItemsSkeletons = () => { - return jsxRuntimeExports$1.jsx(jsxRuntimeExports$1.Fragment, { children: Array(8).fill(null).map((_, i2) => jsxRuntimeExports$1.jsx(Skeleton, { width: "full", height: "8" }, i2)) }); +const defaultCognitoIdentityProviderHttpAuthSchemeParametersProvider = async (config2, context2, input2) => { + return { + operation: getSmithyContext(context2).operation, + region: await normalizeProvider$1(config2.region)() || (() => { + throw new Error("expected `region` to be configured for `aws.auth#sigv4`"); + })() }; - return jsxRuntimeExports$1.jsxs(Box, { paddingX: "4", paddingBottom: "5", paddingTop: "3", flexDirection: "column", gap: "5", alignItems: "center", justifyContent: "center", children: [jsxRuntimeExports$1.jsx(Box, { width: "full", children: jsxRuntimeExports$1.jsx(TextInput, { autoFocus: true, name: "search wallet", leftIcon: SvgSearchIcon, value: search2, onChange: (ev) => setSearch(ev.target.value), placeholder: "Search your wallet", "data-1p-ignore": true }) }), jsxRuntimeExports$1.jsx(Box, { width: "full", children: jsxRuntimeExports$1.jsxs(TabsRoot, { value: selectedTab, onValueChange: (value) => setSelectedTab(value), children: [jsxRuntimeExports$1.jsxs(Box, { marginBottom: "5", children: [!isPending && jsxRuntimeExports$1.jsx(TabsHeader, { value: selectedTab, tabs: [ - { label: `Collections (${collectionBalancesAmount})`, value: "collections" }, - { label: `Coins (${coinBalancesAmount})`, value: "coins" } - ] }), isPending && jsxRuntimeExports$1.jsx(TabsHeaderSkeleton, {})] }), jsxRuntimeExports$1.jsx(TabsContent, { value: "collections", children: jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "3", children: [isPending && jsxRuntimeExports$1.jsx(ItemsSkeletons, {}), !isPending && foundCollectionBalances.length === 0 && jsxRuntimeExports$1.jsx(Text, { color: "text100", children: "No Collectibles Found" }), !isPending && foundCollectionBalances.length > 0 && foundCollectionBalances.map((indexItem, index2) => { - const collectionBalance = collectionBalances[indexItem.index]; - return jsxRuntimeExports$1.jsx(BalanceItem, { balance: collectionBalance }, index2); - })] }) }), jsxRuntimeExports$1.jsx(TabsContent, { value: "coins", children: jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "3", children: [isPending && jsxRuntimeExports$1.jsx(ItemsSkeletons, {}), !isPending && coinBalances.length == 0 && jsxRuntimeExports$1.jsx(Text, { color: "text100", children: "No Coins Found" }), !isPending && foundCoinBalances.length > 0 && foundCoinBalances.map((indexedItem, index2) => { - const coinBalance = coinBalances[indexedItem.index]; - return jsxRuntimeExports$1.jsx(BalanceItem, { balance: coinBalance }, index2); - })] }) })] }) })] }); }; -const SettingsMenu = () => { - const { setNavigation } = useNavigation(); - const onClickGeneral = () => { - setNavigation({ - location: "settings-general" - }); - }; - const onClickCurrency = () => { - setNavigation({ - location: "settings-currency" - }); +function createAwsAuthSigv4HttpAuthOption(authParameters) { + return { + schemeId: "aws.auth#sigv4", + signingProperties: { + name: "cognito-idp", + region: authParameters.region + }, + propertiesExtractor: (config2, context2) => ({ + signingProperties: { + config: config2, + context: context2 + } + }) }; - const onClickNetworks = () => { - setNavigation({ - location: "settings-networks" - }); +} +function createSmithyApiNoAuthHttpAuthOption(authParameters) { + return { + schemeId: "smithy.api#noAuth" }; - return jsxRuntimeExports$1.jsx(Box, { style: { paddingTop: HEADER_HEIGHT }, children: jsxRuntimeExports$1.jsx(Box, { padding: "5", paddingTop: "3", children: jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "2", children: [jsxRuntimeExports$1.jsx(Button, { onClick: onClickGeneral, leftIcon: SvgSettingsIcon, rightIcon: SvgChevronRightIcon, width: "full", label: "General", style: { - height: "52px", - borderRadius: vars.radii.md - } }), jsxRuntimeExports$1.jsx(Button, { onClick: onClickCurrency, leftIcon: SvgCurrencyIcon, rightIcon: SvgChevronRightIcon, width: "full", label: "Currency", style: { - height: "52px", - borderRadius: vars.radii.md - } }), jsxRuntimeExports$1.jsx(Button, { onClick: onClickNetworks, leftIcon: SvgNetworkIcon, rightIcon: SvgChevronRightIcon, width: "full", label: "Networks", style: { - height: "52px", - borderRadius: vars.radii.md - } })] }) }) }); +} +const defaultCognitoIdentityProviderHttpAuthSchemeProvider = (authParameters) => { + const options = []; + switch (authParameters.operation) { + case "AssociateSoftwareToken": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "ChangePassword": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "ConfirmDevice": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "ConfirmForgotPassword": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "ConfirmSignUp": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "DeleteUser": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "DeleteUserAttributes": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "ForgetDevice": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "ForgotPassword": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "GetDevice": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "GetUser": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "GetUserAttributeVerificationCode": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "GlobalSignOut": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "InitiateAuth": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "ListDevices": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "ResendConfirmationCode": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "RespondToAuthChallenge": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "RevokeToken": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "SetUserMFAPreference": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "SetUserSettings": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "SignUp": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "UpdateAuthEventFeedback": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "UpdateDeviceStatus": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "UpdateUserAttributes": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "VerifySoftwareToken": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + case "VerifyUserAttribute": { + options.push(createSmithyApiNoAuthHttpAuthOption()); + break; + } + default: { + options.push(createAwsAuthSigv4HttpAuthOption(authParameters)); + } + } + return options; }; -const SettingsGeneral = () => { - const { hideUnlistedTokens, setHideUnlistedTokens, hideCollectibles, setHideCollectibles } = useSettings(); - const onChangeHideUnlistedTokens = () => { - setHideUnlistedTokens(!hideUnlistedTokens); - }; - const onChangeHideCollectibles = () => { - setHideCollectibles(!hideCollectibles); +const resolveHttpAuthSchemeConfig = (config2) => { + const config_0 = resolveAwsSdkSigV4Config(config2); + return { + ...config_0 }; - return jsxRuntimeExports$1.jsx(Box, { style: { paddingTop: HEADER_HEIGHT }, children: jsxRuntimeExports$1.jsxs(Box, { gap: "2", padding: "5", paddingTop: "3", flexDirection: "column", children: [jsxRuntimeExports$1.jsxs(Card, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Text, { color: "text100", fontWeight: "bold", children: "Hide unlisted tokens" }), jsxRuntimeExports$1.jsx(Switch, { checked: hideUnlistedTokens, onCheckedChange: onChangeHideUnlistedTokens })] }), jsxRuntimeExports$1.jsxs(Card, { flexDirection: "row", justifyContent: "space-between", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Text, { color: "text100", fontWeight: "bold", children: "Hide collectibles" }), jsxRuntimeExports$1.jsx(Switch, { checked: hideCollectibles, onCheckedChange: onChangeHideCollectibles })] })] }) }); }; -function r$1(e2) { - var t2, f2, n2 = ""; - if ("string" == typeof e2 || "number" == typeof e2) - n2 += e2; - else if ("object" == typeof e2) - if (Array.isArray(e2)) { - var o2 = e2.length; - for (t2 = 0; t2 < o2; t2++) - e2[t2] && (f2 = r$1(e2[t2])) && (n2 && (n2 += " "), n2 += f2); - } else - for (f2 in e2) - e2[f2] && (n2 && (n2 += " "), n2 += f2); - return n2; -} -function clsx() { - for (var e2, t2, f2 = 0, n2 = "", o2 = arguments.length; f2 < o2; f2++) - (e2 = arguments[f2]) && (t2 = r$1(e2)) && (n2 && (n2 += " "), n2 += t2); - return n2; -} -const SelectedIndicator = (props) => { - const { selected, className, squareIndicator = false } = props; - return jsxRuntimeExports$1.jsx(Box, { borderStyle: "solid", borderColor: squareIndicator && selected ? "transparent" : "borderNormal", borderWidth: "thin", position: "relative", alignItems: "center", justifyContent: "center", flexShrink: "0", className, style: { - borderRadius: squareIndicator ? "4px" : vars.radii.circle, - width: "20px", - height: "20px" - }, children: jsxRuntimeExports$1.jsx(Box, { as: motion.div, background: squareIndicator ? "borderNormal" : "backgroundInverse", position: "absolute", color: "textInverse100", initial: { opacity: selected ? 1 : 0, scale: selected ? 1 : 0.5 }, animate: { opacity: selected ? 1 : 0, scale: selected ? 1 : 0.5 }, transition: { ease: "backOut" }, style: { - borderRadius: squareIndicator ? "4px" : vars.radii.circle, - width: squareIndicator ? "20px" : "14px", - height: squareIndicator ? "20px" : "14px" - }, justifyContent: "center", alignItems: "center", children: squareIndicator && jsxRuntimeExports$1.jsx(SvgCheckmarkIcon, { color: "white", style: { width: "14px", height: "14px" } }) }) }); +const resolveClientEndpointParameters = (options) => { + return { + ...options, + useDualstackEndpoint: options.useDualstackEndpoint ?? false, + useFipsEndpoint: options.useFipsEndpoint ?? false, + defaultSigningName: "cognito-idp" + }; }; -const SelectButton = (props) => { - const { value, selected, children, disabled, onClick, className, hideIndicator, squareIndicator = false, ...rest } = props; - return jsxRuntimeExports$1.jsxs(Card, { as: "button", clickable: true, className: clsx(className), disabled, onClick: () => onClick(value), userSelect: "none", alignItems: "center", justifyContent: "space-between", textAlign: "left", width: "full", border: "none", style: { - appearance: "none" - }, ...rest, children: [children, !hideIndicator && jsxRuntimeExports$1.jsx(SelectedIndicator, { selected, squareIndicator })] }); +const commonParams = { + UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" }, + Endpoint: { type: "builtInParams", name: "endpoint" }, + Region: { type: "builtInParams", name: "region" }, + UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" } }; -const SettingsCurrency = () => { - const { fiatCurrency, setFiatCurrency } = useSettings(); - return jsxRuntimeExports$1.jsx(Box, { paddingBottom: "5", paddingX: "4", paddingTop: "3", children: jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", gap: "2", children: supportedFiatCurrencies.map((currency) => { - return jsxRuntimeExports$1.jsx(SelectButton, { value: currency.symbol, selected: currency.symbol === fiatCurrency.symbol, onClick: () => setFiatCurrency && setFiatCurrency(currency), children: jsxRuntimeExports$1.jsxs(Box, { gap: "2", justifyContent: "flex-start", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Text, { color: "text100", fontWeight: "bold", children: currency.symbol }), jsxRuntimeExports$1.jsx(Text, { color: "text50", children: currency.name.message })] }) }, currency.symbol); - }) }) }); +const name = "@aws-sdk/client-cognito-identity-provider"; +const description = "AWS SDK for JavaScript Cognito Identity Provider Client for Node.js, Browser and React Native"; +const version = "3.582.0"; +const scripts = { + build: "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", + "build:cjs": "node ../../scripts/compilation/inline client-cognito-identity-provider", + "build:es": "tsc -p tsconfig.es.json", + "build:include:deps": "lerna run --scope $npm_package_name --include-dependencies build", + "build:types": "tsc -p tsconfig.types.json", + "build:types:downlevel": "downlevel-dts dist-types dist-types/ts3.4", + clean: "rimraf ./dist-* && rimraf *.tsbuildinfo", + "extract:docs": "api-extractor run --local", + "generate:client": "node ../../scripts/generate-clients/single-service --solo cognito-identity-provider" }; -const SettingsNetwork = () => { - const { selectedNetworks, setSelectedNetworks } = useSettings(); - const { chains: chains2 } = useConfig(); - const onClickNetwork = (chainId) => { - if (selectedNetworks.includes(chainId)) { - if (selectedNetworks.length === 1) { - return; - } - setSelectedNetworks(selectedNetworks.filter((id2) => id2 !== chainId)); - } else { - setSelectedNetworks([...selectedNetworks, chainId]); - } - }; - return jsxRuntimeExports$1.jsx(Box, { style: { paddingTop: HEADER_HEIGHT }, children: jsxRuntimeExports$1.jsxs(Box, { padding: "5", paddingTop: "3", children: [jsxRuntimeExports$1.jsx(Text, { variant: "small", fontWeight: "bold", color: "text50", children: "Networks" }), jsxRuntimeExports$1.jsx(Box, { flexDirection: "column", gap: "2", marginTop: "4", children: chains2.map((chain) => { - return jsxRuntimeExports$1.jsx(SelectButton, { disabled: selectedNetworks.length === 1 && selectedNetworks.includes(chain.id), selected: selectedNetworks.includes(chain.id), onClick: () => onClickNetwork(chain.id), value: chain.id, squareIndicator: true, children: jsxRuntimeExports$1.jsxs(Box, { gap: "2", justifyContent: "center", alignItems: "center", children: [jsxRuntimeExports$1.jsx(TokenImage, { src: `https://assets.sequence.info/images/networks/medium/${chain.id}.webp` }), jsxRuntimeExports$1.jsx(Text, { color: "text100", variant: "normal", fontWeight: "bold", children: chain.name })] }) }, chain.id); - }) })] }) }); +const main = "./dist-cjs/index.js"; +const types = "./dist-types/index.d.ts"; +const module = "./dist-es/index.js"; +const sideEffects = false; +const dependencies = { + "@aws-crypto/sha256-browser": "3.0.0", + "@aws-crypto/sha256-js": "3.0.0", + "@aws-sdk/client-sso-oidc": "3.582.0", + "@aws-sdk/client-sts": "3.582.0", + "@aws-sdk/core": "3.582.0", + "@aws-sdk/credential-provider-node": "3.582.0", + "@aws-sdk/middleware-host-header": "3.577.0", + "@aws-sdk/middleware-logger": "3.577.0", + "@aws-sdk/middleware-recursion-detection": "3.577.0", + "@aws-sdk/middleware-user-agent": "3.577.0", + "@aws-sdk/region-config-resolver": "3.577.0", + "@aws-sdk/types": "3.577.0", + "@aws-sdk/util-endpoints": "3.577.0", + "@aws-sdk/util-user-agent-browser": "3.577.0", + "@aws-sdk/util-user-agent-node": "3.577.0", + "@smithy/config-resolver": "^3.0.0", + "@smithy/core": "^2.0.1", + "@smithy/fetch-http-handler": "^3.0.1", + "@smithy/hash-node": "^3.0.0", + "@smithy/invalid-dependency": "^3.0.0", + "@smithy/middleware-content-length": "^3.0.0", + "@smithy/middleware-endpoint": "^3.0.0", + "@smithy/middleware-retry": "^3.0.1", + "@smithy/middleware-serde": "^3.0.0", + "@smithy/middleware-stack": "^3.0.0", + "@smithy/node-config-provider": "^3.0.0", + "@smithy/node-http-handler": "^3.0.0", + "@smithy/protocol-http": "^4.0.0", + "@smithy/smithy-client": "^3.0.1", + "@smithy/types": "^3.0.0", + "@smithy/url-parser": "^3.0.0", + "@smithy/util-base64": "^3.0.0", + "@smithy/util-body-length-browser": "^3.0.0", + "@smithy/util-body-length-node": "^3.0.0", + "@smithy/util-defaults-mode-browser": "^3.0.1", + "@smithy/util-defaults-mode-node": "^3.0.1", + "@smithy/util-endpoints": "^2.0.0", + "@smithy/util-middleware": "^3.0.0", + "@smithy/util-retry": "^3.0.0", + "@smithy/util-utf8": "^3.0.0", + tslib: "^2.6.2" }; -const useIntersectionObserver = (ref, options) => { - const [entry, setEntry] = reactExports.useState(null); - const observer = reactExports.useMemo(() => new IntersectionObserver(([entry2]) => setEntry(entry2), options), []); - reactExports.useEffect(() => { - if (ref.current) { - observer.observe(ref.current); - } - return () => { - if (ref.current) { - observer.disconnect(); - } - }; - }, [ref.current, observer]); - return (entry == null ? void 0 : entry.isIntersecting) ?? false; +const devDependencies = { + "@tsconfig/node16": "16.1.3", + "@types/node": "^16.18.96", + concurrently: "7.0.0", + "downlevel-dts": "0.10.1", + rimraf: "3.0.2", + typescript: "~4.9.5" }; -const InfiniteScroll = (props) => { - const { onLoad, hasMore = true, children } = props; - const [pageNumber, setPageNumber] = reactExports.useState(0); - const [isLoading, setLoading] = reactExports.useState(false); - const bottomRef = reactExports.useRef(null); - const isBottom = useIntersectionObserver(bottomRef); - reactExports.useEffect(() => { - if (isBottom && hasMore && !isLoading) { - handleLoad(); - } - }, [isBottom]); - const handleLoad = async () => { - setLoading(true); - await onLoad(pageNumber); - setPageNumber((pageNumber2) => pageNumber2 + 1); - setLoading(false); - }; - return jsxRuntimeExports$1.jsxs(jsxRuntimeExports$1.Fragment, { children: [children, jsxRuntimeExports$1.jsx("div", { ref: bottomRef })] }); +const engines = { + node: ">=16.0.0" }; -const NetworkBadge = ({ chainId }) => { - const network2 = getNetwork(chainId); - const chainColor = getNetworkColor(chainId); - const chainBGColor = getNetworkBackgroundColor(chainId); - return jsxRuntimeExports$1.jsxs(Box, { height: "6", paddingY: "1", paddingLeft: "1.5", paddingRight: "2", gap: "1", style: { - background: chainBGColor - }, borderRadius: "xs", flexDirection: "row", justifyContent: "center", alignItems: "center", width: "fit", children: [jsxRuntimeExports$1.jsx(NetworkImage, { chainId, size: "xs" }), jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", fontSize: "xsmall", style: { - color: chainColor - }, children: capitalize(network2.title ?? network2.name) })] }); +const typesVersions = { + "<4.0": { + "dist-types/*": [ + "dist-types/ts3.4/*" + ] + } }; -const CoinDetailsSkeleton = ({ chainId }) => { - return jsxRuntimeExports$1.jsx(Box, { style: { paddingTop: HEADER_HEIGHT }, children: jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "10", paddingBottom: "5", paddingX: "4", paddingTop: "0", style: { marginTop: "-20px" }, children: [jsxRuntimeExports$1.jsxs(Box, { marginBottom: "10", gap: "2", alignItems: "center", justifyContent: "center", flexDirection: "column", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "32px", height: "32px" } }), jsxRuntimeExports$1.jsx(Skeleton, { style: { height: "24px", width: "70px" } }), jsxRuntimeExports$1.jsx(NetworkBadge, { chainId })] }), jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", color: "text50", fontSize: "normal", children: "Balance" }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", alignItems: "flex-end", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "150px", height: "36px" } }), jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "33px", height: "17px" } })] })] }), jsxRuntimeExports$1.jsx(Button, { color: "text100", marginTop: "4", marginBottom: "10", width: "full", variant: "primary", leftIcon: SvgSendIcon, label: "Send", disabled: true, onClick: () => { - } }), jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(TransactionHistorySkeleton, {}) })] }) }); +const files = [ + "dist-*/**" +]; +const author = { + name: "AWS SDK for JavaScript Team", + url: "https://aws.amazon.com/javascript/" }; -const CoinDetails = ({ contractAddress, chainId }) => { - var _a2, _b2, _c2, _d2; - const { chains: chains2 } = useConfig(); - const { setNavigation } = useNavigation(); - const { fiatCurrency, hideUnlistedTokens } = useSettings(); - const { address: accountAddress } = useAccount(); - const { data: dataTransactionHistory, isPending: isPendingTransactionHistory, fetchNextPage, hasNextPage: hasNextPage2, isFetchingNextPage } = useTransactionHistory({ - chainId, - accountAddress: accountAddress || "", - contractAddress - }); - const transactionHistory = flattenPaginatedTransactionHistory(dataTransactionHistory); - const { data: dataCoinBalance, isPending: isPendingCoinBalance } = useCoinBalance({ - accountAddress: accountAddress || "", - contractAddress, - chainId, - verifiedOnly: hideUnlistedTokens - }); - const { data: dataCoinPrices, isPending: isPendingCoinPrices } = useCoinPrices([ - { - chainId, - contractAddress - } - ]); - const { data: conversionRate = 1, isPending: isPendingConversionRate } = useExchangeRate(fiatCurrency.symbol); - const isPending = isPendingCoinBalance || isPendingCoinPrices || isPendingConversionRate; - if (isPending) { - return jsxRuntimeExports$1.jsx(CoinDetailsSkeleton, { chainId }); - } - const isNativeToken = compareAddress(contractAddress, AddressZero); - const logo = isNativeToken ? getNativeTokenInfoByChainId(chainId, chains2).logoURI : (_a2 = dataCoinBalance == null ? void 0 : dataCoinBalance.contractInfo) == null ? void 0 : _a2.logoURI; - const symbol = isNativeToken ? getNativeTokenInfoByChainId(chainId, chains2).symbol : (_b2 = dataCoinBalance == null ? void 0 : dataCoinBalance.contractInfo) == null ? void 0 : _b2.symbol; - const name2 = isNativeToken ? getNativeTokenInfoByChainId(chainId, chains2).name : (_c2 = dataCoinBalance == null ? void 0 : dataCoinBalance.contractInfo) == null ? void 0 : _c2.name; - const decimals = isNativeToken ? getNativeTokenInfoByChainId(chainId, chains2).decimals : (_d2 = dataCoinBalance == null ? void 0 : dataCoinBalance.contractInfo) == null ? void 0 : _d2.decimals; - const formattedBalance = formatUnits$1((dataCoinBalance == null ? void 0 : dataCoinBalance.balance) || "0", decimals); - const balanceDisplayed = formatDisplay(formattedBalance); - const coinBalanceFiat = dataCoinBalance ? computeBalanceFiat({ - balance: dataCoinBalance, - prices: dataCoinPrices || [], - conversionRate, - decimals: decimals || 0 - }) : "0"; - const onClickSend = () => { - setNavigation({ - location: "send-coin", - params: { - chainId, - contractAddress - } - }); - }; - return jsxRuntimeExports$1.jsx(Box, { style: { paddingTop: HEADER_HEIGHT }, children: jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "10", paddingBottom: "5", paddingX: "4", paddingTop: "0", style: { marginTop: "-20px" }, children: [jsxRuntimeExports$1.jsxs(Box, { marginBottom: "10", gap: "2", alignItems: "center", justifyContent: "center", flexDirection: "column", children: [jsxRuntimeExports$1.jsx(Image$1, { width: "8", src: logo, alt: "logo" }), jsxRuntimeExports$1.jsx(Text, { color: "text100", fontWeight: "bold", fontSize: "large", children: name2 }), jsxRuntimeExports$1.jsx(NetworkBadge, { chainId })] }), jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", color: "text50", fontSize: "normal", children: "Balance" }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", alignItems: "flex-end", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", color: "text100", fontSize: "xlarge", children: `${balanceDisplayed} ${symbol}` }), jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", color: "text50", fontSize: "normal", children: `${fiatCurrency.sign}${coinBalanceFiat}` })] })] }), jsxRuntimeExports$1.jsx(Button, { width: "full", variant: "primary", leftIcon: SvgSendIcon, color: "text100", label: "Send", onClick: onClickSend }), jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(InfiniteScroll, { onLoad: () => fetchNextPage(), hasMore: hasNextPage2, children: jsxRuntimeExports$1.jsx(TransactionHistoryList, { transactions: transactionHistory, isPending: isPendingTransactionHistory, isFetchingNextPage }) }) })] }) }); +const license = "Apache-2.0"; +const browser = { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.browser" }; -const CollectionDetailsSkeleton = ({ chainId }) => { - return jsxRuntimeExports$1.jsxs(Box, { paddingX: "4", paddingBottom: "5", paddingTop: "3", marginTop: "8", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "10", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "2", justifyContent: "center", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "32px", height: "32px" } }), jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "100px", height: "24px" } }), jsxRuntimeExports$1.jsx(NetworkBadge, { chainId }), jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "142px", height: "17px" } })] }), jsxRuntimeExports$1.jsxs(Box, { width: "full", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "168px", height: "20px" } }), jsxRuntimeExports$1.jsx(Box, { style: { - display: "grid", - gridTemplateColumns: `calc(50% - ${vars.space[1]}) calc(50% - ${vars.space[1]})`, - gap: vars.space[2] - }, width: "full", marginTop: "3", children: Array(8).fill(null).map((_, i2) => jsxRuntimeExports$1.jsx(Skeleton, { width: "full", aspectRatio: "1/1" }, i2)) })] })] }); +const homepage = "https://github.com/aws/aws-sdk-js-v3/tree/main/clients/client-cognito-identity-provider"; +const repository = { + type: "git", + url: "https://github.com/aws/aws-sdk-js-v3.git", + directory: "clients/client-cognito-identity-provider" }; -const CollectionDetails = ({ chainId, contractAddress }) => { - var _a2; - const { setNavigation } = useNavigation(); - const { address: accountAddress } = useAccount(); - const { data: collectionBalanceData, isPending: isPendingCollectionBalance } = useCollectionBalance({ - chainId, - accountAddress: accountAddress || "", - contractAddress - }); - const contractInfo = (_a2 = collectionBalanceData == null ? void 0 : collectionBalanceData[0]) == null ? void 0 : _a2.contractInfo; - const collectionLogoURI = contractInfo == null ? void 0 : contractInfo.logoURI; - if (isPendingCollectionBalance) { - return jsxRuntimeExports$1.jsx(CollectionDetailsSkeleton, { chainId }); - } - const onClickItem = (balance) => { - setNavigation && setNavigation({ - location: "collectible-details", - params: { - contractAddress: balance.contractAddress, - chainId: balance.chainId, - tokenId: balance.tokenID || "" - } - }); - }; - return jsxRuntimeExports$1.jsxs(Box, { paddingX: "4", paddingBottom: "5", paddingTop: "3", marginTop: "8", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "10", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "2", justifyContent: "center", alignItems: "center", children: [jsxRuntimeExports$1.jsx(TokenImage, { src: collectionLogoURI, size: "lg" }), jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", fontSize: "large", color: "text100", children: (contractInfo == null ? void 0 : contractInfo.name) || "Unknown" }), jsxRuntimeExports$1.jsx(NetworkBadge, { chainId }), jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", fontSize: "normal", color: "text50", children: `${(collectionBalanceData == null ? void 0 : collectionBalanceData.length) || 0} Unique Collectibles` })] }), jsxRuntimeExports$1.jsxs(Box, { width: "full", children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", fontSize: "normal", color: "text50", children: `Owned (${(collectionBalanceData == null ? void 0 : collectionBalanceData.length) || 0})` }), jsxRuntimeExports$1.jsx(Box, { style: { - display: "grid", - gridTemplateColumns: `calc(50% - ${vars.space[1]}) calc(50% - ${vars.space[1]})`, - gap: vars.space[2] - }, width: "full", marginTop: "3", children: collectionBalanceData == null ? void 0 : collectionBalanceData.map((balance, index2) => { - var _a3, _b2, _c2; - const unformattedBalance = balance.balance; - const decimals = ((_a3 = balance == null ? void 0 : balance.tokenMetadata) == null ? void 0 : _a3.decimals) || 0; - const formattedBalance = formatDisplay(formatUnits$1(unformattedBalance, decimals)); - return jsxRuntimeExports$1.jsxs(Box, { onClick: () => onClickItem(balance), userSelect: "none", cursor: "pointer", opacity: { hover: "80" }, children: [jsxRuntimeExports$1.jsx(Box, { background: "backgroundSecondary", aspectRatio: "1/1", width: "full", borderRadius: "md", justifyContent: "center", alignItems: "center", marginBottom: "2", children: jsxRuntimeExports$1.jsx(Image$1, { style: { height: "100%" }, src: (_b2 = balance.tokenMetadata) == null ? void 0 : _b2.image }) }), jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", fontSize: "normal", color: "text100", children: `${(_c2 = balance.tokenMetadata) == null ? void 0 : _c2.name}` }) }), jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsxs(Text, { marginTop: "1", fontWeight: "medium", fontSize: "normal", color: "text50", children: [formattedBalance, " Owned"] }) })] }, index2); - }) })] })] }); +const packageInfo = { + name, + description, + version, + scripts, + main, + types, + module, + sideEffects, + dependencies, + devDependencies, + engines, + typesVersions, + files, + author, + license, + browser, + "react-native": { + "./dist-es/runtimeConfig": "./dist-es/runtimeConfig.native" + }, + homepage, + repository }; -const CollectibleDetailsSkeleton = () => { - return jsxRuntimeExports$1.jsx(Box, { style: { paddingTop: HEADER_HEIGHT }, children: jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "10", paddingBottom: "5", paddingX: "4", paddingTop: "0", style: { - marginTop: "-20px" - }, children: [jsxRuntimeExports$1.jsxs(Box, { gap: "3", alignItems: "center", justifyContent: "center", flexDirection: "column", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "120px", height: "30px" } }), jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "140px", height: "40px" } })] }), jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "347px", height: "347px" } }) }), jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", color: "text50", fontSize: "normal", children: "Balance" }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", alignItems: "flex-end", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "44px", height: "36px" } }), jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "34px", height: "17px" } })] })] }), jsxRuntimeExports$1.jsx(Button, { color: "text100", marginTop: "4", width: "full", variant: "primary", leftIcon: SvgSendIcon, label: "Send", onClick: () => { - } })] }), jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsx(Text, { fontSize: "normal", color: "text50", fontWeight: "medium", children: "This week" }), jsxRuntimeExports$1.jsx(TransactionHistorySkeleton, {})] })] }) }); +var build$4 = {}; +/*! ***************************************************************************** +Copyright (c) Microsoft Corporation. + +Permission to use, copy, modify, and/or distribute this software for any +purpose with or without fee is hereby granted. + +THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +PERFORMANCE OF THIS SOFTWARE. +***************************************************************************** */ +var extendStatics = function(d2, b2) { + extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b3) { + d3.__proto__ = b3; + } || function(d3, b3) { + for (var p2 in b3) + if (b3.hasOwnProperty(p2)) + d3[p2] = b3[p2]; + }; + return extendStatics(d2, b2); }; -const CollectibleDetails = ({ contractAddress, chainId, tokenId }) => { - var _a2, _b2, _c2, _d2, _e2, _f2; - const { address: accountAddress } = useAccount(); - const { fiatCurrency } = useSettings(); - const { setNavigation } = useNavigation(); - const { data: dataTransactionHistory, isPending: isPendingTransactionHistory, fetchNextPage, hasNextPage: hasNextPage2, isFetchingNextPage } = useTransactionHistory({ - chainId, - accountAddress: accountAddress || "", - contractAddress, - tokenId - }); - const transactionHistory = flattenPaginatedTransactionHistory(dataTransactionHistory); - const { data: dataCollectibleBalance, isPending: isPendingCollectibleBalance } = useCollectibleBalance({ - accountAddress: accountAddress || "", - contractAddress, - chainId, - tokenId, - verifiedOnly: false - }); - const { data: dataCollectiblePrices, isPending: isPendingCollectiblePrices } = useCollectiblePrices([ - { - chainId, - contractAddress, - tokenId - } - ]); - const { data: conversionRate = 1, isPending: isPendingConversionRate } = useExchangeRate(fiatCurrency.symbol); - const isPending = isPendingCollectibleBalance || isPendingCollectiblePrices || isPendingConversionRate; - if (isPending) { - return jsxRuntimeExports$1.jsx(CollectibleDetailsSkeleton, {}); +function __extends(d2, b2) { + extendStatics(d2, b2); + function __() { + this.constructor = d2; } - const onClickSend = () => { - setNavigation({ - location: "send-collectible", - params: { - chainId, - contractAddress, - tokenId - } - }); + d2.prototype = b2 === null ? Object.create(b2) : (__.prototype = b2.prototype, new __()); +} +var __assign = function() { + __assign = Object.assign || function __assign2(t2) { + for (var s2, i = 1, n2 = arguments.length; i < n2; i++) { + s2 = arguments[i]; + for (var p2 in s2) + if (Object.prototype.hasOwnProperty.call(s2, p2)) + t2[p2] = s2[p2]; + } + return t2; }; - const collectionLogo = (_a2 = dataCollectibleBalance == null ? void 0 : dataCollectibleBalance.contractInfo) == null ? void 0 : _a2.logoURI; - const collectionName = ((_b2 = dataCollectibleBalance == null ? void 0 : dataCollectibleBalance.contractInfo) == null ? void 0 : _b2.name) || "Unknown Collection"; - const decimals = ((_c2 = dataCollectibleBalance == null ? void 0 : dataCollectibleBalance.tokenMetadata) == null ? void 0 : _c2.decimals) || 0; - const rawBalance = (dataCollectibleBalance == null ? void 0 : dataCollectibleBalance.balance) || "0"; - const balance = formatUnits$1(rawBalance, decimals); - const formattedBalance = formatDisplay(Number(balance)); - const valueFiat = dataCollectibleBalance ? computeBalanceFiat({ - balance: dataCollectibleBalance, - prices: dataCollectiblePrices || [], - conversionRate, - decimals - }) : "0"; - return jsxRuntimeExports$1.jsx(Box, { style: { paddingTop: HEADER_HEIGHT }, children: jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", gap: "10", paddingBottom: "5", paddingX: "4", paddingTop: "0", style: { - marginTop: "-20px" - }, children: [jsxRuntimeExports$1.jsxs(Box, { gap: "3", alignItems: "center", justifyContent: "center", flexDirection: "column", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", gap: "2", justifyContent: "center", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Image$1, { borderRadius: "circle", width: "8", src: collectionLogo, alt: "collection logo", style: { - objectFit: "cover" - } }), jsxRuntimeExports$1.jsxs(Box, { gap: "1", flexDirection: "row", justifyContent: "center", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", fontSize: "small", color: "text100", children: collectionName }), jsxRuntimeExports$1.jsx(NetworkImage, { chainId, size: "xs" })] })] }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", justifyContent: "center", alignItems: "center", children: [jsxRuntimeExports$1.jsx(Text, { color: "text100", fontWeight: "bold", fontSize: "large", children: ((_d2 = dataCollectibleBalance == null ? void 0 : dataCollectibleBalance.tokenMetadata) == null ? void 0 : _d2.name) || "Unknown Collectible" }), jsxRuntimeExports$1.jsx(Text, { color: "text50", fontSize: "small", fontWeight: "medium", children: `#${tokenId}` })] })] }), jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(CollectibleTileImage, { imageUrl: (_e2 = dataCollectibleBalance == null ? void 0 : dataCollectibleBalance.tokenMetadata) == null ? void 0 : _e2.image }) }), jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", color: "text50", fontSize: "normal", children: "Balance" }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", alignItems: "flex-end", justifyContent: "space-between", children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", color: "text100", fontSize: "xlarge", children: formattedBalance }), dataCollectiblePrices && ((_f2 = dataCollectiblePrices[0].price) == null ? void 0 : _f2.value) && jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", color: "text50", fontSize: "normal", children: `${fiatCurrency.symbol} ${valueFiat}` })] })] }), jsxRuntimeExports$1.jsx(Button, { color: "text100", marginTop: "4", width: "full", variant: "primary", leftIcon: SvgSendIcon, label: "Send", onClick: onClickSend })] }), jsxRuntimeExports$1.jsx(Box, { children: jsxRuntimeExports$1.jsx(InfiniteScroll, { onLoad: () => fetchNextPage(), hasMore: hasNextPage2, children: jsxRuntimeExports$1.jsx(TransactionHistoryList, { transactions: transactionHistory, isPending: isPendingTransactionHistory, isFetchingNextPage }) }) })] }) }); + return __assign.apply(this, arguments); }; -const CopyButton = (props) => { - const { buttonVariant = "icon", text: text2, size: size2 = "xs", ...rest } = props; - const [isCopied, setCopy] = reactExports.useState(false); - reactExports.useEffect(() => { - if (isCopied) { - setTimeout(() => { - setCopy(false); - }, 4e3); +function __rest(s2, e2) { + var t2 = {}; + for (var p2 in s2) + if (Object.prototype.hasOwnProperty.call(s2, p2) && e2.indexOf(p2) < 0) + t2[p2] = s2[p2]; + if (s2 != null && typeof Object.getOwnPropertySymbols === "function") + for (var i = 0, p2 = Object.getOwnPropertySymbols(s2); i < p2.length; i++) { + if (e2.indexOf(p2[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s2, p2[i])) + t2[p2[i]] = s2[p2[i]]; } - }, [isCopied]); - const handleCopy = () => { - setCopy(true); + return t2; +} +function __decorate(decorators, target, key2, desc) { + var c2 = arguments.length, r2 = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d2; + if (typeof Reflect === "object" && typeof Reflect.decorate === "function") + r2 = Reflect.decorate(decorators, target, key2, desc); + else + for (var i = decorators.length - 1; i >= 0; i--) + if (d2 = decorators[i]) + r2 = (c2 < 3 ? d2(r2) : c2 > 3 ? d2(target, key2, r2) : d2(target, key2)) || r2; + return c2 > 3 && r2 && Object.defineProperty(target, key2, r2), r2; +} +function __param(paramIndex, decorator) { + return function(target, key2) { + decorator(target, key2, paramIndex); }; - const label = isCopied ? "Copied!" : "Copy"; - const backgroundColor = buttonVariant === "icon" ? "rgba(0,0,0,0)" : vars.colors.buttonGlass; - return jsxRuntimeExports$1.jsx(lib.CopyToClipboard, { text: text2, onCopy: handleCopy, children: jsxRuntimeExports$1.jsx(IconButton, { size: size2, icon: isCopied ? SvgCheckmarkIcon : SvgCopyIcon, ...rest, style: { background: backgroundColor, ...props == null ? void 0 : props.style }, label: buttonVariant === "with-label" ? label : void 0 }) }); -}; -const TransactionDetails = ({ transaction: transaction2 }) => { - var _a2, _b2; - const { chains: chains2 } = useConfig(); - const { fiatCurrency } = useSettings(); - const coins = []; - const collectibles = []; - (_a2 = transaction2.transfers) == null ? void 0 : _a2.forEach((transfer) => { - var _a3, _b3, _c2, _d2; - if (((_a3 = transfer.contractInfo) == null ? void 0 : _a3.type) === "ERC721" || ((_b3 = transfer.contractInfo) == null ? void 0 : _b3.type) === "ERC1155") { - (_c2 = transfer.tokenIds) == null ? void 0 : _c2.forEach((tokenId) => { - var _a4; - const foundCollectible = collectibles.find((collectible) => { - var _a5; - return collectible.chainId === transaction2.chainId && compareAddress(collectible.contractAddress, ((_a5 = transfer.contractInfo) == null ? void 0 : _a5.address) || "") && collectible.tokenId === tokenId; - }); - if (!foundCollectible) { - collectibles.push({ - chainId: transaction2.chainId, - contractAddress: ((_a4 = transfer.contractInfo) == null ? void 0 : _a4.address) || "", - tokenId - }); - } - }); - } else { - const contractAddress = ((_d2 = transfer == null ? void 0 : transfer.contractInfo) == null ? void 0 : _d2.address) || AddressZero; - const foundCoin = coins.find((coin) => coin.chainId === transaction2.chainId && compareAddress(coin.contractAddress, contractAddress)); - if (!foundCoin) { - coins.push({ - chainId: transaction2.chainId, - contractAddress - }); +} +function __metadata(metadataKey, metadataValue) { + if (typeof Reflect === "object" && typeof Reflect.metadata === "function") + return Reflect.metadata(metadataKey, metadataValue); +} +function __awaiter(thisArg, _arguments, P2, generator) { + function adopt(value) { + return value instanceof P2 ? value : new P2(function(resolve) { + resolve(value); + }); + } + return new (P2 || (P2 = Promise))(function(resolve, reject) { + function fulfilled(value) { + try { + step(generator.next(value)); + } catch (e2) { + reject(e2); } } - }); - const { data: coinPricesData, isPending: isPendingCoinPrices } = useCoinPrices(coins); - const { data: collectiblePricesData, isPending: isPendingCollectiblePrices } = useCollectiblePrices(collectibles); - const { data: conversionRate = 1, isPending: isPendingConversionRate } = useExchangeRate(fiatCurrency.symbol); - const arePricesLoading = coins.length > 0 && isPendingCoinPrices || collectibles.length > 0 && isPendingCollectiblePrices || isPendingConversionRate; - const nativeTokenInfo = getNativeTokenInfoByChainId(transaction2.chainId, chains2); - const date = dayjs(transaction2.timestamp).format("ddd MMM DD YYYY, h:m:s a"); - const onClickBlockExplorer = () => { - if (typeof window !== "undefined") { - window.open(`${nativeTokenInfo.blockExplorerUrl}/tx/${transaction2.txnHash}`, "_blank"); - } - }; - const Transfer = ({ transfer }) => { - var _a3, _b3, _c2, _d2; - const recipientAddress = transfer.to; - const recipientAddressFormatted = recipientAddress.substring(0, 10) + "..." + recipientAddress.substring(transfer.to.length - 4, transfer.to.length); - const isNativeToken = compareAddress(((_a3 = transfer == null ? void 0 : transfer.contractInfo) == null ? void 0 : _a3.address) || "", AddressZero); - const logoURI = isNativeToken ? nativeTokenInfo.logoURI : (_b3 = transfer == null ? void 0 : transfer.contractInfo) == null ? void 0 : _b3.logoURI; - const symbol = isNativeToken ? nativeTokenInfo.symbol : ((_c2 = transfer == null ? void 0 : transfer.contractInfo) == null ? void 0 : _c2.symbol) || ""; - return jsxRuntimeExports$1.jsx(jsxRuntimeExports$1.Fragment, { children: (_d2 = transfer.amounts) == null ? void 0 : _d2.map((amount, index2) => { - var _a4, _b4, _c3, _d3, _e2, _f2, _g2, _h2; - const isCollectible = transfer.contractType === "ERC721" || transfer.contractType === "ERC1155"; - const tokenId = ((_a4 = transfer.tokenIds) == null ? void 0 : _a4[index2]) || "0"; - const collectibleDecimals = ((_c3 = (_b4 = transfer == null ? void 0 : transfer.tokenMetadata) == null ? void 0 : _b4[tokenId]) == null ? void 0 : _c3.decimals) || 0; - const coinDecimals = isNativeToken ? nativeTokenInfo.decimals : ((_d3 = transfer == null ? void 0 : transfer.contractInfo) == null ? void 0 : _d3.decimals) || 0; - const decimals = isCollectible ? collectibleDecimals : coinDecimals; - const formattedBalance = formatUnits$1(amount, decimals); - const balanceDisplayed = formatDisplay(formattedBalance); - const fiatPrice = isCollectible ? (_f2 = (_e2 = collectiblePricesData == null ? void 0 : collectiblePricesData.find((collectible) => { - var _a5, _b5; - return compareAddress(collectible.token.contractAddress, ((_a5 = transfer.contractInfo) == null ? void 0 : _a5.address) || "") && collectible.token.tokenId === ((_b5 = transfer.tokenIds) == null ? void 0 : _b5[index2]) && collectible.token.chainId === transaction2.chainId; - })) == null ? void 0 : _e2.price) == null ? void 0 : _f2.value : (_h2 = (_g2 = coinPricesData == null ? void 0 : coinPricesData.find((coin) => { - var _a5; - return compareAddress(coin.token.contractAddress, ((_a5 = transfer.contractInfo) == null ? void 0 : _a5.address) || AddressZero) && coin.token.chainId === transaction2.chainId; - })) == null ? void 0 : _g2.price) == null ? void 0 : _h2.value; - const fiatValue = (parseFloat(formattedBalance) * (conversionRate * (fiatPrice || 0))).toFixed(2); - return jsxRuntimeExports$1.jsxs(Box, { width: "full", flexDirection: "row", gap: "2", justifyContent: "space-between", alignItems: "center", children: [jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", justifyContent: "flex-start", alignItems: "center", gap: "2", height: "12", borderRadius: "md", background: "buttonGlass", padding: "2", style: { flexBasis: "100%" }, children: [jsxRuntimeExports$1.jsx(TokenImage, { src: logoURI, symbol, size: "sm" }), jsxRuntimeExports$1.jsxs(Box, { gap: "0.5", flexDirection: "column", alignItems: "flex-start", justifyContent: "center", children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", fontSize: "xsmall", color: "text100", children: `${balanceDisplayed} ${symbol}` }), arePricesLoading ? jsxRuntimeExports$1.jsx(Skeleton, { style: { width: "44px", height: "12px" } }) : jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", fontSize: "xsmall", color: "text50", children: fiatPrice ? `${fiatCurrency.sign}${fiatValue}` : "" })] })] }), jsxRuntimeExports$1.jsx(SvgArrowRightIcon, { color: "text50", style: { width: "16px" } }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "row", justifyContent: "flex-start", alignItems: "center", gap: "2", height: "12", borderRadius: "md", background: "buttonGlass", padding: "2", style: { flexBasis: "100%" }, children: [jsxRuntimeExports$1.jsx(GradientAvatar, { address: recipientAddress, style: { width: "20px" } }), jsxRuntimeExports$1.jsx(Text, { fontWeight: "bold", fontSize: "xsmall", color: "text100", children: recipientAddressFormatted })] })] }, index2); - }) }); - }; - return jsxRuntimeExports$1.jsxs(Box, { padding: "5", paddingTop: "3", flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "10", marginTop: "5", children: [jsxRuntimeExports$1.jsxs(Box, { marginTop: "6", flexDirection: "column", justifyContent: "center", alignItems: "center", gap: "1", children: [jsxRuntimeExports$1.jsx(Text, { fontSize: "normal", fontWeight: "medium", children: "Transaction details" }), jsxRuntimeExports$1.jsx(Text, { marginBottom: "1", fontSize: "small", fontWeight: "medium", color: "text50", children: date }), jsxRuntimeExports$1.jsx(NetworkBadge, { chainId: transaction2.chainId })] }), jsxRuntimeExports$1.jsxs(Box, { flexDirection: "column", alignItems: "center", justifyContent: "center", gap: "4", width: "full", padding: "4", background: "backgroundSecondary", borderRadius: "md", children: [jsxRuntimeExports$1.jsxs(Box, { width: "full", gap: "1", flexDirection: "row", alignItems: "center", justifyContent: "flex-start", children: [jsxRuntimeExports$1.jsx(Text, { fontSize: "normal", fontWeight: "medium", color: "text50", children: "Transfer" }), jsxRuntimeExports$1.jsx(NetworkImage, { chainId: transaction2.chainId, size: "xs" })] }), (_b2 = transaction2.transfers) == null ? void 0 : _b2.map((transfer, index2) => jsxRuntimeExports$1.jsx(Box, { width: "full", flexDirection: "column", justifyContent: "center", alignItems: "center", gap: "4", children: jsxRuntimeExports$1.jsx(Transfer, { transfer }) }, `transfer-${index2}`))] }), jsxRuntimeExports$1.jsx(Button, { onClick: onClickBlockExplorer, width: "full", borderRadius: "md", rightIcon: SvgLinkIcon, label: `View on ${nativeTokenInfo.blockExplorerName}` }), jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsxs(Box, { width: "full", flexDirection: "column", gap: "2", justifyContent: "center", alignItems: "flex-start", children: [jsxRuntimeExports$1.jsx(Divider, { width: "full", margin: "0", style: { marginBottom: "-4px" } }), jsxRuntimeExports$1.jsx(Text, { color: "text50", fontSize: "normal", fontWeight: "medium", children: "Status" }), jsxRuntimeExports$1.jsx(Text, { fontSize: "normal", fontWeight: "medium", color: "text100", children: "Complete" })] }), jsxRuntimeExports$1.jsxs(Box, { width: "full", flexDirection: "column", gap: "2", justifyContent: "center", alignItems: "flex-start", children: [jsxRuntimeExports$1.jsx(Divider, { width: "full", margin: "0", style: { marginBottom: "-4px" } }), jsxRuntimeExports$1.jsx(Text, { color: "text50", fontSize: "normal", fontWeight: "medium", children: "Transaction Hash" }), jsxRuntimeExports$1.jsx(Text, { color: "text100", fontSize: "normal", fontWeight: "medium", style: { overflowWrap: "anywhere" }, children: transaction2.txnHash }), jsxRuntimeExports$1.jsx(CopyButton, { marginTop: "2", buttonVariant: "with-label", text: transaction2.txnHash })] })] })] }); -}; -const NavigationHeader = ({ secondaryText, primaryText }) => { - const { goBack, history } = useNavigation(); - const onClickBack = () => { - goBack(); - }; - return jsxRuntimeExports$1.jsxs(Box, { background: "backgroundPrimary", zIndex: "20", position: "fixed", width: "full", flexDirection: "row", alignItems: "center", justifyContent: "space-between", paddingX: "4", style: { - height: HEADER_HEIGHT, - paddingTop: "6px" - }, children: [history.length > 0 ? jsxRuntimeExports$1.jsx(IconButton, { onClick: onClickBack, icon: SvgChevronLeftIcon, size: "xs" }) : jsxRuntimeExports$1.jsx(Box, {}), jsxRuntimeExports$1.jsxs(Box, { children: [jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", variant: "small", color: "text50", children: secondaryText }), jsxRuntimeExports$1.jsx(Text, { fontWeight: "medium", variant: "small", color: "text100", children: primaryText })] }), jsxRuntimeExports$1.jsx(Box, { style: { - width: "44px" - } })] }); -}; -function _extends$5() { - _extends$5 = Object.assign ? Object.assign.bind() : function(target) { - for (var i2 = 1; i2 < arguments.length; i2++) { - var source = arguments[i2]; - for (var key2 in source) { - if (Object.prototype.hasOwnProperty.call(source, key2)) { - target[key2] = source[key2]; - } + function rejected(value) { + try { + step(generator["throw"](value)); + } catch (e2) { + reject(e2); } } - return target; - }; - return _extends$5.apply(this, arguments); + function step(result) { + result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); + } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); } -function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented = true } = {}) { - return function handleEvent(event) { - originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event); - if (checkForDefaultPrevented === false || !event.defaultPrevented) - return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event); - }; +function __generator(thisArg, body) { + var _ = { label: 0, sent: function() { + if (t2[0] & 1) + throw t2[1]; + return t2[1]; + }, trys: [], ops: [] }, f2, y2, t2, g2; + return g2 = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g2[Symbol.iterator] = function() { + return this; + }), g2; + function verb(n2) { + return function(v3) { + return step([n2, v3]); + }; + } + function step(op) { + if (f2) + throw new TypeError("Generator is already executing."); + while (_) + try { + if (f2 = 1, y2 && (t2 = op[0] & 2 ? y2["return"] : op[0] ? y2["throw"] || ((t2 = y2["return"]) && t2.call(y2), 0) : y2.next) && !(t2 = t2.call(y2, op[1])).done) + return t2; + if (y2 = 0, t2) + op = [op[0] & 2, t2.value]; + switch (op[0]) { + case 0: + case 1: + t2 = op; + break; + case 4: + _.label++; + return { value: op[1], done: false }; + case 5: + _.label++; + y2 = op[1]; + op = [0]; + continue; + case 7: + op = _.ops.pop(); + _.trys.pop(); + continue; + default: + if (!(t2 = _.trys, t2 = t2.length > 0 && t2[t2.length - 1]) && (op[0] === 6 || op[0] === 2)) { + _ = 0; + continue; + } + if (op[0] === 3 && (!t2 || op[1] > t2[0] && op[1] < t2[3])) { + _.label = op[1]; + break; + } + if (op[0] === 6 && _.label < t2[1]) { + _.label = t2[1]; + t2 = op; + break; + } + if (t2 && _.label < t2[2]) { + _.label = t2[2]; + _.ops.push(op); + break; + } + if (t2[2]) + _.ops.pop(); + _.trys.pop(); + continue; + } + op = body.call(thisArg, _); + } catch (e2) { + op = [6, e2]; + y2 = 0; + } finally { + f2 = t2 = 0; + } + if (op[0] & 5) + throw op[1]; + return { value: op[0] ? op[1] : void 0, done: true }; + } } -function $6ed0406888f73fc4$var$setRef(ref, value) { - if (typeof ref === "function") - ref(value); - else if (ref !== null && ref !== void 0) - ref.current = value; +function __createBinding(o2, m2, k2, k22) { + if (k22 === void 0) + k22 = k2; + o2[k22] = m2[k2]; } -function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) { - return (node) => refs.forEach( - (ref) => $6ed0406888f73fc4$var$setRef(ref, node) - ); +function __exportStar(m2, exports) { + for (var p2 in m2) + if (p2 !== "default" && !exports.hasOwnProperty(p2)) + exports[p2] = m2[p2]; } -function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) { - return reactExports.useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs); +function __values(o2) { + var s2 = typeof Symbol === "function" && Symbol.iterator, m2 = s2 && o2[s2], i = 0; + if (m2) + return m2.call(o2); + if (o2 && typeof o2.length === "number") + return { + next: function() { + if (o2 && i >= o2.length) + o2 = void 0; + return { value: o2 && o2[i++], done: !o2 }; + } + }; + throw new TypeError(s2 ? "Object is not iterable." : "Symbol.iterator is not defined."); } -function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) { - let defaultContexts2 = []; - function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) { - const BaseContext = /* @__PURE__ */ reactExports.createContext(defaultContext); - const index2 = defaultContexts2.length; - defaultContexts2 = [ - ...defaultContexts2, - defaultContext - ]; - function Provider2(props) { - const { scope, children, ...context2 } = props; - const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext; - const value = reactExports.useMemo( - () => context2, - Object.values(context2) - ); - return /* @__PURE__ */ reactExports.createElement(Context.Provider, { - value - }, children); - } - function useContext(consumerName, scope) { - const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index2]) || BaseContext; - const context2 = reactExports.useContext(Context); - if (context2) - return context2; - if (defaultContext !== void 0) - return defaultContext; - throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``); +function __read(o2, n2) { + var m2 = typeof Symbol === "function" && o2[Symbol.iterator]; + if (!m2) + return o2; + var i = m2.call(o2), r2, ar = [], e2; + try { + while ((n2 === void 0 || n2-- > 0) && !(r2 = i.next()).done) + ar.push(r2.value); + } catch (error) { + e2 = { error }; + } finally { + try { + if (r2 && !r2.done && (m2 = i["return"])) + m2.call(i); + } finally { + if (e2) + throw e2.error; } - Provider2.displayName = rootComponentName + "Provider"; - return [ - Provider2, - useContext - ]; } - const createScope2 = () => { - const scopeContexts = defaultContexts2.map((defaultContext) => { - return /* @__PURE__ */ reactExports.createContext(defaultContext); - }); - return function useScope(scope) { - const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts; - return reactExports.useMemo( - () => ({ - [`__scope${scopeName}`]: { - ...scope, - [scopeName]: contexts - } - }), - [ - scope, - contexts - ] - ); - }; - }; - createScope2.scopeName = scopeName; - return [ - $c512c27ab02ef895$export$fd42f52fd3ae1109, - $c512c27ab02ef895$var$composeContextScopes(createScope2, ...createContextScopeDeps) - ]; + return ar; } -function $c512c27ab02ef895$var$composeContextScopes(...scopes) { - const baseScope = scopes[0]; - if (scopes.length === 1) - return baseScope; - const createScope1 = () => { - const scopeHooks = scopes.map( - (createScope2) => ({ - useScope: createScope2(), - scopeName: createScope2.scopeName - }) - ); - return function useComposedScopes(overrideScopes) { - const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope, scopeName }) => { - const scopeProps = useScope(overrideScopes); - const currentScope = scopeProps[`__scope${scopeName}`]; - return { - ...nextScopes, - ...currentScope - }; - }, {}); - return reactExports.useMemo( - () => ({ - [`__scope${baseScope.scopeName}`]: nextScopes1 - }), - [ - nextScopes1 - ] - ); - }; - }; - createScope1.scopeName = baseScope.scopeName; - return createScope1; +function __spread() { + for (var ar = [], i = 0; i < arguments.length; i++) + ar = ar.concat(__read(arguments[i])); + return ar; } -const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => { - const { children, ...slotProps } = props; - const childrenArray = reactExports.Children.toArray(children); - const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable); - if (slottable) { - const newElement = slottable.props.children; - const newChildren = childrenArray.map((child) => { - if (child === slottable) { - if (reactExports.Children.count(newElement) > 1) - return reactExports.Children.only(null); - return /* @__PURE__ */ reactExports.isValidElement(newElement) ? newElement.props.children : null; - } else - return child; - }); - return /* @__PURE__ */ reactExports.createElement($5e63c961fc1ce211$var$SlotClone, _extends$5({}, slotProps, { - ref: forwardedRef - }), /* @__PURE__ */ reactExports.isValidElement(newElement) ? /* @__PURE__ */ reactExports.cloneElement(newElement, void 0, newChildren) : null); - } - return /* @__PURE__ */ reactExports.createElement($5e63c961fc1ce211$var$SlotClone, _extends$5({}, slotProps, { - ref: forwardedRef - }), children); -}); -$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = "Slot"; -const $5e63c961fc1ce211$var$SlotClone = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => { - const { children, ...slotProps } = props; - if (/* @__PURE__ */ reactExports.isValidElement(children)) - return /* @__PURE__ */ reactExports.cloneElement(children, { - ...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props), - ref: forwardedRef ? $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref) : children.ref - }); - return reactExports.Children.count(children) > 1 ? reactExports.Children.only(null) : null; -}); -$5e63c961fc1ce211$var$SlotClone.displayName = "SlotClone"; -const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children }) => { - return /* @__PURE__ */ reactExports.createElement(reactExports.Fragment, null, children); -}; -function $5e63c961fc1ce211$var$isSlottable(child) { - return /* @__PURE__ */ reactExports.isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45; +function __spreadArrays() { + for (var s2 = 0, i = 0, il2 = arguments.length; i < il2; i++) + s2 += arguments[i].length; + for (var r2 = Array(s2), k2 = 0, i = 0; i < il2; i++) + for (var a2 = arguments[i], j2 = 0, jl2 = a2.length; j2 < jl2; j2++, k2++) + r2[k2] = a2[j2]; + return r2; } -function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) { - const overrideProps = { - ...childProps - }; - for (const propName in childProps) { - const slotPropValue = slotProps[propName]; - const childPropValue = childProps[propName]; - const isHandler = /^on[A-Z]/.test(propName); - if (isHandler) { - if (slotPropValue && childPropValue) - overrideProps[propName] = (...args) => { - childPropValue(...args); - slotPropValue(...args); - }; - else if (slotPropValue) - overrideProps[propName] = slotPropValue; - } else if (propName === "style") - overrideProps[propName] = { - ...slotPropValue, - ...childPropValue +function __await(v3) { + return this instanceof __await ? (this.v = v3, this) : new __await(v3); +} +function __asyncGenerator(thisArg, _arguments, generator) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var g2 = generator.apply(thisArg, _arguments || []), i, q2 = []; + return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i; + function verb(n2) { + if (g2[n2]) + i[n2] = function(v3) { + return new Promise(function(a2, b2) { + q2.push([n2, v3, a2, b2]) > 1 || resume(n2, v3); + }); }; - else if (propName === "className") - overrideProps[propName] = [ - slotPropValue, - childPropValue - ].filter(Boolean).join(" "); } - return { - ...slotProps, - ...overrideProps - }; -} -const $8927f6f2acc4f386$var$NODES = [ - "a", - "button", - "div", - "form", - "h2", - "h3", - "img", - "input", - "label", - "li", - "nav", - "ol", - "p", - "span", - "svg", - "ul" -]; -const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node) => { - const Node2 = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => { - const { asChild, ...primitiveProps } = props; - const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node; - reactExports.useEffect(() => { - window[Symbol.for("radix-ui")] = true; - }, []); - return /* @__PURE__ */ reactExports.createElement(Comp, _extends$5({}, primitiveProps, { - ref: forwardedRef - })); - }); - Node2.displayName = `Primitive.${node}`; - return { - ...primitive, - [node]: Node2 - }; -}, {}); -function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) { - if (target) - reactDomExports.flushSync( - () => target.dispatchEvent(event) - ); -} -function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) { - const callbackRef = reactExports.useRef(callback); - reactExports.useEffect(() => { - callbackRef.current = callback; - }); - return reactExports.useMemo( - () => (...args) => { - var _callbackRef$current; - return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args); - }, - [] - ); + function resume(n2, v3) { + try { + step(g2[n2](v3)); + } catch (e2) { + settle(q2[0][3], e2); + } + } + function step(r2) { + r2.value instanceof __await ? Promise.resolve(r2.value.v).then(fulfill, reject) : settle(q2[0][2], r2); + } + function fulfill(value) { + resume("next", value); + } + function reject(value) { + resume("throw", value); + } + function settle(f2, v3) { + if (f2(v3), q2.shift(), q2.length) + resume(q2[0][0], q2[0][1]); + } } -function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) { - const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp); - reactExports.useEffect(() => { - const handleKeyDown = (event) => { - if (event.key === "Escape") - onEscapeKeyDown(event); - }; - ownerDocument.addEventListener("keydown", handleKeyDown); - return () => ownerDocument.removeEventListener("keydown", handleKeyDown); - }, [ - onEscapeKeyDown, - ownerDocument - ]); +function __asyncDelegator(o2) { + var i, p2; + return i = {}, verb("next"), verb("throw", function(e2) { + throw e2; + }), verb("return"), i[Symbol.iterator] = function() { + return this; + }, i; + function verb(n2, f2) { + i[n2] = o2[n2] ? function(v3) { + return (p2 = !p2) ? { value: __await(o2[n2](v3)), done: n2 === "return" } : f2 ? f2(v3) : v3; + } : f2; + } } -const $5cb92bef7577960e$var$CONTEXT_UPDATE = "dismissableLayer.update"; -const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside"; -const $5cb92bef7577960e$var$FOCUS_OUTSIDE = "dismissableLayer.focusOutside"; -let $5cb92bef7577960e$var$originalBodyPointerEvents; -const $5cb92bef7577960e$var$DismissableLayerContext = /* @__PURE__ */ reactExports.createContext({ - layers: /* @__PURE__ */ new Set(), - layersWithOutsidePointerEventsDisabled: /* @__PURE__ */ new Set(), - branches: /* @__PURE__ */ new Set() -}); -const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => { - var _node$ownerDocument; - const { disableOutsidePointerEvents = false, onEscapeKeyDown, onPointerDownOutside, onFocusOutside, onInteractOutside, onDismiss, ...layerProps } = props; - const context2 = reactExports.useContext($5cb92bef7577960e$var$DismissableLayerContext); - const [node1, setNode] = reactExports.useState(null); - const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document; - const [, force] = reactExports.useState({}); - const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05( - forwardedRef, - (node) => setNode(node) - ); - const layers = Array.from(context2.layers); - const [highestLayerWithOutsidePointerEventsDisabled] = [ - ...context2.layersWithOutsidePointerEventsDisabled - ].slice(-1); - const highestLayerWithOutsidePointerEventsDisabledIndex = layers.indexOf(highestLayerWithOutsidePointerEventsDisabled); - const index2 = node1 ? layers.indexOf(node1) : -1; - const isBodyPointerEventsDisabled = context2.layersWithOutsidePointerEventsDisabled.size > 0; - const isPointerEventsEnabled = index2 >= highestLayerWithOutsidePointerEventsDisabledIndex; - const pointerDownOutside = $5cb92bef7577960e$var$usePointerDownOutside((event) => { - const target = event.target; - const isPointerDownOnBranch = [ - ...context2.branches - ].some( - (branch) => branch.contains(target) - ); - if (!isPointerEventsEnabled || isPointerDownOnBranch) - return; - onPointerDownOutside === null || onPointerDownOutside === void 0 || onPointerDownOutside(event); - onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event); - if (!event.defaultPrevented) - onDismiss === null || onDismiss === void 0 || onDismiss(); - }, ownerDocument); - const focusOutside = $5cb92bef7577960e$var$useFocusOutside((event) => { - const target = event.target; - const isFocusInBranch = [ - ...context2.branches - ].some( - (branch) => branch.contains(target) - ); - if (isFocusInBranch) - return; - onFocusOutside === null || onFocusOutside === void 0 || onFocusOutside(event); - onInteractOutside === null || onInteractOutside === void 0 || onInteractOutside(event); - if (!event.defaultPrevented) - onDismiss === null || onDismiss === void 0 || onDismiss(); - }, ownerDocument); - $addc16e1bbe58fd0$export$3a72a57244d6e765((event) => { - const isHighestLayer = index2 === context2.layers.size - 1; - if (!isHighestLayer) - return; - onEscapeKeyDown === null || onEscapeKeyDown === void 0 || onEscapeKeyDown(event); - if (!event.defaultPrevented && onDismiss) { - event.preventDefault(); - onDismiss(); - } - }, ownerDocument); - reactExports.useEffect(() => { - if (!node1) - return; - if (disableOutsidePointerEvents) { - if (context2.layersWithOutsidePointerEventsDisabled.size === 0) { - $5cb92bef7577960e$var$originalBodyPointerEvents = ownerDocument.body.style.pointerEvents; - ownerDocument.body.style.pointerEvents = "none"; - } - context2.layersWithOutsidePointerEventsDisabled.add(node1); - } - context2.layers.add(node1); - $5cb92bef7577960e$var$dispatchUpdate(); - return () => { - if (disableOutsidePointerEvents && context2.layersWithOutsidePointerEventsDisabled.size === 1) - ownerDocument.body.style.pointerEvents = $5cb92bef7577960e$var$originalBodyPointerEvents; - }; - }, [ - node1, - ownerDocument, - disableOutsidePointerEvents, - context2 - ]); - reactExports.useEffect(() => { - return () => { - if (!node1) - return; - context2.layers.delete(node1); - context2.layersWithOutsidePointerEventsDisabled.delete(node1); - $5cb92bef7577960e$var$dispatchUpdate(); - }; - }, [ - node1, - context2 - ]); - reactExports.useEffect(() => { - const handleUpdate = () => force({}); - document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate); - return () => document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate); - }, []); - return /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$5({}, layerProps, { - ref: composedRefs, - style: { - pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? "auto" : "none" : void 0, - ...props.style - }, - onFocusCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture), - onBlurCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture), - onPointerDownCapture: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture) - })); -}); -function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) { - const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside); - const isPointerInsideReactTreeRef = reactExports.useRef(false); - const handleClickRef = reactExports.useRef(() => { - }); - reactExports.useEffect(() => { - const handlePointerDown = (event) => { - if (event.target && !isPointerInsideReactTreeRef.current) { - let handleAndDispatchPointerDownOutsideEvent = function() { - $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE, handlePointerDownOutside, eventDetail, { - discrete: true - }); - }; - const eventDetail = { - originalEvent: event - }; - if (event.pointerType === "touch") { - ownerDocument.removeEventListener("click", handleClickRef.current); - handleClickRef.current = handleAndDispatchPointerDownOutsideEvent; - ownerDocument.addEventListener("click", handleClickRef.current, { - once: true - }); - } else - handleAndDispatchPointerDownOutsideEvent(); - } else - ownerDocument.removeEventListener("click", handleClickRef.current); - isPointerInsideReactTreeRef.current = false; - }; - const timerId = window.setTimeout(() => { - ownerDocument.addEventListener("pointerdown", handlePointerDown); - }, 0); - return () => { - window.clearTimeout(timerId); - ownerDocument.removeEventListener("pointerdown", handlePointerDown); - ownerDocument.removeEventListener("click", handleClickRef.current); +function __asyncValues(o2) { + if (!Symbol.asyncIterator) + throw new TypeError("Symbol.asyncIterator is not defined."); + var m2 = o2[Symbol.asyncIterator], i; + return m2 ? m2.call(o2) : (o2 = typeof __values === "function" ? __values(o2) : o2[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function() { + return this; + }, i); + function verb(n2) { + i[n2] = o2[n2] && function(v3) { + return new Promise(function(resolve, reject) { + v3 = o2[n2](v3), settle(resolve, reject, v3.done, v3.value); + }); }; - }, [ - ownerDocument, - handlePointerDownOutside - ]); - return { - // ensures we check React component tree (not just DOM tree) - onPointerDownCapture: () => isPointerInsideReactTreeRef.current = true - }; + } + function settle(resolve, reject, d2, v3) { + Promise.resolve(v3).then(function(v5) { + resolve({ value: v5, done: d2 }); + }, reject); + } } -function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) { - const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside); - const isFocusInsideReactTreeRef = reactExports.useRef(false); - reactExports.useEffect(() => { - const handleFocus = (event) => { - if (event.target && !isFocusInsideReactTreeRef.current) { - const eventDetail = { - originalEvent: event - }; - $5cb92bef7577960e$var$handleAndDispatchCustomEvent($5cb92bef7577960e$var$FOCUS_OUTSIDE, handleFocusOutside, eventDetail, { - discrete: false - }); - } - }; - ownerDocument.addEventListener("focusin", handleFocus); - return () => ownerDocument.removeEventListener("focusin", handleFocus); - }, [ - ownerDocument, - handleFocusOutside - ]); - return { - onFocusCapture: () => isFocusInsideReactTreeRef.current = true, - onBlurCapture: () => isFocusInsideReactTreeRef.current = false - }; +function __makeTemplateObject(cooked, raw) { + if (Object.defineProperty) { + Object.defineProperty(cooked, "raw", { value: raw }); + } else { + cooked.raw = raw; + } + return cooked; } -function $5cb92bef7577960e$var$dispatchUpdate() { - const event = new CustomEvent($5cb92bef7577960e$var$CONTEXT_UPDATE); - document.dispatchEvent(event); +function __importStar(mod2) { + if (mod2 && mod2.__esModule) + return mod2; + var result = {}; + if (mod2 != null) { + for (var k2 in mod2) + if (Object.hasOwnProperty.call(mod2, k2)) + result[k2] = mod2[k2]; + } + result.default = mod2; + return result; } -function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name2, handler, detail, { discrete }) { - const target = detail.originalEvent.target; - const event = new CustomEvent(name2, { - bubbles: false, - cancelable: true, - detail - }); - if (handler) - target.addEventListener(name2, handler, { - once: true - }); - if (discrete) - $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event); - else - target.dispatchEvent(event); +function __importDefault(mod2) { + return mod2 && mod2.__esModule ? mod2 : { default: mod2 }; } -let $3db38b7d1fb3fe6a$var$count = 0; -function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() { - reactExports.useEffect(() => { - var _edgeGuards$, _edgeGuards$2; - const edgeGuards = document.querySelectorAll("[data-radix-focus-guard]"); - document.body.insertAdjacentElement("afterbegin", (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard()); - document.body.insertAdjacentElement("beforeend", (_edgeGuards$2 = edgeGuards[1]) !== null && _edgeGuards$2 !== void 0 ? _edgeGuards$2 : $3db38b7d1fb3fe6a$var$createFocusGuard()); - $3db38b7d1fb3fe6a$var$count++; - return () => { - if ($3db38b7d1fb3fe6a$var$count === 1) - document.querySelectorAll("[data-radix-focus-guard]").forEach( - (node) => node.remove() - ); - $3db38b7d1fb3fe6a$var$count--; - }; - }, []); +function __classPrivateFieldGet(receiver, privateMap) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to get private field on non-instance"); + } + return privateMap.get(receiver); } -function $3db38b7d1fb3fe6a$var$createFocusGuard() { - const element = document.createElement("span"); - element.setAttribute("data-radix-focus-guard", ""); - element.tabIndex = 0; - element.style.cssText = "outline: none; opacity: 0; position: fixed; pointer-events: none"; - return element; +function __classPrivateFieldSet(receiver, privateMap, value) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to set private field on non-instance"); + } + privateMap.set(receiver, value); + return value; } -const $d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT = "focusScope.autoFocusOnMount"; -const $d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT = "focusScope.autoFocusOnUnmount"; -const $d3863c46a17e8a28$var$EVENT_OPTIONS = { - bubbles: false, - cancelable: true -}; -const $d3863c46a17e8a28$export$20e40289641fbbb6 = /* @__PURE__ */ reactExports.forwardRef((props, forwardedRef) => { - const { loop = false, trapped = false, onMountAutoFocus: onMountAutoFocusProp, onUnmountAutoFocus: onUnmountAutoFocusProp, ...scopeProps } = props; - const [container1, setContainer] = reactExports.useState(null); - const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp); - const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp); - const lastFocusedElementRef = reactExports.useRef(null); - const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05( - forwardedRef, - (node) => setContainer(node) - ); - const focusScope = reactExports.useRef({ - paused: false, - pause() { - this.paused = true; - }, - resume() { - this.paused = false; +const tslib_es6 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + get __assign() { + return __assign; + }, + __asyncDelegator, + __asyncGenerator, + __asyncValues, + __await, + __awaiter, + __classPrivateFieldGet, + __classPrivateFieldSet, + __createBinding, + __decorate, + __exportStar, + __extends, + __generator, + __importDefault, + __importStar, + __makeTemplateObject, + __metadata, + __param, + __read, + __rest, + __spread, + __spreadArrays, + __values +}, Symbol.toStringTag, { value: "Module" })); +const require$$0$1 = /* @__PURE__ */ getAugmentedNamespace(tslib_es6); +var crossPlatformSha256 = {}; +var ie11Sha256 = {}; +var isEmptyData$1 = {}; +var hasRequiredIsEmptyData$1; +function requireIsEmptyData$1() { + if (hasRequiredIsEmptyData$1) + return isEmptyData$1; + hasRequiredIsEmptyData$1 = 1; + Object.defineProperty(isEmptyData$1, "__esModule", { value: true }); + isEmptyData$1.isEmptyData = void 0; + function isEmptyData2(data) { + if (typeof data === "string") { + return data.length === 0; } - }).current; - reactExports.useEffect(() => { - if (trapped) { - let handleFocusIn = function(event) { - if (focusScope.paused || !container1) - return; - const target = event.target; - if (container1.contains(target)) - lastFocusedElementRef.current = target; - else - $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, { - select: true - }); - }, handleFocusOut = function(event) { - if (focusScope.paused || !container1) - return; - const relatedTarget = event.relatedTarget; - if (relatedTarget === null) - return; - if (!container1.contains(relatedTarget)) - $d3863c46a17e8a28$var$focus(lastFocusedElementRef.current, { - select: true - }); - }, handleMutations = function(mutations) { - const focusedElement = document.activeElement; - if (focusedElement !== document.body) + return data.byteLength === 0; + } + isEmptyData$1.isEmptyData = isEmptyData2; + return isEmptyData$1; +} +var constants$1 = {}; +var hasRequiredConstants$1; +function requireConstants$1() { + if (hasRequiredConstants$1) + return constants$1; + hasRequiredConstants$1 = 1; + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.EMPTY_DATA_SHA_256 = exports.SHA_256_HMAC_ALGO = exports.SHA_256_HASH = void 0; + exports.SHA_256_HASH = { name: "SHA-256" }; + exports.SHA_256_HMAC_ALGO = { + name: "HMAC", + hash: exports.SHA_256_HASH + }; + exports.EMPTY_DATA_SHA_256 = new Uint8Array([ + 227, + 176, + 196, + 66, + 152, + 252, + 28, + 20, + 154, + 251, + 244, + 200, + 153, + 111, + 185, + 36, + 39, + 174, + 65, + 228, + 100, + 155, + 147, + 76, + 164, + 149, + 153, + 27, + 120, + 82, + 184, + 85 + ]); + })(constants$1); + return constants$1; +} +const fromUtf8$2 = (input2) => { + const bytes3 = []; + for (let i = 0, len = input2.length; i < len; i++) { + const value = input2.charCodeAt(i); + if (value < 128) { + bytes3.push(value); + } else if (value < 2048) { + bytes3.push(value >> 6 | 192, value & 63 | 128); + } else if (i + 1 < input2.length && (value & 64512) === 55296 && (input2.charCodeAt(i + 1) & 64512) === 56320) { + const surrogatePair = 65536 + ((value & 1023) << 10) + (input2.charCodeAt(++i) & 1023); + bytes3.push(surrogatePair >> 18 | 240, surrogatePair >> 12 & 63 | 128, surrogatePair >> 6 & 63 | 128, surrogatePair & 63 | 128); + } else { + bytes3.push(value >> 12 | 224, value >> 6 & 63 | 128, value & 63 | 128); + } + } + return Uint8Array.from(bytes3); +}; +const toUtf8$2 = (input2) => { + let decoded = ""; + for (let i = 0, len = input2.length; i < len; i++) { + const byte = input2[i]; + if (byte < 128) { + decoded += String.fromCharCode(byte); + } else if (192 <= byte && byte < 224) { + const nextByte = input2[++i]; + decoded += String.fromCharCode((byte & 31) << 6 | nextByte & 63); + } else if (240 <= byte && byte < 365) { + const surrogatePair = [byte, input2[++i], input2[++i], input2[++i]]; + const encoded = "%" + surrogatePair.map((byteValue) => byteValue.toString(16)).join("%"); + decoded += decodeURIComponent(encoded); + } else { + decoded += String.fromCharCode((byte & 15) << 12 | (input2[++i] & 63) << 6 | input2[++i] & 63); + } + } + return decoded; +}; +function fromUtf8$1(input2) { + return new TextEncoder().encode(input2); +} +function toUtf8$1(input2) { + return new TextDecoder("utf-8").decode(input2); +} +const fromUtf8 = (input2) => typeof TextEncoder === "function" ? fromUtf8$1(input2) : fromUtf8$2(input2); +const toUtf8 = (input2) => typeof TextDecoder === "function" ? toUtf8$1(input2) : toUtf8$2(input2); +const distEs$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + fromUtf8, + toUtf8 +}, Symbol.toStringTag, { value: "Module" })); +const require$$0 = /* @__PURE__ */ getAugmentedNamespace(distEs$1); +const fallbackWindow = {}; +function locateWindow() { + if (typeof window !== "undefined") { + return window; + } else if (typeof self !== "undefined") { + return self; + } + return fallbackWindow; +} +const distEs = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ + __proto__: null, + locateWindow +}, Symbol.toStringTag, { value: "Module" })); +const require$$5 = /* @__PURE__ */ getAugmentedNamespace(distEs); +var hasRequiredIe11Sha256; +function requireIe11Sha256() { + if (hasRequiredIe11Sha256) + return ie11Sha256; + hasRequiredIe11Sha256 = 1; + Object.defineProperty(ie11Sha256, "__esModule", { value: true }); + ie11Sha256.Sha256 = void 0; + var isEmptyData_1 = requireIsEmptyData$1(); + var constants_1 = requireConstants$1(); + var util_utf8_browser_1 = require$$0; + var util_locate_window_1 = require$$5; + var Sha256 = ( + /** @class */ + function() { + function Sha2562(secret) { + this.secret = secret; + this.reset(); + } + Sha2562.prototype.update = function(toHash) { + var _this = this; + if ((0, isEmptyData_1.isEmptyData)(toHash)) { return; - for (const mutation of mutations) - if (mutation.removedNodes.length > 0) - $d3863c46a17e8a28$var$focus(container1); + } + this.operation = this.operation.then(function(operation) { + operation.onerror = function() { + _this.operation = Promise.reject(new Error("Error encountered updating hash")); + }; + operation.process(toArrayBufferView(toHash)); + return operation; + }); + this.operation.catch(function() { + }); }; - document.addEventListener("focusin", handleFocusIn); - document.addEventListener("focusout", handleFocusOut); - const mutationObserver = new MutationObserver(handleMutations); - if (container1) - mutationObserver.observe(container1, { - childList: true, - subtree: true + Sha2562.prototype.digest = function() { + return this.operation.then(function(operation) { + return new Promise(function(resolve, reject) { + operation.onerror = function() { + reject(new Error("Error encountered finalizing hash")); + }; + operation.oncomplete = function() { + if (operation.result) { + resolve(new Uint8Array(operation.result)); + } + reject(new Error("Error encountered finalizing hash")); + }; + operation.finish(); + }); }); - return () => { - document.removeEventListener("focusin", handleFocusIn); - document.removeEventListener("focusout", handleFocusOut); - mutationObserver.disconnect(); }; - } - }, [ - trapped, - container1, - focusScope.paused - ]); - reactExports.useEffect(() => { - if (container1) { - $d3863c46a17e8a28$var$focusScopesStack.add(focusScope); - const previouslyFocusedElement = document.activeElement; - const hasFocusedCandidate = container1.contains(previouslyFocusedElement); - if (!hasFocusedCandidate) { - const mountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS); - container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); - container1.dispatchEvent(mountEvent); - if (!mountEvent.defaultPrevented) { - $d3863c46a17e8a28$var$focusFirst($d3863c46a17e8a28$var$removeLinks($d3863c46a17e8a28$var$getTabbableCandidates(container1)), { - select: true + Sha2562.prototype.reset = function() { + if (this.secret) { + this.operation = getKeyPromise(this.secret).then(function(keyData) { + return (0, util_locate_window_1.locateWindow)().msCrypto.subtle.sign(constants_1.SHA_256_HMAC_ALGO, keyData); }); - if (document.activeElement === previouslyFocusedElement) - $d3863c46a17e8a28$var$focus(container1); + this.operation.catch(function() { + }); + } else { + this.operation = Promise.resolve((0, util_locate_window_1.locateWindow)().msCrypto.subtle.digest("SHA-256")); } - } - return () => { - container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_MOUNT, onMountAutoFocus); - setTimeout(() => { - const unmountEvent = new CustomEvent($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, $d3863c46a17e8a28$var$EVENT_OPTIONS); - container1.addEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); - container1.dispatchEvent(unmountEvent); - if (!unmountEvent.defaultPrevented) - $d3863c46a17e8a28$var$focus(previouslyFocusedElement !== null && previouslyFocusedElement !== void 0 ? previouslyFocusedElement : document.body, { - select: true - }); - container1.removeEventListener($d3863c46a17e8a28$var$AUTOFOCUS_ON_UNMOUNT, onUnmountAutoFocus); - $d3863c46a17e8a28$var$focusScopesStack.remove(focusScope); - }, 0); }; - } - }, [ - container1, - onMountAutoFocus, - onUnmountAutoFocus, - focusScope - ]); - const handleKeyDown = reactExports.useCallback((event) => { - if (!loop && !trapped) - return; - if (focusScope.paused) - return; - const isTabKey = event.key === "Tab" && !event.altKey && !event.ctrlKey && !event.metaKey; - const focusedElement = document.activeElement; - if (isTabKey && focusedElement) { - const container = event.currentTarget; - const [first, last] = $d3863c46a17e8a28$var$getTabbableEdges(container); - const hasTabbableElementsInside = first && last; - if (!hasTabbableElementsInside) { - if (focusedElement === container) - event.preventDefault(); - } else { - if (!event.shiftKey && focusedElement === last) { - event.preventDefault(); - if (loop) - $d3863c46a17e8a28$var$focus(first, { - select: true - }); - } else if (event.shiftKey && focusedElement === first) { - event.preventDefault(); - if (loop) - $d3863c46a17e8a28$var$focus(last, { - select: true - }); + return Sha2562; + }() + ); + ie11Sha256.Sha256 = Sha256; + function getKeyPromise(secret) { + return new Promise(function(resolve, reject) { + var keyOperation = (0, util_locate_window_1.locateWindow)().msCrypto.subtle.importKey("raw", toArrayBufferView(secret), constants_1.SHA_256_HMAC_ALGO, false, ["sign"]); + keyOperation.oncomplete = function() { + if (keyOperation.result) { + resolve(keyOperation.result); } - } - } - }, [ - loop, - trapped, - focusScope.paused - ]); - return /* @__PURE__ */ reactExports.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.div, _extends$5({ - tabIndex: -1 - }, scopeProps, { - ref: composedRefs, - onKeyDown: handleKeyDown - })); -}); -function $d3863c46a17e8a28$var$focusFirst(candidates, { select = false } = {}) { - const previouslyFocusedElement = document.activeElement; - for (const candidate of candidates) { - $d3863c46a17e8a28$var$focus(candidate, { - select + reject(new Error("ImportKey completed without importing key.")); + }; + keyOperation.onerror = function() { + reject(new Error("ImportKey failed to import key.")); + }; }); - if (document.activeElement !== previouslyFocusedElement) - return; } -} -function $d3863c46a17e8a28$var$getTabbableEdges(container) { - const candidates = $d3863c46a17e8a28$var$getTabbableCandidates(container); - const first = $d3863c46a17e8a28$var$findVisible(candidates, container); - const last = $d3863c46a17e8a28$var$findVisible(candidates.reverse(), container); - return [ - first, - last - ]; -} -function $d3863c46a17e8a28$var$getTabbableCandidates(container) { - const nodes = []; - const walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, { - acceptNode: (node) => { - const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden"; - if (node.disabled || node.hidden || isHiddenInput) - return NodeFilter.FILTER_SKIP; - return node.tabIndex >= 0 ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; + function toArrayBufferView(data) { + if (typeof data === "string") { + return (0, util_utf8_browser_1.fromUtf8)(data); } - }); - while (walker.nextNode()) - nodes.push(walker.currentNode); - return nodes; -} -function $d3863c46a17e8a28$var$findVisible(elements, container) { - for (const element of elements) { - if (!$d3863c46a17e8a28$var$isHidden(element, { - upTo: container - })) - return element; + if (ArrayBuffer.isView(data)) { + return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); + } + return new Uint8Array(data); } + return ie11Sha256; } -function $d3863c46a17e8a28$var$isHidden(node, { upTo }) { - if (getComputedStyle(node).visibility === "hidden") - return true; - while (node) { - if (upTo !== void 0 && node === upTo) - return false; - if (getComputedStyle(node).display === "none") - return true; - node = node.parentElement; +var webCryptoSha256 = {}; +var build$3 = {}; +var convertToBuffer = {}; +var hasRequiredConvertToBuffer; +function requireConvertToBuffer() { + if (hasRequiredConvertToBuffer) + return convertToBuffer; + hasRequiredConvertToBuffer = 1; + Object.defineProperty(convertToBuffer, "__esModule", { value: true }); + convertToBuffer.convertToBuffer = void 0; + var util_utf8_browser_1 = require$$0; + var fromUtf82 = typeof Buffer2 !== "undefined" && Buffer2.from ? function(input2) { + return Buffer2.from(input2, "utf8"); + } : util_utf8_browser_1.fromUtf8; + function convertToBuffer$1(data) { + if (data instanceof Uint8Array) + return data; + if (typeof data === "string") { + return fromUtf82(data); + } + if (ArrayBuffer.isView(data)) { + return new Uint8Array(data.buffer, data.byteOffset, data.byteLength / Uint8Array.BYTES_PER_ELEMENT); + } + return new Uint8Array(data); } - return false; + convertToBuffer.convertToBuffer = convertToBuffer$1; + return convertToBuffer; } -function $d3863c46a17e8a28$var$isSelectableInput(element) { - return element instanceof HTMLInputElement && "select" in element; +var isEmptyData = {}; +var hasRequiredIsEmptyData; +function requireIsEmptyData() { + if (hasRequiredIsEmptyData) + return isEmptyData; + hasRequiredIsEmptyData = 1; + Object.defineProperty(isEmptyData, "__esModule", { value: true }); + isEmptyData.isEmptyData = void 0; + function isEmptyData$12(data) { + if (typeof data === "string") { + return data.length === 0; + } + return data.byteLength === 0; + } + isEmptyData.isEmptyData = isEmptyData$12; + return isEmptyData; } -function $d3863c46a17e8a28$var$focus(element, { select = false } = {}) { - if (element && element.focus) { - const previouslyFocusedElement = document.activeElement; - element.focus({ - preventScroll: true - }); - if (element !== previouslyFocusedElement && $d3863c46a17e8a28$var$isSelectableInput(element) && select) - element.select(); +var numToUint8 = {}; +var hasRequiredNumToUint8; +function requireNumToUint8() { + if (hasRequiredNumToUint8) + return numToUint8; + hasRequiredNumToUint8 = 1; + Object.defineProperty(numToUint8, "__esModule", { value: true }); + numToUint8.numToUint8 = void 0; + function numToUint8$1(num) { + return new Uint8Array([ + (num & 4278190080) >> 24, + (num & 16711680) >> 16, + (num & 65280) >> 8, + num & 255 + ]); } + numToUint8.numToUint8 = numToUint8$1; + return numToUint8; } -const $d3863c46a17e8a28$var$focusScopesStack = $d3863c46a17e8a28$var$createFocusScopesStack(); -function $d3863c46a17e8a28$var$createFocusScopesStack() { - let stack = []; - return { - add(focusScope) { - const activeFocusScope = stack[0]; - if (focusScope !== activeFocusScope) - activeFocusScope === null || activeFocusScope === void 0 || activeFocusScope.pause(); - stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope); - stack.unshift(focusScope); - }, - remove(focusScope) { - var _stack$; - stack = $d3863c46a17e8a28$var$arrayRemove(stack, focusScope); - (_stack$ = stack[0]) === null || _stack$ === void 0 || _stack$.resume(); +var uint32ArrayFrom = {}; +var hasRequiredUint32ArrayFrom; +function requireUint32ArrayFrom() { + if (hasRequiredUint32ArrayFrom) + return uint32ArrayFrom; + hasRequiredUint32ArrayFrom = 1; + Object.defineProperty(uint32ArrayFrom, "__esModule", { value: true }); + uint32ArrayFrom.uint32ArrayFrom = void 0; + function uint32ArrayFrom$1(a_lookUpTable) { + if (!Uint32Array.from) { + var return_array = new Uint32Array(a_lookUpTable.length); + var a_index = 0; + while (a_index < a_lookUpTable.length) { + return_array[a_index] = a_lookUpTable[a_index]; + a_index += 1; + } + return return_array; } - }; -} -function $d3863c46a17e8a28$var$arrayRemove(array, item2) { - const updatedArray = [ - ...array - ]; - const index2 = updatedArray.indexOf(item2); - if (index2 !== -1) - updatedArray.splice(index2, 1); - return updatedArray; -} -function $d3863c46a17e8a28$var$removeLinks(items) { - return items.filter( - (item2) => item2.tagName !== "A" - ); + return Uint32Array.from(a_lookUpTable); + } + uint32ArrayFrom.uint32ArrayFrom = uint32ArrayFrom$1; + return uint32ArrayFrom; } -const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? reactExports.useLayoutEffect : () => { -}; -const $1746a345f3d73bb7$var$useReactId = $2AODx$react["useId".toString()] || (() => void 0); -let $1746a345f3d73bb7$var$count = 0; -function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) { - const [id2, setId] = reactExports.useState($1746a345f3d73bb7$var$useReactId()); - $9f79659886946c16$export$e5c5a5f917a5871c(() => { - if (!deterministicId) - setId( - (reactId) => reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++) - ); - }, [ - deterministicId - ]); - return deterministicId || (id2 ? `radix-${id2}` : ""); +var hasRequiredBuild$3; +function requireBuild$3() { + if (hasRequiredBuild$3) + return build$3; + hasRequiredBuild$3 = 1; + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.uint32ArrayFrom = exports.numToUint8 = exports.isEmptyData = exports.convertToBuffer = void 0; + var convertToBuffer_1 = requireConvertToBuffer(); + Object.defineProperty(exports, "convertToBuffer", { enumerable: true, get: function() { + return convertToBuffer_1.convertToBuffer; + } }); + var isEmptyData_1 = requireIsEmptyData(); + Object.defineProperty(exports, "isEmptyData", { enumerable: true, get: function() { + return isEmptyData_1.isEmptyData; + } }); + var numToUint8_1 = requireNumToUint8(); + Object.defineProperty(exports, "numToUint8", { enumerable: true, get: function() { + return numToUint8_1.numToUint8; + } }); + var uint32ArrayFrom_1 = requireUint32ArrayFrom(); + Object.defineProperty(exports, "uint32ArrayFrom", { enumerable: true, get: function() { + return uint32ArrayFrom_1.uint32ArrayFrom; + } }); + })(build$3); + return build$3; } -const sides = ["top", "right", "bottom", "left"]; -const min = Math.min; -const max = Math.max; -const round = Math.round; -const floor = Math.floor; -const createCoords = (v3) => ({ - x: v3, - y: v3 -}); -const oppositeSideMap = { - left: "right", - right: "left", - bottom: "top", - top: "bottom" -}; -const oppositeAlignmentMap = { - start: "end", - end: "start" -}; -function clamp(start, value, end) { - return max(start, min(value, end)); -} -function evaluate(value, param) { - return typeof value === "function" ? value(param) : value; -} -function getSide(placement) { - return placement.split("-")[0]; -} -function getAlignment(placement) { - return placement.split("-")[1]; -} -function getOppositeAxis(axis) { - return axis === "x" ? "y" : "x"; -} -function getAxisLength(axis) { - return axis === "y" ? "height" : "width"; +var hasRequiredWebCryptoSha256; +function requireWebCryptoSha256() { + if (hasRequiredWebCryptoSha256) + return webCryptoSha256; + hasRequiredWebCryptoSha256 = 1; + Object.defineProperty(webCryptoSha256, "__esModule", { value: true }); + webCryptoSha256.Sha256 = void 0; + var util_1 = requireBuild$3(); + var constants_1 = requireConstants$1(); + var util_locate_window_1 = require$$5; + var Sha256 = ( + /** @class */ + function() { + function Sha2562(secret) { + this.toHash = new Uint8Array(0); + this.secret = secret; + this.reset(); + } + Sha2562.prototype.update = function(data) { + if ((0, util_1.isEmptyData)(data)) { + return; + } + var update5 = (0, util_1.convertToBuffer)(data); + var typedArray = new Uint8Array(this.toHash.byteLength + update5.byteLength); + typedArray.set(this.toHash, 0); + typedArray.set(update5, this.toHash.byteLength); + this.toHash = typedArray; + }; + Sha2562.prototype.digest = function() { + var _this = this; + if (this.key) { + return this.key.then(function(key2) { + return (0, util_locate_window_1.locateWindow)().crypto.subtle.sign(constants_1.SHA_256_HMAC_ALGO, key2, _this.toHash).then(function(data) { + return new Uint8Array(data); + }); + }); + } + if ((0, util_1.isEmptyData)(this.toHash)) { + return Promise.resolve(constants_1.EMPTY_DATA_SHA_256); + } + return Promise.resolve().then(function() { + return (0, util_locate_window_1.locateWindow)().crypto.subtle.digest(constants_1.SHA_256_HASH, _this.toHash); + }).then(function(data) { + return Promise.resolve(new Uint8Array(data)); + }); + }; + Sha2562.prototype.reset = function() { + var _this = this; + this.toHash = new Uint8Array(0); + if (this.secret && this.secret !== void 0) { + this.key = new Promise(function(resolve, reject) { + (0, util_locate_window_1.locateWindow)().crypto.subtle.importKey("raw", (0, util_1.convertToBuffer)(_this.secret), constants_1.SHA_256_HMAC_ALGO, false, ["sign"]).then(resolve, reject); + }); + this.key.catch(function() { + }); + } + }; + return Sha2562; + }() + ); + webCryptoSha256.Sha256 = Sha256; + return webCryptoSha256; } -function getSideAxis(placement) { - return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x"; +var build$2 = {}; +var jsSha256 = {}; +var constants = {}; +var hasRequiredConstants; +function requireConstants() { + if (hasRequiredConstants) + return constants; + hasRequiredConstants = 1; + Object.defineProperty(constants, "__esModule", { value: true }); + constants.MAX_HASHABLE_LENGTH = constants.INIT = constants.KEY = constants.DIGEST_LENGTH = constants.BLOCK_SIZE = void 0; + constants.BLOCK_SIZE = 64; + constants.DIGEST_LENGTH = 32; + constants.KEY = new Uint32Array([ + 1116352408, + 1899447441, + 3049323471, + 3921009573, + 961987163, + 1508970993, + 2453635748, + 2870763221, + 3624381080, + 310598401, + 607225278, + 1426881987, + 1925078388, + 2162078206, + 2614888103, + 3248222580, + 3835390401, + 4022224774, + 264347078, + 604807628, + 770255983, + 1249150122, + 1555081692, + 1996064986, + 2554220882, + 2821834349, + 2952996808, + 3210313671, + 3336571891, + 3584528711, + 113926993, + 338241895, + 666307205, + 773529912, + 1294757372, + 1396182291, + 1695183700, + 1986661051, + 2177026350, + 2456956037, + 2730485921, + 2820302411, + 3259730800, + 3345764771, + 3516065817, + 3600352804, + 4094571909, + 275423344, + 430227734, + 506948616, + 659060556, + 883997877, + 958139571, + 1322822218, + 1537002063, + 1747873779, + 1955562222, + 2024104815, + 2227730452, + 2361852424, + 2428436474, + 2756734187, + 3204031479, + 3329325298 + ]); + constants.INIT = [ + 1779033703, + 3144134277, + 1013904242, + 2773480762, + 1359893119, + 2600822924, + 528734635, + 1541459225 + ]; + constants.MAX_HASHABLE_LENGTH = Math.pow(2, 53) - 1; + return constants; } -function getAlignmentAxis(placement) { - return getOppositeAxis(getSideAxis(placement)); +var RawSha256 = {}; +var hasRequiredRawSha256; +function requireRawSha256() { + if (hasRequiredRawSha256) + return RawSha256; + hasRequiredRawSha256 = 1; + Object.defineProperty(RawSha256, "__esModule", { value: true }); + RawSha256.RawSha256 = void 0; + var constants_1 = requireConstants(); + var RawSha256$1 = ( + /** @class */ + function() { + function RawSha2562() { + this.state = Int32Array.from(constants_1.INIT); + this.temp = new Int32Array(64); + this.buffer = new Uint8Array(64); + this.bufferLength = 0; + this.bytesHashed = 0; + this.finished = false; + } + RawSha2562.prototype.update = function(data) { + if (this.finished) { + throw new Error("Attempted to update an already finished hash."); + } + var position = 0; + var byteLength2 = data.byteLength; + this.bytesHashed += byteLength2; + if (this.bytesHashed * 8 > constants_1.MAX_HASHABLE_LENGTH) { + throw new Error("Cannot hash more than 2^53 - 1 bits"); + } + while (byteLength2 > 0) { + this.buffer[this.bufferLength++] = data[position++]; + byteLength2--; + if (this.bufferLength === constants_1.BLOCK_SIZE) { + this.hashBuffer(); + this.bufferLength = 0; + } + } + }; + RawSha2562.prototype.digest = function() { + if (!this.finished) { + var bitsHashed = this.bytesHashed * 8; + var bufferView = new DataView(this.buffer.buffer, this.buffer.byteOffset, this.buffer.byteLength); + var undecoratedLength = this.bufferLength; + bufferView.setUint8(this.bufferLength++, 128); + if (undecoratedLength % constants_1.BLOCK_SIZE >= constants_1.BLOCK_SIZE - 8) { + for (var i = this.bufferLength; i < constants_1.BLOCK_SIZE; i++) { + bufferView.setUint8(i, 0); + } + this.hashBuffer(); + this.bufferLength = 0; + } + for (var i = this.bufferLength; i < constants_1.BLOCK_SIZE - 8; i++) { + bufferView.setUint8(i, 0); + } + bufferView.setUint32(constants_1.BLOCK_SIZE - 8, Math.floor(bitsHashed / 4294967296), true); + bufferView.setUint32(constants_1.BLOCK_SIZE - 4, bitsHashed); + this.hashBuffer(); + this.finished = true; + } + var out = new Uint8Array(constants_1.DIGEST_LENGTH); + for (var i = 0; i < 8; i++) { + out[i * 4] = this.state[i] >>> 24 & 255; + out[i * 4 + 1] = this.state[i] >>> 16 & 255; + out[i * 4 + 2] = this.state[i] >>> 8 & 255; + out[i * 4 + 3] = this.state[i] >>> 0 & 255; + } + return out; + }; + RawSha2562.prototype.hashBuffer = function() { + var _a2 = this, buffer2 = _a2.buffer, state = _a2.state; + var state0 = state[0], state1 = state[1], state2 = state[2], state3 = state[3], state4 = state[4], state5 = state[5], state6 = state[6], state7 = state[7]; + for (var i = 0; i < constants_1.BLOCK_SIZE; i++) { + if (i < 16) { + this.temp[i] = (buffer2[i * 4] & 255) << 24 | (buffer2[i * 4 + 1] & 255) << 16 | (buffer2[i * 4 + 2] & 255) << 8 | buffer2[i * 4 + 3] & 255; + } else { + var u2 = this.temp[i - 2]; + var t1_1 = (u2 >>> 17 | u2 << 15) ^ (u2 >>> 19 | u2 << 13) ^ u2 >>> 10; + u2 = this.temp[i - 15]; + var t2_1 = (u2 >>> 7 | u2 << 25) ^ (u2 >>> 18 | u2 << 14) ^ u2 >>> 3; + this.temp[i] = (t1_1 + this.temp[i - 7] | 0) + (t2_1 + this.temp[i - 16] | 0); + } + var t1 = (((state4 >>> 6 | state4 << 26) ^ (state4 >>> 11 | state4 << 21) ^ (state4 >>> 25 | state4 << 7)) + (state4 & state5 ^ ~state4 & state6) | 0) + (state7 + (constants_1.KEY[i] + this.temp[i] | 0) | 0) | 0; + var t2 = ((state0 >>> 2 | state0 << 30) ^ (state0 >>> 13 | state0 << 19) ^ (state0 >>> 22 | state0 << 10)) + (state0 & state1 ^ state0 & state2 ^ state1 & state2) | 0; + state7 = state6; + state6 = state5; + state5 = state4; + state4 = state3 + t1 | 0; + state3 = state2; + state2 = state1; + state1 = state0; + state0 = t1 + t2 | 0; + } + state[0] += state0; + state[1] += state1; + state[2] += state2; + state[3] += state3; + state[4] += state4; + state[5] += state5; + state[6] += state6; + state[7] += state7; + }; + return RawSha2562; + }() + ); + RawSha256.RawSha256 = RawSha256$1; + return RawSha256; } -function getAlignmentSides(placement, rects, rtl) { - if (rtl === void 0) { - rtl = false; - } - const alignment = getAlignment(placement); - const alignmentAxis = getAlignmentAxis(placement); - const length = getAxisLength(alignmentAxis); - let mainAlignmentSide = alignmentAxis === "x" ? alignment === (rtl ? "end" : "start") ? "right" : "left" : alignment === "start" ? "bottom" : "top"; - if (rects.reference[length] > rects.floating[length]) { - mainAlignmentSide = getOppositePlacement(mainAlignmentSide); +var hasRequiredJsSha256; +function requireJsSha256() { + if (hasRequiredJsSha256) + return jsSha256; + hasRequiredJsSha256 = 1; + Object.defineProperty(jsSha256, "__esModule", { value: true }); + jsSha256.Sha256 = void 0; + var tslib_1 = require$$0$1; + var constants_1 = requireConstants(); + var RawSha256_1 = requireRawSha256(); + var util_1 = requireBuild$3(); + var Sha256 = ( + /** @class */ + function() { + function Sha2562(secret) { + this.secret = secret; + this.hash = new RawSha256_1.RawSha256(); + this.reset(); + } + Sha2562.prototype.update = function(toHash) { + if ((0, util_1.isEmptyData)(toHash) || this.error) { + return; + } + try { + this.hash.update((0, util_1.convertToBuffer)(toHash)); + } catch (e2) { + this.error = e2; + } + }; + Sha2562.prototype.digestSync = function() { + if (this.error) { + throw this.error; + } + if (this.outer) { + if (!this.outer.finished) { + this.outer.update(this.hash.digest()); + } + return this.outer.digest(); + } + return this.hash.digest(); + }; + Sha2562.prototype.digest = function() { + return tslib_1.__awaiter(this, void 0, void 0, function() { + return tslib_1.__generator(this, function(_a2) { + return [2, this.digestSync()]; + }); + }); + }; + Sha2562.prototype.reset = function() { + this.hash = new RawSha256_1.RawSha256(); + if (this.secret) { + this.outer = new RawSha256_1.RawSha256(); + var inner = bufferFromSecret(this.secret); + var outer = new Uint8Array(constants_1.BLOCK_SIZE); + outer.set(inner); + for (var i = 0; i < constants_1.BLOCK_SIZE; i++) { + inner[i] ^= 54; + outer[i] ^= 92; + } + this.hash.update(inner); + this.outer.update(outer); + for (var i = 0; i < inner.byteLength; i++) { + inner[i] = 0; + } + } + }; + return Sha2562; + }() + ); + jsSha256.Sha256 = Sha256; + function bufferFromSecret(secret) { + var input2 = (0, util_1.convertToBuffer)(secret); + if (input2.byteLength > constants_1.BLOCK_SIZE) { + var bufferHash = new RawSha256_1.RawSha256(); + bufferHash.update(input2); + input2 = bufferHash.digest(); + } + var buffer2 = new Uint8Array(constants_1.BLOCK_SIZE); + buffer2.set(input2); + return buffer2; } - return [mainAlignmentSide, getOppositePlacement(mainAlignmentSide)]; -} -function getExpandedPlacements(placement) { - const oppositePlacement = getOppositePlacement(placement); - return [getOppositeAlignmentPlacement(placement), oppositePlacement, getOppositeAlignmentPlacement(oppositePlacement)]; + return jsSha256; } -function getOppositeAlignmentPlacement(placement) { - return placement.replace(/start|end/g, (alignment) => oppositeAlignmentMap[alignment]); +var hasRequiredBuild$2; +function requireBuild$2() { + if (hasRequiredBuild$2) + return build$2; + hasRequiredBuild$2 = 1; + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var tslib_1 = require$$0$1; + tslib_1.__exportStar(requireJsSha256(), exports); + })(build$2); + return build$2; } -function getSideList(side, isStart, rtl) { - const lr = ["left", "right"]; - const rl2 = ["right", "left"]; - const tb2 = ["top", "bottom"]; - const bt = ["bottom", "top"]; - switch (side) { - case "top": - case "bottom": - if (rtl) - return isStart ? rl2 : lr; - return isStart ? lr : rl2; - case "left": - case "right": - return isStart ? tb2 : bt; - default: - return []; +var build$1 = {}; +var supportsWebCrypto = {}; +var hasRequiredSupportsWebCrypto; +function requireSupportsWebCrypto() { + if (hasRequiredSupportsWebCrypto) + return supportsWebCrypto; + hasRequiredSupportsWebCrypto = 1; + Object.defineProperty(supportsWebCrypto, "__esModule", { value: true }); + supportsWebCrypto.supportsZeroByteGCM = supportsWebCrypto.supportsSubtleCrypto = supportsWebCrypto.supportsSecureRandom = supportsWebCrypto.supportsWebCrypto = void 0; + var tslib_1 = require$$0$1; + var subtleCryptoMethods = [ + "decrypt", + "digest", + "encrypt", + "exportKey", + "generateKey", + "importKey", + "sign", + "verify" + ]; + function supportsWebCrypto$1(window2) { + if (supportsSecureRandom(window2) && typeof window2.crypto.subtle === "object") { + var subtle = window2.crypto.subtle; + return supportsSubtleCrypto(subtle); + } + return false; } -} -function getOppositeAxisPlacements(placement, flipAlignment, direction, rtl) { - const alignment = getAlignment(placement); - let list2 = getSideList(getSide(placement), direction === "start", rtl); - if (alignment) { - list2 = list2.map((side) => side + "-" + alignment); - if (flipAlignment) { - list2 = list2.concat(list2.map(getOppositeAlignmentPlacement)); + supportsWebCrypto.supportsWebCrypto = supportsWebCrypto$1; + function supportsSecureRandom(window2) { + if (typeof window2 === "object" && typeof window2.crypto === "object") { + var getRandomValues2 = window2.crypto.getRandomValues; + return typeof getRandomValues2 === "function"; } + return false; } - return list2; -} -function getOppositePlacement(placement) { - return placement.replace(/left|right|bottom|top/g, (side) => oppositeSideMap[side]); + supportsWebCrypto.supportsSecureRandom = supportsSecureRandom; + function supportsSubtleCrypto(subtle) { + return subtle && subtleCryptoMethods.every(function(methodName) { + return typeof subtle[methodName] === "function"; + }); + } + supportsWebCrypto.supportsSubtleCrypto = supportsSubtleCrypto; + function supportsZeroByteGCM(subtle) { + return tslib_1.__awaiter(this, void 0, void 0, function() { + var key2, zeroByteAuthTag; + return tslib_1.__generator(this, function(_b2) { + switch (_b2.label) { + case 0: + if (!supportsSubtleCrypto(subtle)) + return [2, false]; + _b2.label = 1; + case 1: + _b2.trys.push([1, 4, , 5]); + return [4, subtle.generateKey({ name: "AES-GCM", length: 128 }, false, ["encrypt"])]; + case 2: + key2 = _b2.sent(); + return [4, subtle.encrypt({ + name: "AES-GCM", + iv: new Uint8Array(Array(12)), + additionalData: new Uint8Array(Array(16)), + tagLength: 128 + }, key2, new Uint8Array(0))]; + case 3: + zeroByteAuthTag = _b2.sent(); + return [2, zeroByteAuthTag.byteLength === 16]; + case 4: + _b2.sent(); + return [2, false]; + case 5: + return [ + 2 + /*return*/ + ]; + } + }); + }); + } + supportsWebCrypto.supportsZeroByteGCM = supportsZeroByteGCM; + return supportsWebCrypto; } -function expandPaddingObject(padding2) { - return { - top: 0, - right: 0, - bottom: 0, - left: 0, - ...padding2 - }; +var hasRequiredBuild$1; +function requireBuild$1() { + if (hasRequiredBuild$1) + return build$1; + hasRequiredBuild$1 = 1; + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var tslib_1 = require$$0$1; + tslib_1.__exportStar(requireSupportsWebCrypto(), exports); + })(build$1); + return build$1; } -function getPaddingObject(padding2) { - return typeof padding2 !== "number" ? expandPaddingObject(padding2) : { - top: padding2, - right: padding2, - bottom: padding2, - left: padding2 - }; +var build = {}; +var CryptoOperation = {}; +var hasRequiredCryptoOperation; +function requireCryptoOperation() { + if (hasRequiredCryptoOperation) + return CryptoOperation; + hasRequiredCryptoOperation = 1; + Object.defineProperty(CryptoOperation, "__esModule", { value: true }); + return CryptoOperation; } -function rectToClientRect(rect) { - const { - x, - y: y2, - width, - height - } = rect; - return { - width, - height, - top: y2, - left: x, - right: x + width, - bottom: y2 + height, - x, - y: y2 - }; +var Key = {}; +var hasRequiredKey; +function requireKey() { + if (hasRequiredKey) + return Key; + hasRequiredKey = 1; + Object.defineProperty(Key, "__esModule", { value: true }); + return Key; } -function computeCoordsFromPlacement(_ref, placement, rtl) { - let { - reference, - floating - } = _ref; - const sideAxis = getSideAxis(placement); - const alignmentAxis = getAlignmentAxis(placement); - const alignLength = getAxisLength(alignmentAxis); - const side = getSide(placement); - const isVertical = sideAxis === "y"; - const commonX = reference.x + reference.width / 2 - floating.width / 2; - const commonY = reference.y + reference.height / 2 - floating.height / 2; - const commonAlign = reference[alignLength] / 2 - floating[alignLength] / 2; - let coords; - switch (side) { - case "top": - coords = { - x: commonX, - y: reference.y - floating.height - }; - break; - case "bottom": - coords = { - x: commonX, - y: reference.y + reference.height - }; - break; - case "right": - coords = { - x: reference.x + reference.width, - y: commonY - }; - break; - case "left": - coords = { - x: reference.x - floating.width, - y: commonY - }; - break; - default: - coords = { - x: reference.x, - y: reference.y - }; +var KeyOperation = {}; +var hasRequiredKeyOperation; +function requireKeyOperation() { + if (hasRequiredKeyOperation) + return KeyOperation; + hasRequiredKeyOperation = 1; + Object.defineProperty(KeyOperation, "__esModule", { value: true }); + return KeyOperation; +} +var MsSubtleCrypto = {}; +var hasRequiredMsSubtleCrypto; +function requireMsSubtleCrypto() { + if (hasRequiredMsSubtleCrypto) + return MsSubtleCrypto; + hasRequiredMsSubtleCrypto = 1; + Object.defineProperty(MsSubtleCrypto, "__esModule", { value: true }); + return MsSubtleCrypto; +} +var MsWindow = {}; +var hasRequiredMsWindow; +function requireMsWindow() { + if (hasRequiredMsWindow) + return MsWindow; + hasRequiredMsWindow = 1; + Object.defineProperty(MsWindow, "__esModule", { value: true }); + MsWindow.isMsWindow = void 0; + var msSubtleCryptoMethods = [ + "decrypt", + "digest", + "encrypt", + "exportKey", + "generateKey", + "importKey", + "sign", + "verify" + ]; + function quacksLikeAnMsWindow(window2) { + return "MSInputMethodContext" in window2 && "msCrypto" in window2; } - switch (getAlignment(placement)) { - case "start": - coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1); - break; - case "end": - coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1); - break; + function isMsWindow(window2) { + if (quacksLikeAnMsWindow(window2) && window2.msCrypto.subtle !== void 0) { + var _a2 = window2.msCrypto, getRandomValues2 = _a2.getRandomValues, subtle_1 = _a2.subtle; + return msSubtleCryptoMethods.map(function(methodName) { + return subtle_1[methodName]; + }).concat(getRandomValues2).every(function(method) { + return typeof method === "function"; + }); + } + return false; } - return coords; + MsWindow.isMsWindow = isMsWindow; + return MsWindow; } -const computePosition$1 = async (reference, floating, config2) => { - const { - placement = "bottom", - strategy = "absolute", - middleware = [], - platform: platform2 - } = config2; - const validMiddleware = middleware.filter(Boolean); - const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating)); - let rects = await platform2.getElementRects({ - reference, - floating, - strategy - }); - let { - x, - y: y2 - } = computeCoordsFromPlacement(rects, placement, rtl); - let statefulPlacement = placement; - let middlewareData = {}; - let resetCount = 0; - for (let i2 = 0; i2 < validMiddleware.length; i2++) { - const { - name: name2, - fn - } = validMiddleware[i2]; - const { - x: nextX, - y: nextY, - data, - reset - } = await fn({ - x, - y: y2, - initialPlacement: placement, - placement: statefulPlacement, - strategy, - middlewareData, - rects, - platform: platform2, - elements: { - reference, - floating - } - }); - x = nextX != null ? nextX : x; - y2 = nextY != null ? nextY : y2; - middlewareData = { - ...middlewareData, - [name2]: { - ...middlewareData[name2], - ...data - } - }; - if (reset && resetCount <= 50) { - resetCount++; - if (typeof reset === "object") { - if (reset.placement) { - statefulPlacement = reset.placement; - } - if (reset.rects) { - rects = reset.rects === true ? await platform2.getElementRects({ - reference, - floating, - strategy - }) : reset.rects; +var hasRequiredBuild; +function requireBuild() { + if (hasRequiredBuild) + return build; + hasRequiredBuild = 1; + (function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + var tslib_1 = require$$0$1; + tslib_1.__exportStar(requireCryptoOperation(), exports); + tslib_1.__exportStar(requireKey(), exports); + tslib_1.__exportStar(requireKeyOperation(), exports); + tslib_1.__exportStar(requireMsSubtleCrypto(), exports); + tslib_1.__exportStar(requireMsWindow(), exports); + })(build); + return build; +} +var hasRequiredCrossPlatformSha256; +function requireCrossPlatformSha256() { + if (hasRequiredCrossPlatformSha256) + return crossPlatformSha256; + hasRequiredCrossPlatformSha256 = 1; + Object.defineProperty(crossPlatformSha256, "__esModule", { value: true }); + crossPlatformSha256.Sha256 = void 0; + var ie11Sha256_1 = requireIe11Sha256(); + var webCryptoSha256_1 = requireWebCryptoSha256(); + var sha256_js_1 = requireBuild$2(); + var supports_web_crypto_1 = requireBuild$1(); + var ie11_detection_1 = requireBuild(); + var util_locate_window_1 = require$$5; + var util_1 = requireBuild$3(); + var Sha256 = ( + /** @class */ + function() { + function Sha2562(secret) { + if ((0, supports_web_crypto_1.supportsWebCrypto)((0, util_locate_window_1.locateWindow)())) { + this.hash = new webCryptoSha256_1.Sha256(secret); + } else if ((0, ie11_detection_1.isMsWindow)((0, util_locate_window_1.locateWindow)())) { + this.hash = new ie11Sha256_1.Sha256(secret); + } else { + this.hash = new sha256_js_1.Sha256(secret); } - ({ - x, - y: y2 - } = computeCoordsFromPlacement(rects, statefulPlacement, rtl)); } - i2 = -1; - } - } - return { - x, - y: y2, - placement: statefulPlacement, - strategy, - middlewareData - }; + Sha2562.prototype.update = function(data, encoding) { + this.hash.update((0, util_1.convertToBuffer)(data)); + }; + Sha2562.prototype.digest = function() { + return this.hash.digest(); + }; + Sha2562.prototype.reset = function() { + this.hash.reset(); + }; + return Sha2562; + }() + ); + crossPlatformSha256.Sha256 = Sha256; + return crossPlatformSha256; +} +(function(exports) { + Object.defineProperty(exports, "__esModule", { value: true }); + exports.WebCryptoSha256 = exports.Ie11Sha256 = void 0; + var tslib_1 = require$$0$1; + tslib_1.__exportStar(requireCrossPlatformSha256(), exports); + var ie11Sha256_1 = requireIe11Sha256(); + Object.defineProperty(exports, "Ie11Sha256", { enumerable: true, get: function() { + return ie11Sha256_1.Sha256; + } }); + var webCryptoSha256_1 = requireWebCryptoSha256(); + Object.defineProperty(exports, "WebCryptoSha256", { enumerable: true, get: function() { + return webCryptoSha256_1.Sha256; + } }); +})(build$4); +const BROWSER_ALIASES_MAP = { + "Amazon Silk": "amazon_silk", + "Android Browser": "android", + Bada: "bada", + BlackBerry: "blackberry", + Chrome: "chrome", + Chromium: "chromium", + Electron: "electron", + Epiphany: "epiphany", + Firefox: "firefox", + Focus: "focus", + Generic: "generic", + "Google Search": "google_search", + Googlebot: "googlebot", + "Internet Explorer": "ie", + "K-Meleon": "k_meleon", + Maxthon: "maxthon", + "Microsoft Edge": "edge", + "MZ Browser": "mz", + "NAVER Whale Browser": "naver", + Opera: "opera", + "Opera Coast": "opera_coast", + PhantomJS: "phantomjs", + Puffin: "puffin", + QupZilla: "qupzilla", + QQ: "qq", + QQLite: "qqlite", + Safari: "safari", + Sailfish: "sailfish", + "Samsung Internet for Android": "samsung_internet", + SeaMonkey: "seamonkey", + Sleipnir: "sleipnir", + Swing: "swing", + Tizen: "tizen", + "UC Browser": "uc", + Vivaldi: "vivaldi", + "WebOS Browser": "webos", + WeChat: "wechat", + "Yandex Browser": "yandex", + Roku: "roku" }; -async function detectOverflow(state, options) { - var _await$platform$isEle; - if (options === void 0) { - options = {}; +const BROWSER_MAP = { + amazon_silk: "Amazon Silk", + android: "Android Browser", + bada: "Bada", + blackberry: "BlackBerry", + chrome: "Chrome", + chromium: "Chromium", + electron: "Electron", + epiphany: "Epiphany", + firefox: "Firefox", + focus: "Focus", + generic: "Generic", + googlebot: "Googlebot", + google_search: "Google Search", + ie: "Internet Explorer", + k_meleon: "K-Meleon", + maxthon: "Maxthon", + edge: "Microsoft Edge", + mz: "MZ Browser", + naver: "NAVER Whale Browser", + opera: "Opera", + opera_coast: "Opera Coast", + phantomjs: "PhantomJS", + puffin: "Puffin", + qupzilla: "QupZilla", + qq: "QQ Browser", + qqlite: "QQ Browser Lite", + safari: "Safari", + sailfish: "Sailfish", + samsung_internet: "Samsung Internet for Android", + seamonkey: "SeaMonkey", + sleipnir: "Sleipnir", + swing: "Swing", + tizen: "Tizen", + uc: "UC Browser", + vivaldi: "Vivaldi", + webos: "WebOS Browser", + wechat: "WeChat", + yandex: "Yandex Browser" +}; +const PLATFORMS_MAP = { + tablet: "tablet", + mobile: "mobile", + desktop: "desktop", + tv: "tv" +}; +const OS_MAP = { + WindowsPhone: "Windows Phone", + Windows: "Windows", + MacOS: "macOS", + iOS: "iOS", + Android: "Android", + WebOS: "WebOS", + BlackBerry: "BlackBerry", + Bada: "Bada", + Tizen: "Tizen", + Linux: "Linux", + ChromeOS: "Chrome OS", + PlayStation4: "PlayStation 4", + Roku: "Roku" +}; +const ENGINE_MAP = { + EdgeHTML: "EdgeHTML", + Blink: "Blink", + Trident: "Trident", + Presto: "Presto", + Gecko: "Gecko", + WebKit: "WebKit" +}; +class Utils { + /** + * Get first matched item for a string + * @param {RegExp} regexp + * @param {String} ua + * @return {Array|{index: number, input: string}|*|boolean|string} + */ + static getFirstMatch(regexp, ua2) { + const match = ua2.match(regexp); + return match && match.length > 0 && match[1] || ""; } - const { - x, - y: y2, - platform: platform2, - rects, - elements, - strategy - } = state; - const { - boundary = "clippingAncestors", - rootBoundary = "viewport", - elementContext = "floating", - altBoundary = false, - padding: padding2 = 0 - } = evaluate(options, state); - const paddingObject = getPaddingObject(padding2); - const altContext = elementContext === "floating" ? "reference" : "floating"; - const element = elements[altBoundary ? altContext : elementContext]; - const clippingClientRect = rectToClientRect(await platform2.getClippingRect({ - element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)), - boundary, - rootBoundary, - strategy - })); - const rect = elementContext === "floating" ? { - x, - y: y2, - width: rects.floating.width, - height: rects.floating.height - } : rects.reference; - const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating)); - const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || { - x: 1, - y: 1 - } : { - x: 1, - y: 1 - }; - const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({ - elements, - rect, - offsetParent, - strategy - }) : rect); - return { - top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y, - bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y, - left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x, - right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x - }; -} -const arrow$3 = (options) => ({ - name: "arrow", - options, - async fn(state) { - const { - x, - y: y2, - placement, - rects, - platform: platform2, - elements, - middlewareData - } = state; - const { - element, - padding: padding2 = 0 - } = evaluate(options, state) || {}; - if (element == null) { - return {}; + /** + * Get second matched item for a string + * @param regexp + * @param {String} ua + * @return {Array|{index: number, input: string}|*|boolean|string} + */ + static getSecondMatch(regexp, ua2) { + const match = ua2.match(regexp); + return match && match.length > 1 && match[2] || ""; + } + /** + * Match a regexp and return a constant or undefined + * @param {RegExp} regexp + * @param {String} ua + * @param {*} _const Any const that will be returned if regexp matches the string + * @return {*} + */ + static matchAndReturnConst(regexp, ua2, _const) { + if (regexp.test(ua2)) { + return _const; } - const paddingObject = getPaddingObject(padding2); - const coords = { - x, - y: y2 - }; - const axis = getAlignmentAxis(placement); - const length = getAxisLength(axis); - const arrowDimensions = await platform2.getDimensions(element); - const isYAxis = axis === "y"; - const minProp = isYAxis ? "top" : "left"; - const maxProp = isYAxis ? "bottom" : "right"; - const clientProp = isYAxis ? "clientHeight" : "clientWidth"; - const endDiff = rects.reference[length] + rects.reference[axis] - coords[axis] - rects.floating[length]; - const startDiff = coords[axis] - rects.reference[axis]; - const arrowOffsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(element)); - let clientSize = arrowOffsetParent ? arrowOffsetParent[clientProp] : 0; - if (!clientSize || !await (platform2.isElement == null ? void 0 : platform2.isElement(arrowOffsetParent))) { - clientSize = elements.floating[clientProp] || rects.floating[length]; + return void 0; + } + static getWindowsVersionName(version2) { + switch (version2) { + case "NT": + return "NT"; + case "XP": + return "XP"; + case "NT 5.0": + return "2000"; + case "NT 5.1": + return "XP"; + case "NT 5.2": + return "2003"; + case "NT 6.0": + return "Vista"; + case "NT 6.1": + return "7"; + case "NT 6.2": + return "8"; + case "NT 6.3": + return "8.1"; + case "NT 10.0": + return "10"; + default: + return void 0; } - const centerToReference = endDiff / 2 - startDiff / 2; - const largestPossiblePadding = clientSize / 2 - arrowDimensions[length] / 2 - 1; - const minPadding = min(paddingObject[minProp], largestPossiblePadding); - const maxPadding = min(paddingObject[maxProp], largestPossiblePadding); - const min$12 = minPadding; - const max2 = clientSize - arrowDimensions[length] - maxPadding; - const center = clientSize / 2 - arrowDimensions[length] / 2 + centerToReference; - const offset2 = clamp(min$12, center, max2); - const shouldAddOffset = !middlewareData.arrow && getAlignment(placement) != null && center !== offset2 && rects.reference[length] / 2 - (center < min$12 ? minPadding : maxPadding) - arrowDimensions[length] / 2 < 0; - const alignmentOffset = shouldAddOffset ? center < min$12 ? center - min$12 : center - max2 : 0; - return { - [axis]: coords[axis] + alignmentOffset, - data: { - [axis]: offset2, - centerOffset: center - offset2 - alignmentOffset, - ...shouldAddOffset && { - alignmentOffset - } - }, - reset: shouldAddOffset - }; } -}); -const flip$2 = function(options) { - if (options === void 0) { - options = {}; + /** + * Get macOS version name + * 10.5 - Leopard + * 10.6 - Snow Leopard + * 10.7 - Lion + * 10.8 - Mountain Lion + * 10.9 - Mavericks + * 10.10 - Yosemite + * 10.11 - El Capitan + * 10.12 - Sierra + * 10.13 - High Sierra + * 10.14 - Mojave + * 10.15 - Catalina + * + * @example + * getMacOSVersionName("10.14") // 'Mojave' + * + * @param {string} version + * @return {string} versionName + */ + static getMacOSVersionName(version2) { + const v3 = version2.split(".").splice(0, 2).map((s2) => parseInt(s2, 10) || 0); + v3.push(0); + if (v3[0] !== 10) + return void 0; + switch (v3[1]) { + case 5: + return "Leopard"; + case 6: + return "Snow Leopard"; + case 7: + return "Lion"; + case 8: + return "Mountain Lion"; + case 9: + return "Mavericks"; + case 10: + return "Yosemite"; + case 11: + return "El Capitan"; + case 12: + return "Sierra"; + case 13: + return "High Sierra"; + case 14: + return "Mojave"; + case 15: + return "Catalina"; + default: + return void 0; + } } - return { - name: "flip", - options, - async fn(state) { - var _middlewareData$arrow, _middlewareData$flip; - const { - placement, - middlewareData, - rects, - initialPlacement, - platform: platform2, - elements - } = state; - const { - mainAxis: checkMainAxis = true, - crossAxis: checkCrossAxis = true, - fallbackPlacements: specifiedFallbackPlacements, - fallbackStrategy = "bestFit", - fallbackAxisSideDirection = "none", - flipAlignment = true, - ...detectOverflowOptions - } = evaluate(options, state); - if ((_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { - return {}; - } - const side = getSide(placement); - const isBasePlacement = getSide(initialPlacement) === initialPlacement; - const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); - const fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipAlignment ? [getOppositePlacement(initialPlacement)] : getExpandedPlacements(initialPlacement)); - if (!specifiedFallbackPlacements && fallbackAxisSideDirection !== "none") { - fallbackPlacements.push(...getOppositeAxisPlacements(initialPlacement, flipAlignment, fallbackAxisSideDirection, rtl)); - } - const placements = [initialPlacement, ...fallbackPlacements]; - const overflow = await detectOverflow(state, detectOverflowOptions); - const overflows = []; - let overflowsData = ((_middlewareData$flip = middlewareData.flip) == null ? void 0 : _middlewareData$flip.overflows) || []; - if (checkMainAxis) { - overflows.push(overflow[side]); - } - if (checkCrossAxis) { - const sides2 = getAlignmentSides(placement, rects, rtl); - overflows.push(overflow[sides2[0]], overflow[sides2[1]]); + /** + * Get Android version name + * 1.5 - Cupcake + * 1.6 - Donut + * 2.0 - Eclair + * 2.1 - Eclair + * 2.2 - Froyo + * 2.x - Gingerbread + * 3.x - Honeycomb + * 4.0 - Ice Cream Sandwich + * 4.1 - Jelly Bean + * 4.4 - KitKat + * 5.x - Lollipop + * 6.x - Marshmallow + * 7.x - Nougat + * 8.x - Oreo + * 9.x - Pie + * + * @example + * getAndroidVersionName("7.0") // 'Nougat' + * + * @param {string} version + * @return {string} versionName + */ + static getAndroidVersionName(version2) { + const v3 = version2.split(".").splice(0, 2).map((s2) => parseInt(s2, 10) || 0); + v3.push(0); + if (v3[0] === 1 && v3[1] < 5) + return void 0; + if (v3[0] === 1 && v3[1] < 6) + return "Cupcake"; + if (v3[0] === 1 && v3[1] >= 6) + return "Donut"; + if (v3[0] === 2 && v3[1] < 2) + return "Eclair"; + if (v3[0] === 2 && v3[1] === 2) + return "Froyo"; + if (v3[0] === 2 && v3[1] > 2) + return "Gingerbread"; + if (v3[0] === 3) + return "Honeycomb"; + if (v3[0] === 4 && v3[1] < 1) + return "Ice Cream Sandwich"; + if (v3[0] === 4 && v3[1] < 4) + return "Jelly Bean"; + if (v3[0] === 4 && v3[1] >= 4) + return "KitKat"; + if (v3[0] === 5) + return "Lollipop"; + if (v3[0] === 6) + return "Marshmallow"; + if (v3[0] === 7) + return "Nougat"; + if (v3[0] === 8) + return "Oreo"; + if (v3[0] === 9) + return "Pie"; + return void 0; + } + /** + * Get version precisions count + * + * @example + * getVersionPrecision("1.10.3") // 3 + * + * @param {string} version + * @return {number} + */ + static getVersionPrecision(version2) { + return version2.split(".").length; + } + /** + * Calculate browser version weight + * + * @example + * compareVersions('1.10.2.1', '1.8.2.1.90') // 1 + * compareVersions('1.010.2.1', '1.09.2.1.90'); // 1 + * compareVersions('1.10.2.1', '1.10.2.1'); // 0 + * compareVersions('1.10.2.1', '1.0800.2'); // -1 + * compareVersions('1.10.2.1', '1.10', true); // 0 + * + * @param {String} versionA versions versions to compare + * @param {String} versionB versions versions to compare + * @param {boolean} [isLoose] enable loose comparison + * @return {Number} comparison result: -1 when versionA is lower, + * 1 when versionA is bigger, 0 when both equal + */ + /* eslint consistent-return: 1 */ + static compareVersions(versionA, versionB, isLoose = false) { + const versionAPrecision = Utils.getVersionPrecision(versionA); + const versionBPrecision = Utils.getVersionPrecision(versionB); + let precision = Math.max(versionAPrecision, versionBPrecision); + let lastPrecision = 0; + const chunks = Utils.map([versionA, versionB], (version2) => { + const delta = precision - Utils.getVersionPrecision(version2); + const _version = version2 + new Array(delta + 1).join(".0"); + return Utils.map(_version.split("."), (chunk) => new Array(20 - chunk.length).join("0") + chunk).reverse(); + }); + if (isLoose) { + lastPrecision = precision - Math.min(versionAPrecision, versionBPrecision); + } + precision -= 1; + while (precision >= lastPrecision) { + if (chunks[0][precision] > chunks[1][precision]) { + return 1; } - overflowsData = [...overflowsData, { - placement, - overflows - }]; - if (!overflows.every((side2) => side2 <= 0)) { - var _middlewareData$flip2, _overflowsData$filter; - const nextIndex = (((_middlewareData$flip2 = middlewareData.flip) == null ? void 0 : _middlewareData$flip2.index) || 0) + 1; - const nextPlacement = placements[nextIndex]; - if (nextPlacement) { - return { - data: { - index: nextIndex, - overflows: overflowsData - }, - reset: { - placement: nextPlacement - } - }; - } - let resetPlacement = (_overflowsData$filter = overflowsData.filter((d2) => d2.overflows[0] <= 0).sort((a2, b2) => a2.overflows[1] - b2.overflows[1])[0]) == null ? void 0 : _overflowsData$filter.placement; - if (!resetPlacement) { - switch (fallbackStrategy) { - case "bestFit": { - var _overflowsData$map$so; - const placement2 = (_overflowsData$map$so = overflowsData.map((d2) => [d2.placement, d2.overflows.filter((overflow2) => overflow2 > 0).reduce((acc, overflow2) => acc + overflow2, 0)]).sort((a2, b2) => a2[1] - b2[1])[0]) == null ? void 0 : _overflowsData$map$so[0]; - if (placement2) { - resetPlacement = placement2; - } - break; - } - case "initialPlacement": - resetPlacement = initialPlacement; - break; - } - } - if (placement !== resetPlacement) { - return { - reset: { - placement: resetPlacement - } - }; + if (chunks[0][precision] === chunks[1][precision]) { + if (precision === lastPrecision) { + return 0; } + precision -= 1; + } else if (chunks[0][precision] < chunks[1][precision]) { + return -1; } - return {}; } - }; -}; -function getSideOffsets(overflow, rect) { - return { - top: overflow.top - rect.height, - right: overflow.right - rect.width, - bottom: overflow.bottom - rect.height, - left: overflow.left - rect.width - }; -} -function isAnySideFullyClipped(overflow) { - return sides.some((side) => overflow[side] >= 0); -} -const hide$2 = function(options) { - if (options === void 0) { - options = {}; + return void 0; } - return { - name: "hide", - options, - async fn(state) { - const { - rects - } = state; - const { - strategy = "referenceHidden", - ...detectOverflowOptions - } = evaluate(options, state); - switch (strategy) { - case "referenceHidden": { - const overflow = await detectOverflow(state, { - ...detectOverflowOptions, - elementContext: "reference" - }); - const offsets = getSideOffsets(overflow, rects.reference); - return { - data: { - referenceHiddenOffsets: offsets, - referenceHidden: isAnySideFullyClipped(offsets) - } - }; - } - case "escaped": { - const overflow = await detectOverflow(state, { - ...detectOverflowOptions, - altBoundary: true - }); - const offsets = getSideOffsets(overflow, rects.floating); - return { - data: { - escapedOffsets: offsets, - escaped: isAnySideFullyClipped(offsets) - } - }; - } - default: { - return {}; - } - } + /** + * Array::map polyfill + * + * @param {Array} arr + * @param {Function} iterator + * @return {Array} + */ + static map(arr, iterator) { + const result = []; + let i; + if (Array.prototype.map) { + return Array.prototype.map.call(arr, iterator); } - }; -}; -async function convertValueToCoords(state, options) { - const { - placement, - platform: platform2, - elements - } = state; - const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)); - const side = getSide(placement); - const alignment = getAlignment(placement); - const isVertical = getSideAxis(placement) === "y"; - const mainAxisMulti = ["left", "top"].includes(side) ? -1 : 1; - const crossAxisMulti = rtl && isVertical ? -1 : 1; - const rawValue = evaluate(options, state); - let { - mainAxis, - crossAxis, - alignmentAxis - } = typeof rawValue === "number" ? { - mainAxis: rawValue, - crossAxis: 0, - alignmentAxis: null - } : { - mainAxis: 0, - crossAxis: 0, - alignmentAxis: null, - ...rawValue - }; - if (alignment && typeof alignmentAxis === "number") { - crossAxis = alignment === "end" ? alignmentAxis * -1 : alignmentAxis; + for (i = 0; i < arr.length; i += 1) { + result.push(iterator(arr[i])); + } + return result; } - return isVertical ? { - x: crossAxis * crossAxisMulti, - y: mainAxis * mainAxisMulti - } : { - x: mainAxis * mainAxisMulti, - y: crossAxis * crossAxisMulti - }; -} -const offset$2 = function(options) { - if (options === void 0) { - options = 0; + /** + * Array::find polyfill + * + * @param {Array} arr + * @param {Function} predicate + * @return {Array} + */ + static find(arr, predicate) { + let i; + let l2; + if (Array.prototype.find) { + return Array.prototype.find.call(arr, predicate); + } + for (i = 0, l2 = arr.length; i < l2; i += 1) { + const value = arr[i]; + if (predicate(value, i)) { + return value; + } + } + return void 0; } - return { - name: "offset", - options, - async fn(state) { - var _middlewareData$offse, _middlewareData$arrow; - const { - x, - y: y2, - placement, - middlewareData - } = state; - const diffCoords = await convertValueToCoords(state, options); - if (placement === ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse.placement) && (_middlewareData$arrow = middlewareData.arrow) != null && _middlewareData$arrow.alignmentOffset) { - return {}; + /** + * Object::assign polyfill + * + * @param {Object} obj + * @param {Object} ...objs + * @return {Object} + */ + static assign(obj, ...assigners) { + const result = obj; + let i; + let l2; + if (Object.assign) { + return Object.assign(obj, ...assigners); + } + for (i = 0, l2 = assigners.length; i < l2; i += 1) { + const assigner = assigners[i]; + if (typeof assigner === "object" && assigner !== null) { + const keys = Object.keys(assigner); + keys.forEach((key2) => { + result[key2] = assigner[key2]; + }); } - return { - x: x + diffCoords.x, - y: y2 + diffCoords.y, - data: { - ...diffCoords, - placement - } - }; } - }; -}; -const shift$2 = function(options) { - if (options === void 0) { - options = {}; + return obj; } - return { - name: "shift", - options, - async fn(state) { - const { - x, - y: y2, - placement - } = state; - const { - mainAxis: checkMainAxis = true, - crossAxis: checkCrossAxis = false, - limiter = { - fn: (_ref) => { - let { - x: x2, - y: y3 - } = _ref; - return { - x: x2, - y: y3 - }; - } - }, - ...detectOverflowOptions - } = evaluate(options, state); - const coords = { - x, - y: y2 - }; - const overflow = await detectOverflow(state, detectOverflowOptions); - const crossAxis = getSideAxis(getSide(placement)); - const mainAxis = getOppositeAxis(crossAxis); - let mainAxisCoord = coords[mainAxis]; - let crossAxisCoord = coords[crossAxis]; - if (checkMainAxis) { - const minSide = mainAxis === "y" ? "top" : "left"; - const maxSide = mainAxis === "y" ? "bottom" : "right"; - const min2 = mainAxisCoord + overflow[minSide]; - const max2 = mainAxisCoord - overflow[maxSide]; - mainAxisCoord = clamp(min2, mainAxisCoord, max2); - } - if (checkCrossAxis) { - const minSide = crossAxis === "y" ? "top" : "left"; - const maxSide = crossAxis === "y" ? "bottom" : "right"; - const min2 = crossAxisCoord + overflow[minSide]; - const max2 = crossAxisCoord - overflow[maxSide]; - crossAxisCoord = clamp(min2, crossAxisCoord, max2); - } - const limitedCoords = limiter.fn({ - ...state, - [mainAxis]: mainAxisCoord, - [crossAxis]: crossAxisCoord - }); - return { - ...limitedCoords, - data: { - x: limitedCoords.x - x, - y: limitedCoords.y - y2 - } + /** + * Get short version/alias for a browser name + * + * @example + * getBrowserAlias('Microsoft Edge') // edge + * + * @param {string} browserName + * @return {string} + */ + static getBrowserAlias(browserName) { + return BROWSER_ALIASES_MAP[browserName]; + } + /** + * Get short version/alias for a browser name + * + * @example + * getBrowserAlias('edge') // Microsoft Edge + * + * @param {string} browserAlias + * @return {string} + */ + static getBrowserTypeByAlias(browserAlias) { + return BROWSER_MAP[browserAlias] || ""; + } +} +const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i; +const browsersList = [ + /* Googlebot */ + { + test: [/googlebot/i], + describe(ua2) { + const browser2 = { + name: "Googlebot" }; + const version2 = Utils.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, ua2) || Utils.getFirstMatch(commonVersionIdentifier, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - }; -}; -const limitShift$2 = function(options) { - if (options === void 0) { - options = {}; - } - return { - options, - fn(state) { - const { - x, - y: y2, - placement, - rects, - middlewareData - } = state; - const { - offset: offset2 = 0, - mainAxis: checkMainAxis = true, - crossAxis: checkCrossAxis = true - } = evaluate(options, state); - const coords = { - x, - y: y2 + }, + /* Opera < 13.0 */ + { + test: [/opera/i], + describe(ua2) { + const browser2 = { + name: "Opera" }; - const crossAxis = getSideAxis(placement); - const mainAxis = getOppositeAxis(crossAxis); - let mainAxisCoord = coords[mainAxis]; - let crossAxisCoord = coords[crossAxis]; - const rawOffset = evaluate(offset2, state); - const computedOffset = typeof rawOffset === "number" ? { - mainAxis: rawOffset, - crossAxis: 0 - } : { - mainAxis: 0, - crossAxis: 0, - ...rawOffset + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; + } + }, + /* Opera > 13.0 */ + { + test: [/opr\/|opios/i], + describe(ua2) { + const browser2 = { + name: "Opera" }; - if (checkMainAxis) { - const len = mainAxis === "y" ? "height" : "width"; - const limitMin = rects.reference[mainAxis] - rects.floating[len] + computedOffset.mainAxis; - const limitMax = rects.reference[mainAxis] + rects.reference[len] - computedOffset.mainAxis; - if (mainAxisCoord < limitMin) { - mainAxisCoord = limitMin; - } else if (mainAxisCoord > limitMax) { - mainAxisCoord = limitMax; - } + const version2 = Utils.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, ua2) || Utils.getFirstMatch(commonVersionIdentifier, ua2); + if (version2) { + browser2.version = version2; } - if (checkCrossAxis) { - var _middlewareData$offse, _middlewareData$offse2; - const len = mainAxis === "y" ? "width" : "height"; - const isOriginSide = ["top", "left"].includes(getSide(placement)); - const limitMin = rects.reference[crossAxis] - rects.floating[len] + (isOriginSide ? ((_middlewareData$offse = middlewareData.offset) == null ? void 0 : _middlewareData$offse[crossAxis]) || 0 : 0) + (isOriginSide ? 0 : computedOffset.crossAxis); - const limitMax = rects.reference[crossAxis] + rects.reference[len] + (isOriginSide ? 0 : ((_middlewareData$offse2 = middlewareData.offset) == null ? void 0 : _middlewareData$offse2[crossAxis]) || 0) - (isOriginSide ? computedOffset.crossAxis : 0); - if (crossAxisCoord < limitMin) { - crossAxisCoord = limitMin; - } else if (crossAxisCoord > limitMax) { - crossAxisCoord = limitMax; - } + return browser2; + } + }, + { + test: [/SamsungBrowser/i], + describe(ua2) { + const browser2 = { + name: "Samsung Internet for Android" + }; + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; } - return { - [mainAxis]: mainAxisCoord, - [crossAxis]: crossAxisCoord + return browser2; + } + }, + { + test: [/Whale/i], + describe(ua2) { + const browser2 = { + name: "NAVER Whale Browser" }; + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - }; -}; -const size$2 = function(options) { - if (options === void 0) { - options = {}; - } - return { - name: "size", - options, - async fn(state) { - const { - placement, - rects, - platform: platform2, - elements - } = state; - const { - apply = () => { - }, - ...detectOverflowOptions - } = evaluate(options, state); - const overflow = await detectOverflow(state, detectOverflowOptions); - const side = getSide(placement); - const alignment = getAlignment(placement); - const isYAxis = getSideAxis(placement) === "y"; - const { - width, - height - } = rects.floating; - let heightSide; - let widthSide; - if (side === "top" || side === "bottom") { - heightSide = side; - widthSide = alignment === (await (platform2.isRTL == null ? void 0 : platform2.isRTL(elements.floating)) ? "start" : "end") ? "left" : "right"; - } else { - widthSide = side; - heightSide = alignment === "end" ? "top" : "bottom"; + }, + { + test: [/MZBrowser/i], + describe(ua2) { + const browser2 = { + name: "MZ Browser" + }; + const version2 = Utils.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, ua2) || Utils.getFirstMatch(commonVersionIdentifier, ua2); + if (version2) { + browser2.version = version2; } - const maximumClippingHeight = height - overflow.top - overflow.bottom; - const maximumClippingWidth = width - overflow.left - overflow.right; - const overflowAvailableHeight = min(height - overflow[heightSide], maximumClippingHeight); - const overflowAvailableWidth = min(width - overflow[widthSide], maximumClippingWidth); - const noShift = !state.middlewareData.shift; - let availableHeight = overflowAvailableHeight; - let availableWidth = overflowAvailableWidth; - if (isYAxis) { - availableWidth = alignment || noShift ? min(overflowAvailableWidth, maximumClippingWidth) : maximumClippingWidth; - } else { - availableHeight = alignment || noShift ? min(overflowAvailableHeight, maximumClippingHeight) : maximumClippingHeight; + return browser2; + } + }, + { + test: [/focus/i], + describe(ua2) { + const browser2 = { + name: "Focus" + }; + const version2 = Utils.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, ua2) || Utils.getFirstMatch(commonVersionIdentifier, ua2); + if (version2) { + browser2.version = version2; } - if (noShift && !alignment) { - const xMin = max(overflow.left, 0); - const xMax = max(overflow.right, 0); - const yMin = max(overflow.top, 0); - const yMax = max(overflow.bottom, 0); - if (isYAxis) { - availableWidth = width - 2 * (xMin !== 0 || xMax !== 0 ? xMin + xMax : max(overflow.left, overflow.right)); - } else { - availableHeight = height - 2 * (yMin !== 0 || yMax !== 0 ? yMin + yMax : max(overflow.top, overflow.bottom)); - } + return browser2; + } + }, + { + test: [/swing/i], + describe(ua2) { + const browser2 = { + name: "Swing" + }; + const version2 = Utils.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, ua2) || Utils.getFirstMatch(commonVersionIdentifier, ua2); + if (version2) { + browser2.version = version2; } - await apply({ - ...state, - availableWidth, - availableHeight - }); - const nextDimensions = await platform2.getDimensions(elements.floating); - if (width !== nextDimensions.width || height !== nextDimensions.height) { - return { - reset: { - rects: true - } - }; + return browser2; + } + }, + { + test: [/coast/i], + describe(ua2) { + const browser2 = { + name: "Opera Coast" + }; + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; } - return {}; + return browser2; } - }; -}; -function getNodeName(node) { - if (isNode(node)) { - return (node.nodeName || "").toLowerCase(); - } - return "#document"; -} -function getWindow(node) { - var _node$ownerDocument; - return (node == null || (_node$ownerDocument = node.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window; -} -function getDocumentElement(node) { - var _ref; - return (_ref = (isNode(node) ? node.ownerDocument : node.document) || window.document) == null ? void 0 : _ref.documentElement; -} -function isNode(value) { - return value instanceof Node || value instanceof getWindow(value).Node; -} -function isElement(value) { - return value instanceof Element || value instanceof getWindow(value).Element; -} -function isHTMLElement(value) { - return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement; -} -function isShadowRoot(value) { - if (typeof ShadowRoot === "undefined") { - return false; - } - return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot; -} -function isOverflowElement(element) { - const { - overflow, - overflowX, - overflowY, - display - } = getComputedStyle$1(element); - return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display); -} -function isTableElement(element) { - return ["table", "td", "th"].includes(getNodeName(element)); -} -function isContainingBlock(element) { - const webkit = isWebKit(); - const css = getComputedStyle$1(element); - return css.transform !== "none" || css.perspective !== "none" || (css.containerType ? css.containerType !== "normal" : false) || !webkit && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit && (css.filter ? css.filter !== "none" : false) || ["transform", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value)); -} -function getContainingBlock(element) { - let currentNode = getParentNode(element); - while (isHTMLElement(currentNode) && !isLastTraversableNode(currentNode)) { - if (isContainingBlock(currentNode)) { - return currentNode; + }, + { + test: [/opt\/\d+(?:.?_?\d+)+/i], + describe(ua2) { + const browser2 = { + name: "Opera Touch" + }; + const version2 = Utils.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, ua2) || Utils.getFirstMatch(commonVersionIdentifier, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - currentNode = getParentNode(currentNode); - } - return null; -} -function isWebKit() { - if (typeof CSS === "undefined" || !CSS.supports) - return false; - return CSS.supports("-webkit-backdrop-filter", "none"); -} -function isLastTraversableNode(node) { - return ["html", "body", "#document"].includes(getNodeName(node)); -} -function getComputedStyle$1(element) { - return getWindow(element).getComputedStyle(element); -} -function getNodeScroll(element) { - if (isElement(element)) { - return { - scrollLeft: element.scrollLeft, - scrollTop: element.scrollTop - }; - } - return { - scrollLeft: element.pageXOffset, - scrollTop: element.pageYOffset - }; -} -function getParentNode(node) { - if (getNodeName(node) === "html") { - return node; - } - const result = ( - // Step into the shadow DOM of the parent of a slotted node. - node.assignedSlot || // DOM Element detected. - node.parentNode || // ShadowRoot detected. - isShadowRoot(node) && node.host || // Fallback. - getDocumentElement(node) - ); - return isShadowRoot(result) ? result.host : result; -} -function getNearestOverflowAncestor(node) { - const parentNode = getParentNode(node); - if (isLastTraversableNode(parentNode)) { - return node.ownerDocument ? node.ownerDocument.body : node.body; - } - if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) { - return parentNode; - } - return getNearestOverflowAncestor(parentNode); -} -function getOverflowAncestors(node, list2, traverseIframes) { - var _node$ownerDocument2; - if (list2 === void 0) { - list2 = []; - } - if (traverseIframes === void 0) { - traverseIframes = true; - } - const scrollableAncestor = getNearestOverflowAncestor(node); - const isBody = scrollableAncestor === ((_node$ownerDocument2 = node.ownerDocument) == null ? void 0 : _node$ownerDocument2.body); - const win = getWindow(scrollableAncestor); - if (isBody) { - return list2.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], win.frameElement && traverseIframes ? getOverflowAncestors(win.frameElement) : []); - } - return list2.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes)); -} -function getCssDimensions(element) { - const css = getComputedStyle$1(element); - let width = parseFloat(css.width) || 0; - let height = parseFloat(css.height) || 0; - const hasOffset = isHTMLElement(element); - const offsetWidth = hasOffset ? element.offsetWidth : width; - const offsetHeight = hasOffset ? element.offsetHeight : height; - const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight; - if (shouldFallback) { - width = offsetWidth; - height = offsetHeight; - } - return { - width, - height, - $: shouldFallback - }; -} -function unwrapElement(element) { - return !isElement(element) ? element.contextElement : element; -} -function getScale(element) { - const domElement = unwrapElement(element); - if (!isHTMLElement(domElement)) { - return createCoords(1); - } - const rect = domElement.getBoundingClientRect(); - const { - width, - height, - $ - } = getCssDimensions(domElement); - let x = ($ ? round(rect.width) : rect.width) / width; - let y2 = ($ ? round(rect.height) : rect.height) / height; - if (!x || !Number.isFinite(x)) { - x = 1; - } - if (!y2 || !Number.isFinite(y2)) { - y2 = 1; - } - return { - x, - y: y2 - }; -} -const noOffsets = /* @__PURE__ */ createCoords(0); -function getVisualOffsets(element) { - const win = getWindow(element); - if (!isWebKit() || !win.visualViewport) { - return noOffsets; - } - return { - x: win.visualViewport.offsetLeft, - y: win.visualViewport.offsetTop - }; -} -function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) { - if (isFixed === void 0) { - isFixed = false; - } - if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) { - return false; - } - return isFixed; -} -function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) { - if (includeScale === void 0) { - includeScale = false; - } - if (isFixedStrategy === void 0) { - isFixedStrategy = false; - } - const clientRect = element.getBoundingClientRect(); - const domElement = unwrapElement(element); - let scale2 = createCoords(1); - if (includeScale) { - if (offsetParent) { - if (isElement(offsetParent)) { - scale2 = getScale(offsetParent); + }, + { + test: [/yabrowser/i], + describe(ua2) { + const browser2 = { + name: "Yandex Browser" + }; + const version2 = Utils.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, ua2) || Utils.getFirstMatch(commonVersionIdentifier, ua2); + if (version2) { + browser2.version = version2; } - } else { - scale2 = getScale(element); + return browser2; } - } - const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0); - let x = (clientRect.left + visualOffsets.x) / scale2.x; - let y2 = (clientRect.top + visualOffsets.y) / scale2.y; - let width = clientRect.width / scale2.x; - let height = clientRect.height / scale2.y; - if (domElement) { - const win = getWindow(domElement); - const offsetWin = offsetParent && isElement(offsetParent) ? getWindow(offsetParent) : offsetParent; - let currentWin = win; - let currentIFrame = currentWin.frameElement; - while (currentIFrame && offsetParent && offsetWin !== currentWin) { - const iframeScale = getScale(currentIFrame); - const iframeRect = currentIFrame.getBoundingClientRect(); - const css = getComputedStyle$1(currentIFrame); - const left = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x; - const top = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y; - x *= iframeScale.x; - y2 *= iframeScale.y; - width *= iframeScale.x; - height *= iframeScale.y; - x += left; - y2 += top; - currentWin = getWindow(currentIFrame); - currentIFrame = currentWin.frameElement; - } - } - return rectToClientRect({ - width, - height, - x, - y: y2 - }); -} -const topLayerSelectors = [":popover-open", ":modal"]; -function isTopLayer(element) { - return topLayerSelectors.some((selector2) => { - try { - return element.matches(selector2); - } catch (e2) { - return false; + }, + { + test: [/ucbrowser/i], + describe(ua2) { + const browser2 = { + name: "UC Browser" + }; + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - }); -} -function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) { - let { - elements, - rect, - offsetParent, - strategy - } = _ref; - const isFixed = strategy === "fixed"; - const documentElement = getDocumentElement(offsetParent); - const topLayer = elements ? isTopLayer(elements.floating) : false; - if (offsetParent === documentElement || topLayer && isFixed) { - return rect; - } - let scroll2 = { - scrollLeft: 0, - scrollTop: 0 - }; - let scale2 = createCoords(1); - const offsets = createCoords(0); - const isOffsetParentAnElement = isHTMLElement(offsetParent); - if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { - if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { - scroll2 = getNodeScroll(offsetParent); + }, + { + test: [/Maxthon|mxios/i], + describe(ua2) { + const browser2 = { + name: "Maxthon" + }; + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - if (isHTMLElement(offsetParent)) { - const offsetRect = getBoundingClientRect(offsetParent); - scale2 = getScale(offsetParent); - offsets.x = offsetRect.x + offsetParent.clientLeft; - offsets.y = offsetRect.y + offsetParent.clientTop; + }, + { + test: [/epiphany/i], + describe(ua2) { + const browser2 = { + name: "Epiphany" + }; + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - } - return { - width: rect.width * scale2.x, - height: rect.height * scale2.y, - x: rect.x * scale2.x - scroll2.scrollLeft * scale2.x + offsets.x, - y: rect.y * scale2.y - scroll2.scrollTop * scale2.y + offsets.y - }; -} -function getClientRects(element) { - return Array.from(element.getClientRects()); -} -function getWindowScrollBarX(element) { - return getBoundingClientRect(getDocumentElement(element)).left + getNodeScroll(element).scrollLeft; -} -function getDocumentRect(element) { - const html = getDocumentElement(element); - const scroll2 = getNodeScroll(element); - const body = element.ownerDocument.body; - const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth); - const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight); - let x = -scroll2.scrollLeft + getWindowScrollBarX(element); - const y2 = -scroll2.scrollTop; - if (getComputedStyle$1(body).direction === "rtl") { - x += max(html.clientWidth, body.clientWidth) - width; - } - return { - width, - height, - x, - y: y2 - }; -} -function getViewportRect(element, strategy) { - const win = getWindow(element); - const html = getDocumentElement(element); - const visualViewport = win.visualViewport; - let width = html.clientWidth; - let height = html.clientHeight; - let x = 0; - let y2 = 0; - if (visualViewport) { - width = visualViewport.width; - height = visualViewport.height; - const visualViewportBased = isWebKit(); - if (!visualViewportBased || visualViewportBased && strategy === "fixed") { - x = visualViewport.offsetLeft; - y2 = visualViewport.offsetTop; + }, + { + test: [/puffin/i], + describe(ua2) { + const browser2 = { + name: "Puffin" + }; + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - } - return { - width, - height, - x, - y: y2 - }; -} -function getInnerBoundingClientRect(element, strategy) { - const clientRect = getBoundingClientRect(element, true, strategy === "fixed"); - const top = clientRect.top + element.clientTop; - const left = clientRect.left + element.clientLeft; - const scale2 = isHTMLElement(element) ? getScale(element) : createCoords(1); - const width = element.clientWidth * scale2.x; - const height = element.clientHeight * scale2.y; - const x = left * scale2.x; - const y2 = top * scale2.y; - return { - width, - height, - x, - y: y2 - }; -} -function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) { - let rect; - if (clippingAncestor === "viewport") { - rect = getViewportRect(element, strategy); - } else if (clippingAncestor === "document") { - rect = getDocumentRect(getDocumentElement(element)); - } else if (isElement(clippingAncestor)) { - rect = getInnerBoundingClientRect(clippingAncestor, strategy); - } else { - const visualOffsets = getVisualOffsets(element); - rect = { - ...clippingAncestor, - x: clippingAncestor.x - visualOffsets.x, - y: clippingAncestor.y - visualOffsets.y - }; - } - return rectToClientRect(rect); -} -function hasFixedPositionAncestor(element, stopNode) { - const parentNode = getParentNode(element); - if (parentNode === stopNode || !isElement(parentNode) || isLastTraversableNode(parentNode)) { - return false; - } - return getComputedStyle$1(parentNode).position === "fixed" || hasFixedPositionAncestor(parentNode, stopNode); -} -function getClippingElementAncestors(element, cache) { - const cachedResult = cache.get(element); - if (cachedResult) { - return cachedResult; - } - let result = getOverflowAncestors(element, [], false).filter((el2) => isElement(el2) && getNodeName(el2) !== "body"); - let currentContainingBlockComputedStyle = null; - const elementIsFixed = getComputedStyle$1(element).position === "fixed"; - let currentNode = elementIsFixed ? getParentNode(element) : element; - while (isElement(currentNode) && !isLastTraversableNode(currentNode)) { - const computedStyle = getComputedStyle$1(currentNode); - const currentNodeIsContaining = isContainingBlock(currentNode); - if (!currentNodeIsContaining && computedStyle.position === "fixed") { - currentContainingBlockComputedStyle = null; + }, + { + test: [/sleipnir/i], + describe(ua2) { + const browser2 = { + name: "Sleipnir" + }; + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode); - if (shouldDropCurrentNode) { - result = result.filter((ancestor) => ancestor !== currentNode); - } else { - currentContainingBlockComputedStyle = computedStyle; + }, + { + test: [/k-meleon/i], + describe(ua2) { + const browser2 = { + name: "K-Meleon" + }; + const version2 = Utils.getFirstMatch(commonVersionIdentifier, ua2) || Utils.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - currentNode = getParentNode(currentNode); - } - cache.set(element, result); - return result; -} -function getClippingRect(_ref) { - let { - element, - boundary, - rootBoundary, - strategy - } = _ref; - const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary); - const clippingAncestors = [...elementClippingAncestors, rootBoundary]; - const firstClippingAncestor = clippingAncestors[0]; - const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => { - const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy); - accRect.top = max(rect.top, accRect.top); - accRect.right = min(rect.right, accRect.right); - accRect.bottom = min(rect.bottom, accRect.bottom); - accRect.left = max(rect.left, accRect.left); - return accRect; - }, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy)); - return { - width: clippingRect.right - clippingRect.left, - height: clippingRect.bottom - clippingRect.top, - x: clippingRect.left, - y: clippingRect.top - }; -} -function getDimensions(element) { - const { - width, - height - } = getCssDimensions(element); - return { - width, - height - }; -} -function getRectRelativeToOffsetParent(element, offsetParent, strategy) { - const isOffsetParentAnElement = isHTMLElement(offsetParent); - const documentElement = getDocumentElement(offsetParent); - const isFixed = strategy === "fixed"; - const rect = getBoundingClientRect(element, true, isFixed, offsetParent); - let scroll2 = { - scrollLeft: 0, - scrollTop: 0 - }; - const offsets = createCoords(0); - if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) { - if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) { - scroll2 = getNodeScroll(offsetParent); + }, + { + test: [/micromessenger/i], + describe(ua2) { + const browser2 = { + name: "WeChat" + }; + const version2 = Utils.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, ua2) || Utils.getFirstMatch(commonVersionIdentifier, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - if (isOffsetParentAnElement) { - const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent); - offsets.x = offsetRect.x + offsetParent.clientLeft; - offsets.y = offsetRect.y + offsetParent.clientTop; - } else if (documentElement) { - offsets.x = getWindowScrollBarX(documentElement); + }, + { + test: [/qqbrowser/i], + describe(ua2) { + const browser2 = { + name: /qqbrowserlite/i.test(ua2) ? "QQ Browser Lite" : "QQ Browser" + }; + const version2 = Utils.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, ua2) || Utils.getFirstMatch(commonVersionIdentifier, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - } - const x = rect.left + scroll2.scrollLeft - offsets.x; - const y2 = rect.top + scroll2.scrollTop - offsets.y; - return { - x, - y: y2, - width: rect.width, - height: rect.height - }; -} -function isStaticPositioned(element) { - return getComputedStyle$1(element).position === "static"; -} -function getTrueOffsetParent(element, polyfill2) { - if (!isHTMLElement(element) || getComputedStyle$1(element).position === "fixed") { - return null; - } - if (polyfill2) { - return polyfill2(element); - } - return element.offsetParent; -} -function getOffsetParent(element, polyfill2) { - const win = getWindow(element); - if (isTopLayer(element)) { - return win; - } - if (!isHTMLElement(element)) { - let svgOffsetParent = getParentNode(element); - while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) { - if (isElement(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) { - return svgOffsetParent; + }, + { + test: [/msie|trident/i], + describe(ua2) { + const browser2 = { + name: "Internet Explorer" + }; + const version2 = Utils.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; } - svgOffsetParent = getParentNode(svgOffsetParent); + return browser2; } - return win; - } - let offsetParent = getTrueOffsetParent(element, polyfill2); - while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) { - offsetParent = getTrueOffsetParent(offsetParent, polyfill2); - } - if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) { - return win; - } - return offsetParent || getContainingBlock(element) || win; -} -const getElementRects = async function(data) { - const getOffsetParentFn = this.getOffsetParent || getOffsetParent; - const getDimensionsFn = this.getDimensions; - const floatingDimensions = await getDimensionsFn(data.floating); - return { - reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy), - floating: { - x: 0, - y: 0, - width: floatingDimensions.width, - height: floatingDimensions.height + }, + { + test: [/\sedg\//i], + describe(ua2) { + const browser2 = { + name: "Microsoft Edge" + }; + const version2 = Utils.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - }; -}; -function isRTL(element) { - return getComputedStyle$1(element).direction === "rtl"; -} -const platform = { - convertOffsetParentRelativeRectToViewportRelativeRect, - getDocumentElement, - getClippingRect, - getOffsetParent, - getElementRects, - getClientRects, - getDimensions, - getScale, - isElement, - isRTL -}; -function observeMove(element, onMove) { - let io = null; - let timeoutId; - const root2 = getDocumentElement(element); - function cleanup() { - var _io; - clearTimeout(timeoutId); - (_io = io) == null || _io.disconnect(); - io = null; - } - function refresh(skip, threshold) { - if (skip === void 0) { - skip = false; + }, + { + test: [/edg([ea]|ios)/i], + describe(ua2) { + const browser2 = { + name: "Microsoft Edge" + }; + const version2 = Utils.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - if (threshold === void 0) { - threshold = 1; + }, + { + test: [/vivaldi/i], + describe(ua2) { + const browser2 = { + name: "Vivaldi" + }; + const version2 = Utils.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - cleanup(); - const { - left, - top, - width, - height - } = element.getBoundingClientRect(); - if (!skip) { - onMove(); + }, + { + test: [/seamonkey/i], + describe(ua2) { + const browser2 = { + name: "SeaMonkey" + }; + const version2 = Utils.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - if (!width || !height) { - return; + }, + { + test: [/sailfish/i], + describe(ua2) { + const browser2 = { + name: "Sailfish" + }; + const version2 = Utils.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, ua2); + if (version2) { + browser2.version = version2; + } + return browser2; } - const insetTop = floor(top); - const insetRight = floor(root2.clientWidth - (left + width)); - const insetBottom = floor(root2.clientHeight - (top + height)); - const insetLeft = floor(left); - const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px"; - const options = { - rootMargin, - threshold: max(0, min(1, threshold)) || 1 - }; - let isFirstUpdate = true; - function handleObserve(entries) { - const ratio = entries[0].intersectionRatio; - if (ratio !== threshold) { - if (!isFirstUpdate) { - return refresh(); - } - if (!ratio) { - timeoutId = setTimeout(() => { - refresh(false, 1e-7); - }, 1e3); - } else { - refresh(false, ratio); - } + }, + { + test: [/silk/i], + describe(ua2) { + const browser2 = { + name: "Amazon Silk" + }; + const version2 = Utils.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, ua2); + if (version2) { + browser2.version = version2; } - isFirstUpdate = false; + return browser2; } - try { - io = new IntersectionObserver(handleObserve, { - ...options, - // Handle