@powerhousedao/connect 1.0.26-staging.1 → 1.0.28-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/assets/{app-Di6g_N6F.css → app-BDw8v6b_.css} +79 -97
  2. package/dist/assets/{app-CRmBSwdZ.js → app-DHw_h7gS.js} +4078 -4763
  3. package/dist/assets/app-DHw_h7gS.js.map +1 -0
  4. package/dist/assets/{app-loader-b43YtazY.css → app-loader-CDW9U8zV.css} +15 -22
  5. package/dist/assets/{app-loader-RsbJjyqQ.js → app-loader-DwKN8KIC.js} +440 -831
  6. package/dist/assets/app-loader-DwKN8KIC.js.map +1 -0
  7. package/dist/assets/{browser-91UF6D30.js → browser-CEIioANE.js} +45 -35
  8. package/dist/assets/browser-CEIioANE.js.map +1 -0
  9. package/dist/assets/{ccip-fQywIzFj.js → ccip-Cgv37f4v.js} +4 -4
  10. package/dist/assets/ccip-Cgv37f4v.js.map +1 -0
  11. package/dist/assets/{content-BnL67474.js → content-Bnjc15M3.js} +115 -69
  12. package/dist/assets/content-Bnjc15M3.js.map +1 -0
  13. package/dist/assets/{index-Dhk2SYz1.js → index-BgGUWENy.js} +61 -3463
  14. package/dist/assets/index-BgGUWENy.js.map +1 -0
  15. package/dist/assets/{index-CTU5A_ny.js → index-CrWUHus9.js} +5 -5
  16. package/dist/assets/{index-CTU5A_ny.js.map → index-CrWUHus9.js.map} +1 -1
  17. package/dist/assets/{index-wfQd1zBi.js → index-D9_MTgI5.js} +4 -4
  18. package/dist/assets/{index-wfQd1zBi.js.map → index-D9_MTgI5.js.map} +1 -1
  19. package/dist/assets/{index-C9fN2R5E.js → index-DPsLHOm9.js} +4 -4
  20. package/dist/assets/index-DPsLHOm9.js.map +1 -0
  21. package/dist/assets/{main.q28QTjbj.js → main.DzLLcDg5.js} +2 -2
  22. package/dist/assets/{main.q28QTjbj.js.map → main.DzLLcDg5.js.map} +1 -1
  23. package/dist/assets/{reactor-analytics-Bko1imW1.js → reactor-analytics-ChaldiVR.js} +6 -6
  24. package/dist/assets/{reactor-analytics-Bko1imW1.js.map → reactor-analytics-ChaldiVR.js.map} +1 -1
  25. package/dist/assets/{router-D9OI6ikX.js → router-COn-IaaE.js} +8 -8
  26. package/dist/assets/{router-D9OI6ikX.js.map → router-COn-IaaE.js.map} +1 -1
  27. package/dist/assets/{style-CK8AY-7U.css → style-C0GVbPTL.css} +16 -12
  28. package/dist/index.html +1 -1
  29. package/dist/vite-envs.sh +1 -1
  30. package/package.json +9 -9
  31. package/dist/assets/app-CRmBSwdZ.js.map +0 -1
  32. package/dist/assets/app-loader-RsbJjyqQ.js.map +0 -1
  33. package/dist/assets/browser-91UF6D30.js.map +0 -1
  34. package/dist/assets/ccip-fQywIzFj.js.map +0 -1
  35. package/dist/assets/content-BnL67474.js.map +0 -1
  36. package/dist/assets/index-C9fN2R5E.js.map +0 -1
  37. package/dist/assets/index-Dhk2SYz1.js.map +0 -1
@@ -1,8 +1,8 @@
1
- import { aM as BaseError, aN as getUrl, aO as stringify, aP as decodeErrorResult, aQ as isAddressEqual, aR as localBatchGatewayUrl, aS as localBatchGatewayRequest, aT as call, aU as concat, aV as encodeAbiParameters, aW as HttpRequestError, aX as isHex } from "./app-CRmBSwdZ.js";
2
- import "./main.q28QTjbj.js";
1
+ import { aI as BaseError, aJ as getUrl, aK as stringify, aL as decodeErrorResult, aM as isAddressEqual, aN as localBatchGatewayUrl, aO as localBatchGatewayRequest, aP as call, aQ as concat, aR as encodeAbiParameters, aS as HttpRequestError, aT as isHex } from "./app-DHw_h7gS.js";
2
+ import "./main.DzLLcDg5.js";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
- import "./app-loader-RsbJjyqQ.js";
5
+ import "./app-loader-DwKN8KIC.js";
6
6
  import "react-dom";
7
7
  class OffchainLookupError extends BaseError {
8
8
  constructor({ callbackSelector, cause, data, extraData, sender, urls }) {
@@ -165,4 +165,4 @@ export {
165
165
  offchainLookupAbiItem,
166
166
  offchainLookupSignature
167
167
  };
168
- //# sourceMappingURL=ccip-fQywIzFj.js.map
168
+ //# sourceMappingURL=ccip-Cgv37f4v.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ccip-Cgv37f4v.js","sources":["../../../../node_modules/.pnpm/viem@2.30.1_bufferutil@4.0.9_typescript@5.8.3_utf-8-validate@5.0.10_zod@3.25.28/node_modules/viem/_esm/errors/ccip.js","../../../../node_modules/.pnpm/viem@2.30.1_bufferutil@4.0.9_typescript@5.8.3_utf-8-validate@5.0.10_zod@3.25.28/node_modules/viem/_esm/utils/ccip.js"],"sourcesContent":["import { stringify } from '../utils/stringify.js';\nimport { BaseError } from './base.js';\nimport { getUrl } from './utils.js';\nexport class OffchainLookupError extends BaseError {\n constructor({ callbackSelector, cause, data, extraData, sender, urls, }) {\n super(cause.shortMessage ||\n 'An error occurred while fetching for an offchain result.', {\n cause,\n metaMessages: [\n ...(cause.metaMessages || []),\n cause.metaMessages?.length ? '' : [],\n 'Offchain Gateway Call:',\n urls && [\n ' Gateway URL(s):',\n ...urls.map((url) => ` ${getUrl(url)}`),\n ],\n ` Sender: ${sender}`,\n ` Data: ${data}`,\n ` Callback selector: ${callbackSelector}`,\n ` Extra data: ${extraData}`,\n ].flat(),\n name: 'OffchainLookupError',\n });\n }\n}\nexport class OffchainLookupResponseMalformedError extends BaseError {\n constructor({ result, url }) {\n super('Offchain gateway response is malformed. Response data must be a hex value.', {\n metaMessages: [\n `Gateway URL: ${getUrl(url)}`,\n `Response: ${stringify(result)}`,\n ],\n name: 'OffchainLookupResponseMalformedError',\n });\n }\n}\nexport class OffchainLookupSenderMismatchError extends BaseError {\n constructor({ sender, to }) {\n super('Reverted sender address does not match target contract address (`to`).', {\n metaMessages: [\n `Contract address: ${to}`,\n `OffchainLookup sender address: ${sender}`,\n ],\n name: 'OffchainLookupSenderMismatchError',\n });\n }\n}\n//# sourceMappingURL=ccip.js.map","import { call } from '../actions/public/call.js';\nimport { OffchainLookupError, OffchainLookupResponseMalformedError, OffchainLookupSenderMismatchError, } from '../errors/ccip.js';\nimport { HttpRequestError, } from '../errors/request.js';\nimport { decodeErrorResult } from './abi/decodeErrorResult.js';\nimport { encodeAbiParameters } from './abi/encodeAbiParameters.js';\nimport { isAddressEqual } from './address/isAddressEqual.js';\nimport { concat } from './data/concat.js';\nimport { isHex } from './data/isHex.js';\nimport { localBatchGatewayRequest, localBatchGatewayUrl, } from './ens/localBatchGatewayRequest.js';\nimport { stringify } from './stringify.js';\nexport const offchainLookupSignature = '0x556f1830';\nexport const offchainLookupAbiItem = {\n name: 'OffchainLookup',\n type: 'error',\n inputs: [\n {\n name: 'sender',\n type: 'address',\n },\n {\n name: 'urls',\n type: 'string[]',\n },\n {\n name: 'callData',\n type: 'bytes',\n },\n {\n name: 'callbackFunction',\n type: 'bytes4',\n },\n {\n name: 'extraData',\n type: 'bytes',\n },\n ],\n};\nexport async function offchainLookup(client, { blockNumber, blockTag, data, to, }) {\n const { args } = decodeErrorResult({\n data,\n abi: [offchainLookupAbiItem],\n });\n const [sender, urls, callData, callbackSelector, extraData] = args;\n const { ccipRead } = client;\n const ccipRequest_ = ccipRead && typeof ccipRead?.request === 'function'\n ? ccipRead.request\n : ccipRequest;\n try {\n if (!isAddressEqual(to, sender))\n throw new OffchainLookupSenderMismatchError({ sender, to });\n const result = urls.includes(localBatchGatewayUrl)\n ? await localBatchGatewayRequest({\n data: callData,\n ccipRequest: ccipRequest_,\n })\n : await ccipRequest_({ data: callData, sender, urls });\n const { data: data_ } = await call(client, {\n blockNumber,\n blockTag,\n data: concat([\n callbackSelector,\n encodeAbiParameters([{ type: 'bytes' }, { type: 'bytes' }], [result, extraData]),\n ]),\n to,\n });\n return data_;\n }\n catch (err) {\n throw new OffchainLookupError({\n callbackSelector,\n cause: err,\n data,\n extraData,\n sender,\n urls,\n });\n }\n}\nexport async function ccipRequest({ data, sender, urls, }) {\n let error = new Error('An unknown error occurred.');\n for (let i = 0; i < urls.length; i++) {\n const url = urls[i];\n const method = url.includes('{data}') ? 'GET' : 'POST';\n const body = method === 'POST' ? { data, sender } : undefined;\n const headers = method === 'POST' ? { 'Content-Type': 'application/json' } : {};\n try {\n const response = await fetch(url.replace('{sender}', sender.toLowerCase()).replace('{data}', data), {\n body: JSON.stringify(body),\n headers,\n method,\n });\n let result;\n if (response.headers.get('Content-Type')?.startsWith('application/json')) {\n result = (await response.json()).data;\n }\n else {\n result = (await response.text());\n }\n if (!response.ok) {\n error = new HttpRequestError({\n body,\n details: result?.error\n ? stringify(result.error)\n : response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n });\n continue;\n }\n if (!isHex(result)) {\n error = new OffchainLookupResponseMalformedError({\n result,\n url,\n });\n continue;\n }\n return result;\n }\n catch (err) {\n error = new HttpRequestError({\n body,\n details: err.message,\n url,\n });\n }\n }\n throw error;\n}\n//# sourceMappingURL=ccip.js.map"],"names":[],"mappings":";;;;;;AAGO,MAAM,4BAA4B,UAAU;AAAA,EAC/C,YAAY,EAAE,kBAAkB,OAAO,MAAM,WAAW,QAAQ,QAAS;;AACrE,UAAM,MAAM,gBACR,4DAA4D;AAAA,MAC5D;AAAA,MACA,cAAc;AAAA,QACV,GAAI,MAAM,gBAAgB;UAC1B,WAAM,iBAAN,mBAAoB,UAAS,KAAK,CAAE;AAAA,QACpC;AAAA,QACA,QAAQ;AAAA,UACJ;AAAA,UACA,GAAG,KAAK,IAAI,CAAC,QAAQ,OAAO,OAAO,GAAG,CAAC,EAAE;AAAA,QAC5C;AAAA,QACD,aAAa,MAAM;AAAA,QACnB,WAAW,IAAI;AAAA,QACf,wBAAwB,gBAAgB;AAAA,QACxC,iBAAiB,SAAS;AAAA,MAC7B,EAAC,KAAM;AAAA,MACR,MAAM;AAAA,IAClB,CAAS;AAAA,EACT;AACA;AACO,MAAM,6CAA6C,UAAU;AAAA,EAChE,YAAY,EAAE,QAAQ,OAAO;AACzB,UAAM,8EAA8E;AAAA,MAChF,cAAc;AAAA,QACV,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,iBAAiB;AAAA,UACzB;AAAA,UACA,UAAS,iCAAQ,SACX,UAAU,OAAO,KAAK,IACtB,SAAS;AAAA,UACf,SAAS,SAAS;AAAA,UAClB,QAAQ,SAAS;AAAA,UACjB;AAAA,QACpB,CAAiB;AACD;AAAA,MAChB;AACY,UAAI,CAAC,MAAM,MAAM,GAAG;AAChB,gBAAQ,IAAI,qCAAqC;AAAA,UAC7C;AAAA,UACA;AAAA,QACpB,CAAiB;AACD;AAAA,MAChB;AACY,aAAO;AAAA,IACnB,SACe,KAAK;AACR,cAAQ,IAAI,iBAAiB;AAAA,QACzB;AAAA,QACA,SAAS,IAAI;AAAA,QACb;AAAA,MAChB,CAAa;AAAA,IACb;AAAA,EACA;AACI,QAAM;AACV;","x_google_ignoreList":[0,1]}
@@ -1,11 +1,11 @@
1
1
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import React__default, { useState, useCallback, useMemo, useEffect, Fragment, useRef, useLayoutEffect, memo as memo$1, createElement, useSyncExternalStore, Suspense } from "react";
4
- import { t as twMerge, B as Button, aY as mergeClassNameProps, I as Icon, aZ as getDimensions, a_ as useDocumentDrives, h as useUiNodesContext, a$ as useDriveContext, b0 as FILE, G as ERROR, b1 as MISSING, C as CONFLICT, S as SUCCESS, b2 as SYNCING, b3 as INITIAL_SYNC, b4 as READ, b5 as nodeOptionsMap, b6 as defaultFileOptions, b7 as ConnectDropdownMenu, b8 as DELETE, b9 as RENAME, ba as WRITE, bb as DUPLICATE, bc as defaultFolderOptions, bd as useOnClickOutside, be as useEventListener, bf as useCopyToClipboard, bg as Select, bh as Provider, bi as Root3, bj as Trigger, bk as Portal, bl as Content2, bm as UI_NODE, D as DRIVE, F as FILE$1, bn as validateInitialState, bo as validateStateSchemaName, bp as validateModules, e as useDocumentDriveServer, K as useUnwrappedReactor, bq as useConnectDid, br as useConnectCrypto, w as useTranslation, f as useModal, bs as useAtomValue, bt as themeAtom, bu as useUser, bv as useUserPermissions$1, bw as useFileNodeDocument, bx as useGetDocumentModelModule, by as exportFile, bz as addActionContext$1, bA as signOperation$1, bB as useHotkeys, bC as FOLDER, bD as DriveLayout, bE as DriveContextProvider, bF as SearchBar, V as useAnalyticsStore, bG as useQueryClient, u as useQuery, a8 as AnalyticsPath, bH as useAnalyticsEngine, a7 as DateTime, bI as AnalyticsGranularity, bJ as useGetEditor, bK as isSameDocument, v as useNavigate, z as useAsyncReactor, bL as useFilteredDocumentModels, bM as useDriveEditor, J as useParams, x as useDocumentDrives$1 } from "./app-CRmBSwdZ.js";
5
- import { ab as buildSignedOperation, am as generateId$1, aw as isFolderNode, aA as generateNodesCopy, aB as copyNode, az as moveNode, ay as updateNode, ax as deleteNode, ar as generateAddNodeAction, as as isFileNode, av as addFolder, bN as garbageCollect, bO as sortOperations, bP as LZString, bQ as undo, bR as redo, _ as logger, bS as openUrl, bT as useDocumentDispatch$1, aj as module, af as connectConfig } from "./app-loader-RsbJjyqQ.js";
6
- import { E as ENSAvatar, a as ErrorBoundary, t as toast } from "./router-D9OI6ikX.js";
4
+ import { t as twMerge, B as Button, aU as mergeClassNameProps, I as Icon, aV as getDimensions, aW as useDocumentDrives, h as useUiNodesContext, aX as useDriveContext, aY as FILE, G as ERROR, aZ as MISSING, C as CONFLICT, S as SUCCESS, a_ as SYNCING, a$ as INITIAL_SYNC, b0 as READ, b1 as nodeOptionsMap, b2 as defaultFileOptions, b3 as ConnectDropdownMenu, b4 as DELETE, b5 as RENAME, b6 as WRITE, b7 as DUPLICATE, b8 as defaultFolderOptions, b9 as useOnClickOutside, ba as useEventListener, bb as useCopyToClipboard, bc as Select, bd as Provider, be as Root3, bf as Trigger, bg as Portal, bh as Content2, bi as UI_NODE, D as DRIVE, F as FILE$1, bj as validateInitialState, bk as validateStateSchemaName, bl as validateModules, e as useDocumentDriveServer, K as useUnwrappedReactor, bm as useConnectDid, bn as useConnectCrypto, w as useTranslation, f as useModal, bo as useAtomValue, bp as themeAtom, bq as useUser, br as useUserPermissions$1, bs as useFileNodeDocument, bt as useGetDocumentModelModule, bu as exportFile, bv as addActionContext$1, bw as signOperation$1, bx as useHotkeys, by as FOLDER, bz as DriveLayout, bA as DriveContextProvider, bB as SearchBar, V as useAnalyticsStore, bC as useQueryClient, u as useQuery, a8 as AnalyticsPath, bD as useAnalyticsEngine, a7 as DateTime, bE as AnalyticsGranularity, bF as useGetEditor, bG as isSameDocument, v as useNavigate, z as useAsyncReactor, bH as useFilteredDocumentModels, bI as useDriveEditor, J as useParams, x as useDocumentDrives$1 } from "./app-DHw_h7gS.js";
5
+ import { ab as buildSignedOperation, am as generateId$1, aw as isFolderNode, aA as generateNodesCopy, aB as copyNode, az as moveNode, ay as updateNode, ax as deleteNode, ar as generateAddNodeAction, as as isFileNode, av as addFolder, bT as garbageCollect, bU as sortOperations, bV as LZString, bW as undo, bX as redo, _ as logger, bY as openUrl, bZ as useDocumentDispatch$1, aj as module, af as connectConfig } from "./app-loader-DwKN8KIC.js";
6
+ import { E as ENSAvatar, a as ErrorBoundary, t as toast } from "./router-COn-IaaE.js";
7
7
  import { flushSync } from "react-dom";
8
- import "./main.q28QTjbj.js";
8
+ import "./main.DzLLcDg5.js";
9
9
  const PaginationButton = ({ active = false, ...props }) => {
10
10
  const className = twMerge("h-8 min-w-8 border border-solid border-gray-300 bg-white px-3 py-1 text-xs text-gray-900 hover:bg-gray-100", !active && "border-0");
11
11
  return jsx(Button, { color: "light", size: "small", ...mergeClassNameProps(props, className), children: props.children });
@@ -2618,7 +2618,7 @@ function Header(props) {
2618
2618
  function memo(getDeps, fn, opts) {
2619
2619
  let deps = opts.initialDeps ?? [];
2620
2620
  let result;
2621
- return () => {
2621
+ function memoizedFunction() {
2622
2622
  var _a, _b, _c, _d;
2623
2623
  let depTime;
2624
2624
  if (opts.key && ((_a = opts.debug) == null ? void 0 : _a.call(opts))) depTime = Date.now();
@@ -2656,7 +2656,11 @@ function memo(getDeps, fn, opts) {
2656
2656
  }
2657
2657
  (_d = opts == null ? void 0 : opts.onChange) == null ? void 0 : _d.call(opts, result);
2658
2658
  return result;
2659
+ }
2660
+ memoizedFunction.updateDeps = (newDeps) => {
2661
+ deps = newDeps;
2659
2662
  };
2663
+ return memoizedFunction;
2660
2664
  }
2661
2665
  function notUndefined(value, msg) {
2662
2666
  if (value === void 0) {
@@ -2665,7 +2669,7 @@ function notUndefined(value, msg) {
2665
2669
  return value;
2666
2670
  }
2667
2671
  }
2668
- const approxEqual = (a, b) => Math.abs(a - b) < 1;
2672
+ const approxEqual = (a, b) => Math.abs(a - b) <= 1;
2669
2673
  const debounce = (targetWindow, fn, ms) => {
2670
2674
  let timeoutId;
2671
2675
  return function(...args) {
@@ -2673,6 +2677,10 @@ const debounce = (targetWindow, fn, ms) => {
2673
2677
  timeoutId = targetWindow.setTimeout(() => fn.apply(this, args), ms);
2674
2678
  };
2675
2679
  };
2680
+ const getRect = (element) => {
2681
+ const { offsetWidth, offsetHeight } = element;
2682
+ return { width: offsetWidth, height: offsetHeight };
2683
+ };
2676
2684
  const defaultKeyExtractor = (index) => index;
2677
2685
  const defaultRangeExtractor = (range) => {
2678
2686
  const start = Math.max(range.startIndex - range.overscan, 0);
@@ -2696,21 +2704,24 @@ const observeElementRect = (instance, cb) => {
2696
2704
  const { width, height } = rect;
2697
2705
  cb({ width: Math.round(width), height: Math.round(height) });
2698
2706
  };
2699
- handler(element.getBoundingClientRect());
2707
+ handler(getRect(element));
2700
2708
  if (!targetWindow.ResizeObserver) {
2701
2709
  return () => {
2702
2710
  };
2703
2711
  }
2704
2712
  const observer = new targetWindow.ResizeObserver((entries) => {
2705
- const entry = entries[0];
2706
- if (entry == null ? void 0 : entry.borderBoxSize) {
2707
- const box = entry.borderBoxSize[0];
2708
- if (box) {
2709
- handler({ width: box.inlineSize, height: box.blockSize });
2710
- return;
2713
+ const run = () => {
2714
+ const entry = entries[0];
2715
+ if (entry == null ? void 0 : entry.borderBoxSize) {
2716
+ const box = entry.borderBoxSize[0];
2717
+ if (box) {
2718
+ handler({ width: box.inlineSize, height: box.blockSize });
2719
+ return;
2720
+ }
2711
2721
  }
2712
- }
2713
- handler(element.getBoundingClientRect());
2722
+ handler(getRect(element));
2723
+ };
2724
+ instance.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
2714
2725
  });
2715
2726
  observer.observe(element, { box: "border-box" });
2716
2727
  return () => {
@@ -2748,10 +2759,15 @@ const observeElementOffset = (instance, cb) => {
2748
2759
  const endHandler = createHandler(false);
2749
2760
  endHandler();
2750
2761
  element.addEventListener("scroll", handler, addEventListenerOptions);
2751
- element.addEventListener("scrollend", endHandler, addEventListenerOptions);
2762
+ const registerScrollendEvent = instance.options.useScrollendEvent && supportsScrollend;
2763
+ if (registerScrollendEvent) {
2764
+ element.addEventListener("scrollend", endHandler, addEventListenerOptions);
2765
+ }
2752
2766
  return () => {
2753
2767
  element.removeEventListener("scroll", handler);
2754
- element.removeEventListener("scrollend", endHandler);
2768
+ if (registerScrollendEvent) {
2769
+ element.removeEventListener("scrollend", endHandler);
2770
+ }
2755
2771
  };
2756
2772
  };
2757
2773
  const measureElement = (element, entry, instance) => {
@@ -2764,9 +2780,7 @@ const measureElement = (element, entry, instance) => {
2764
2780
  return size;
2765
2781
  }
2766
2782
  }
2767
- return Math.round(
2768
- element.getBoundingClientRect()[instance.options.horizontal ? "width" : "height"]
2769
- );
2783
+ return element[instance.options.horizontal ? "offsetWidth" : "offsetHeight"];
2770
2784
  };
2771
2785
  const elementScroll = (offset, {
2772
2786
  adjustments = 0,
@@ -2805,7 +2819,10 @@ class Virtualizer {
2805
2819
  }
2806
2820
  return _ro = new this.targetWindow.ResizeObserver((entries) => {
2807
2821
  entries.forEach((entry) => {
2808
- this._measureElement(entry.target, entry);
2822
+ const run = () => {
2823
+ this._measureElement(entry.target, entry);
2824
+ };
2825
+ this.options.useAnimationFrameWithResizeObserver ? requestAnimationFrame(run) : run();
2809
2826
  });
2810
2827
  });
2811
2828
  };
@@ -2853,7 +2870,8 @@ class Virtualizer {
2853
2870
  isScrollingResetDelay: 150,
2854
2871
  enabled: true,
2855
2872
  isRtl: false,
2856
- useScrollendEvent: true,
2873
+ useScrollendEvent: false,
2874
+ useAnimationFrameWithResizeObserver: false,
2857
2875
  ...opts2
2858
2876
  };
2859
2877
  };
@@ -3042,12 +3060,18 @@ class Virtualizer {
3042
3060
  }
3043
3061
  );
3044
3062
  this.calculateRange = memo(
3045
- () => [this.getMeasurements(), this.getSize(), this.getScrollOffset()],
3046
- (measurements, outerSize, scrollOffset) => {
3063
+ () => [
3064
+ this.getMeasurements(),
3065
+ this.getSize(),
3066
+ this.getScrollOffset(),
3067
+ this.options.lanes
3068
+ ],
3069
+ (measurements, outerSize, scrollOffset, lanes) => {
3047
3070
  return this.range = measurements.length > 0 && outerSize > 0 ? calculateRange({
3048
3071
  measurements,
3049
3072
  outerSize,
3050
- scrollOffset
3073
+ scrollOffset,
3074
+ lanes
3051
3075
  }) : null;
3052
3076
  },
3053
3077
  {
@@ -3055,7 +3079,7 @@ class Virtualizer {
3055
3079
  debug: () => this.options.debug
3056
3080
  }
3057
3081
  );
3058
- this.getIndexes = memo(
3082
+ this.getVirtualIndexes = memo(
3059
3083
  () => {
3060
3084
  let startIndex = null;
3061
3085
  let endIndex = null;
@@ -3064,6 +3088,7 @@ class Virtualizer {
3064
3088
  startIndex = range.startIndex;
3065
3089
  endIndex = range.endIndex;
3066
3090
  }
3091
+ this.maybeNotify.updateDeps([this.isScrolling, startIndex, endIndex]);
3067
3092
  return [
3068
3093
  this.options.rangeExtractor,
3069
3094
  this.options.overscan,
@@ -3147,7 +3172,7 @@ class Virtualizer {
3147
3172
  this._measureElement(node, void 0);
3148
3173
  };
3149
3174
  this.getVirtualItems = memo(
3150
- () => [this.getIndexes(), this.getMeasurements()],
3175
+ () => [this.getVirtualIndexes(), this.getMeasurements()],
3151
3176
  (indexes, measurements) => {
3152
3177
  const virtualItems = [];
3153
3178
  for (let k = 0, len = indexes.length; k < len; k++) {
@@ -3176,20 +3201,18 @@ class Virtualizer {
3176
3201
  )]
3177
3202
  );
3178
3203
  };
3179
- this.getOffsetForAlignment = (toOffset, align) => {
3204
+ this.getOffsetForAlignment = (toOffset, align, itemSize = 0) => {
3180
3205
  const size = this.getSize();
3181
3206
  const scrollOffset = this.getScrollOffset();
3182
3207
  if (align === "auto") {
3183
- if (toOffset >= scrollOffset + size) {
3184
- align = "end";
3185
- }
3208
+ align = toOffset >= scrollOffset + size ? "end" : "start";
3186
3209
  }
3187
- if (align === "end") {
3210
+ if (align === "center") {
3211
+ toOffset += (itemSize - size) / 2;
3212
+ } else if (align === "end") {
3188
3213
  toOffset -= size;
3189
3214
  }
3190
- const scrollSizeProp = this.options.horizontal ? "scrollWidth" : "scrollHeight";
3191
- const scrollSize = this.scrollElement ? "document" in this.scrollElement ? this.scrollElement.document.documentElement[scrollSizeProp] : this.scrollElement[scrollSizeProp] : 0;
3192
- const maxOffset = scrollSize - size;
3215
+ const maxOffset = this.getTotalSize() - size;
3193
3216
  return Math.max(Math.min(maxOffset, toOffset), 0);
3194
3217
  };
3195
3218
  this.getOffsetForIndex = (index, align = "auto") => {
@@ -3209,27 +3232,11 @@ class Virtualizer {
3209
3232
  return [scrollOffset, align];
3210
3233
  }
3211
3234
  }
3212
- const centerOffset = item.start - this.options.scrollPaddingStart + (item.size - size) / 2;
3213
- switch (align) {
3214
- case "center":
3215
- return [this.getOffsetForAlignment(centerOffset, align), align];
3216
- case "end":
3217
- return [
3218
- this.getOffsetForAlignment(
3219
- item.end + this.options.scrollPaddingEnd,
3220
- align
3221
- ),
3222
- align
3223
- ];
3224
- default:
3225
- return [
3226
- this.getOffsetForAlignment(
3227
- item.start - this.options.scrollPaddingStart,
3228
- align
3229
- ),
3230
- align
3231
- ];
3232
- }
3235
+ const toOffset = align === "end" ? item.end + this.options.scrollPaddingEnd : item.start - this.options.scrollPaddingStart;
3236
+ return [
3237
+ this.getOffsetForAlignment(toOffset, align, item.size),
3238
+ align
3239
+ ];
3233
3240
  };
3234
3241
  this.isDynamicMode = () => this.elementsCache.size > 0;
3235
3242
  this.cancelScrollToIndex = () => {
@@ -3269,10 +3276,11 @@ class Virtualizer {
3269
3276
  this.options.getItemKey(index)
3270
3277
  );
3271
3278
  if (elementInDOM) {
3272
- const [latestOffset] = notUndefined(
3273
- this.getOffsetForIndex(index, align)
3274
- );
3275
- if (!approxEqual(latestOffset, this.getScrollOffset())) {
3279
+ const result = this.getOffsetForIndex(index, align);
3280
+ if (!result) return;
3281
+ const [latestOffset] = result;
3282
+ const currentScrollOffset = this.getScrollOffset();
3283
+ if (!approxEqual(latestOffset, currentScrollOffset)) {
3276
3284
  this.scrollToIndex(index, { align, behavior });
3277
3285
  }
3278
3286
  } else {
@@ -3299,10 +3307,19 @@ class Virtualizer {
3299
3307
  let end;
3300
3308
  if (measurements.length === 0) {
3301
3309
  end = this.options.paddingStart;
3310
+ } else if (this.options.lanes === 1) {
3311
+ end = ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0;
3302
3312
  } else {
3303
- end = this.options.lanes === 1 ? ((_a = measurements[measurements.length - 1]) == null ? void 0 : _a.end) ?? 0 : Math.max(
3304
- ...measurements.slice(-this.options.lanes).map((m) => m.end)
3305
- );
3313
+ const endByLane = Array(this.options.lanes).fill(null);
3314
+ let endIndex = measurements.length - 1;
3315
+ while (endIndex >= 0 && endByLane.some((val) => val === null)) {
3316
+ const item = measurements[endIndex];
3317
+ if (endByLane[item.lane] === null) {
3318
+ endByLane[item.lane] = item.end;
3319
+ }
3320
+ endIndex--;
3321
+ }
3322
+ end = Math.max(...endByLane.filter((val) => val !== null));
3306
3323
  }
3307
3324
  return Math.max(
3308
3325
  end - this.options.scrollMargin + this.options.paddingEnd,
@@ -3343,14 +3360,43 @@ const findNearestBinarySearch = (low, high, getCurrentValue, value) => {
3343
3360
  function calculateRange({
3344
3361
  measurements,
3345
3362
  outerSize,
3346
- scrollOffset
3363
+ scrollOffset,
3364
+ lanes
3347
3365
  }) {
3348
- const count = measurements.length - 1;
3366
+ const lastIndex = measurements.length - 1;
3349
3367
  const getOffset = (index) => measurements[index].start;
3350
- const startIndex = findNearestBinarySearch(0, count, getOffset, scrollOffset);
3368
+ if (measurements.length <= lanes) {
3369
+ return {
3370
+ startIndex: 0,
3371
+ endIndex: lastIndex
3372
+ };
3373
+ }
3374
+ let startIndex = findNearestBinarySearch(
3375
+ 0,
3376
+ lastIndex,
3377
+ getOffset,
3378
+ scrollOffset
3379
+ );
3351
3380
  let endIndex = startIndex;
3352
- while (endIndex < count && measurements[endIndex].end < scrollOffset + outerSize) {
3353
- endIndex++;
3381
+ if (lanes === 1) {
3382
+ while (endIndex < lastIndex && measurements[endIndex].end < scrollOffset + outerSize) {
3383
+ endIndex++;
3384
+ }
3385
+ } else if (lanes > 1) {
3386
+ const endPerLane = Array(lanes).fill(0);
3387
+ while (endIndex < lastIndex && endPerLane.some((pos) => pos < scrollOffset + outerSize)) {
3388
+ const item = measurements[endIndex];
3389
+ endPerLane[item.lane] = item.end;
3390
+ endIndex++;
3391
+ }
3392
+ const startPerLane = Array(lanes).fill(scrollOffset + outerSize);
3393
+ while (startIndex >= 0 && startPerLane.some((pos) => pos >= scrollOffset)) {
3394
+ const item = measurements[startIndex];
3395
+ startPerLane[item.lane] = item.start;
3396
+ startIndex--;
3397
+ }
3398
+ startIndex = Math.max(0, startIndex - startIndex % lanes);
3399
+ endIndex = Math.min(lastIndex, endIndex + (lanes - 1 - endIndex % lanes));
3354
3400
  }
3355
3401
  return { startIndex, endIndex };
3356
3402
  }
@@ -5210,4 +5256,4 @@ function Content() {
5210
5256
  export {
5211
5257
  Content as default
5212
5258
  };
5213
- //# sourceMappingURL=content-BnL67474.js.map
5259
+ //# sourceMappingURL=content-Bnjc15M3.js.map