@txnlab/use-wallet-ui-react 1.2.1 → 1.4.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 (65) hide show
  1. package/README.md +121 -18
  2. package/dist/cjs/chunks/{floating-ui.react-O3sXJ80G.cjs → floating-ui.react-ChfuPAKc.cjs} +1 -1
  3. package/dist/cjs/chunks/{floating-ui.react-O3sXJ80G.cjs.map → floating-ui.react-ChfuPAKc.cjs.map} +1 -1
  4. package/dist/cjs/chunks/passkey-C8Dw6sNL.cjs +2 -0
  5. package/dist/cjs/chunks/passkey-C8Dw6sNL.cjs.map +1 -0
  6. package/dist/cjs/index.cjs +14 -14
  7. package/dist/cjs/index.cjs.map +1 -1
  8. package/dist/cjs/plugins/export-key.cjs +2 -2
  9. package/dist/cjs/plugins/export-key.cjs.map +1 -1
  10. package/dist/cjs/plugins/passkey.cjs +2 -0
  11. package/dist/cjs/plugins/passkey.cjs.map +1 -0
  12. package/dist/esm/chunks/{floating-ui.react-Co7v2aHO.js → floating-ui.react-CxJSDrxv.js} +1 -1
  13. package/dist/esm/chunks/{floating-ui.react-Co7v2aHO.js.map → floating-ui.react-CxJSDrxv.js.map} +1 -1
  14. package/dist/esm/chunks/passkey-BbgvIGki.js +44 -0
  15. package/dist/esm/chunks/passkey-BbgvIGki.js.map +1 -0
  16. package/dist/esm/index.js +2888 -2601
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/plugins/export-key.js +13 -12
  19. package/dist/esm/plugins/export-key.js.map +1 -1
  20. package/dist/esm/plugins/passkey.js +578 -0
  21. package/dist/esm/plugins/passkey.js.map +1 -0
  22. package/dist/style.css +152 -0
  23. package/dist/types/components/ConnectWalletMenu.d.ts +7 -1
  24. package/dist/types/components/ConnectWalletMenu.d.ts.map +1 -1
  25. package/dist/types/components/ConnectedWalletMenu.d.ts.map +1 -1
  26. package/dist/types/components/PasskeyConnect.d.ts +29 -0
  27. package/dist/types/components/PasskeyConnect.d.ts.map +1 -0
  28. package/dist/types/components/WalletButton.d.ts +7 -1
  29. package/dist/types/components/WalletButton.d.ts.map +1 -1
  30. package/dist/types/components/WalletGroupLabel.d.ts +6 -0
  31. package/dist/types/components/WalletGroupLabel.d.ts.map +1 -0
  32. package/dist/types/components/WalletIcon.d.ts +6 -0
  33. package/dist/types/components/WalletIcon.d.ts.map +1 -0
  34. package/dist/types/components/WalletList.d.ts.map +1 -1
  35. package/dist/types/index.d.cts +5 -0
  36. package/dist/types/index.d.ts +5 -0
  37. package/dist/types/index.d.ts.map +1 -1
  38. package/dist/types/plugins/passkey/PasskeyDisclosure.d.ts +11 -0
  39. package/dist/types/plugins/passkey/PasskeyDisclosure.d.ts.map +1 -0
  40. package/dist/types/plugins/passkey/PasskeyRecoveryDialog.d.ts +10 -0
  41. package/dist/types/plugins/passkey/PasskeyRecoveryDialog.d.ts.map +1 -0
  42. package/dist/types/plugins/passkey/PasskeyRecoveryMenuButton.d.ts +5 -0
  43. package/dist/types/plugins/passkey/PasskeyRecoveryMenuButton.d.ts.map +1 -0
  44. package/dist/types/plugins/passkey/PasskeySessionControl.d.ts +6 -0
  45. package/dist/types/plugins/passkey/PasskeySessionControl.d.ts.map +1 -0
  46. package/dist/types/plugins/passkey/constants.d.ts +3 -0
  47. package/dist/types/plugins/passkey/constants.d.ts.map +1 -0
  48. package/dist/types/plugins/passkey/index.d.cts +36 -0
  49. package/dist/types/plugins/passkey/index.d.ts +36 -0
  50. package/dist/types/plugins/passkey/index.d.ts.map +1 -0
  51. package/dist/types/plugins/passkey/index.test.d.ts +2 -0
  52. package/dist/types/plugins/passkey/index.test.d.ts.map +1 -0
  53. package/dist/types/plugins/passkey/storage.d.ts +5 -0
  54. package/dist/types/plugins/passkey/storage.d.ts.map +1 -0
  55. package/dist/types/plugins/passkey/storage.test.d.ts +2 -0
  56. package/dist/types/plugins/passkey/storage.test.d.ts.map +1 -0
  57. package/dist/types/plugins/passkey/usePasskeyAdapter.d.ts +10 -0
  58. package/dist/types/plugins/passkey/usePasskeyAdapter.d.ts.map +1 -0
  59. package/dist/types/providers/WalletUIProvider.d.ts +15 -1
  60. package/dist/types/providers/WalletUIProvider.d.ts.map +1 -1
  61. package/dist/types/utils/passkey.d.ts +59 -0
  62. package/dist/types/utils/passkey.d.ts.map +1 -0
  63. package/dist/types/utils/passkey.test.d.ts +2 -0
  64. package/dist/types/utils/passkey.test.d.ts.map +1 -0
  65. package/package.json +16 -4
package/README.md CHANGED
@@ -18,31 +18,45 @@ Ready-to-use React UI components for Algorand wallet integration, built as a com
18
18
  - [Hooks](#hooks)
19
19
  - [Tanstack Query Integration](#tanstack-query-integration)
20
20
  - [Plugins](#plugins)
21
+ - [Passkey Wallet](#passkey-wallet)
21
22
  - [Migration from v0.x](#migration-from-v0x)
22
23
  - [License](#license)
23
24
 
24
25
  ## Installation
25
26
 
26
27
  ```bash
27
- npm install @txnlab/use-wallet-ui-react
28
+ npm install @txnlab/use-wallet-ui-react @txnlab/use-wallet-react algosdk
28
29
  # or
29
- yarn add @txnlab/use-wallet-ui-react
30
+ yarn add @txnlab/use-wallet-ui-react @txnlab/use-wallet-react algosdk
30
31
  # or
31
- pnpm add @txnlab/use-wallet-ui-react
32
+ pnpm add @txnlab/use-wallet-ui-react @txnlab/use-wallet-react algosdk
32
33
  # or
33
- bun add @txnlab/use-wallet-ui-react
34
+ bun add @txnlab/use-wallet-ui-react @txnlab/use-wallet-react algosdk
35
+ ```
36
+
37
+ With use-wallet v5, each wallet is a separate adapter package. Install the ones you support:
38
+
39
+ ```bash
40
+ npm install @perawallet/use-wallet-pera @txnlab/use-wallet-defly @galaxypay/use-wallet-lute @txnlab/use-wallet-exodus @txnlab/use-wallet-walletconnect
34
41
  ```
35
42
 
36
43
  ### Requirements
37
44
 
38
- - `@txnlab/use-wallet-react` v4+
39
- - `algosdk` v3+
45
+ - `@txnlab/use-wallet-react` v4.6+ or v5 (v5 recommended)
46
+ - `algosdk` v3 (v3.7+ with use-wallet v5.1+)
40
47
  - React 18 or 19
41
48
 
49
+ Upgrading from use-wallet v4? See the [use-wallet migration guide](https://txnlab.gitbook.io/use-wallet/guides/migrating-from-v4.x). Only the `WalletManager` configuration changes. This library's components work the same way on both versions.
50
+
42
51
  ## Quick Start
43
52
 
44
53
  ```jsx
45
- import { NetworkId, WalletId, WalletManager, WalletProvider } from '@txnlab/use-wallet-react'
54
+ import { lute } from '@galaxypay/use-wallet-lute'
55
+ import { pera } from '@perawallet/use-wallet-pera'
56
+ import { defly } from '@txnlab/use-wallet-defly'
57
+ import { exodus } from '@txnlab/use-wallet-exodus'
58
+ import { NetworkId, WalletManager, WalletProvider } from '@txnlab/use-wallet-react'
59
+ import { walletConnect } from '@txnlab/use-wallet-walletconnect'
46
60
  import { WalletUIProvider, WalletButton } from '@txnlab/use-wallet-ui-react'
47
61
 
48
62
  // Import styles if NOT using Tailwind CSS
@@ -50,14 +64,11 @@ import '@txnlab/use-wallet-ui-react/dist/style.css'
50
64
 
51
65
  const walletManager = new WalletManager({
52
66
  wallets: [
53
- WalletId.PERA,
54
- WalletId.DEFLY,
55
- WalletId.LUTE,
56
- WalletId.EXODUS,
57
- {
58
- id: WalletId.WALLETCONNECT,
59
- options: { projectId: 'your-project-id' },
60
- },
67
+ pera(),
68
+ defly(),
69
+ lute(),
70
+ exodus(),
71
+ walletConnect({ projectId: 'your-project-id' }),
61
72
  ],
62
73
  defaultNetwork: NetworkId.TESTNET,
63
74
  })
@@ -76,7 +87,7 @@ function App() {
76
87
  The `WalletButton` handles everything:
77
88
 
78
89
  - Shows "Connect Wallet" when disconnected
79
- - Opens wallet selection dialog
90
+ - Opens wallet selection dialog (on v5, lists only the wallets the active network supports)
80
91
  - Displays wallet address/NFD name and avatar when connected
81
92
  - Provides account switching and disconnect options
82
93
 
@@ -312,6 +323,7 @@ Required wrapper that enables theming, NFD lookups, and data prefetching.
312
323
  enablePrefetching={true} // Prefetch data for all wallet accounts
313
324
  prefetchNfdView="thumbnail" // NFD data view: 'tiny' | 'thumbnail' | 'brief' | 'full'
314
325
  queryClient={queryClient} // Optional: your existing Tanstack Query client
326
+ passkeyLayout="list" // Passkey wallet layout: 'list' | 'featured'
315
327
  >
316
328
  {children}
317
329
  </WalletUIProvider>
@@ -326,6 +338,7 @@ All-in-one wallet connection component.
326
338
  size="md" // 'sm' | 'md' | 'lg'
327
339
  className="..." // Additional CSS classes
328
340
  style={{...}} // Inline styles (supports CSS variable overrides)
341
+ passkeyLayout="featured" // Optional: overrides WalletUIProvider's passkeyLayout
329
342
  />
330
343
  ```
331
344
 
@@ -346,6 +359,9 @@ Dropdown menu for wallet selection (disconnected state).
346
359
  <ConnectWalletMenu>
347
360
  <button>My Custom Button</button>
348
361
  </ConnectWalletMenu>
362
+
363
+ // With its own passkey layout (overrides WalletUIProvider's passkeyLayout)
364
+ <ConnectWalletMenu passkeyLayout="featured" />
349
365
  ```
350
366
 
351
367
  ### ConnectWalletButton
@@ -416,12 +432,31 @@ function Profile() {
416
432
 
417
433
  ### WalletList
418
434
 
419
- Renders a list of available wallets (used internally by ConnectWalletMenu).
435
+ Renders a list of wallets (used internally by ConnectWalletMenu). The dialog renders the passkey wallet in its own section above the list, so pass the other wallets here.
436
+
437
+ ```jsx
438
+ <WalletList
439
+ wallets={wallets}
440
+ handleWalletClick={(wallet) => wallet.connect()}
441
+ />
442
+ ```
443
+
444
+ ### PasskeyConnect
445
+
446
+ The passkey section of the connect dialog, for custom connect menus. Signing in (**Continue with passkey**, or **Sign in with passkey** in the list layout) calls `handleWalletClick(wallet)`, and **Create a passkey** calls `handleWalletClick(wallet, { create: true })`. Forward `args` to `wallet.connect(args)` before any `await`, or Safari and iOS browsers drop the passkey prompt. Pass `status` (`{ walletId, pending, error }`) to disable the controls while the prompt is open and to show an error.
420
447
 
421
448
  ```jsx
422
- <WalletList onWalletSelected={() => closeMenu()} />
449
+ <PasskeyConnect
450
+ wallet={passkeyWallet}
451
+ handleWalletClick={(wallet, args) => wallet.connect(args)}
452
+ layout="list" // 'list' (default) | 'featured'
453
+ showLabel={true} // 'list' only: show the "Passkey" group label
454
+ />
423
455
  ```
424
456
 
457
+ In the list layout, label your own wallet group to match (the dialog uses "Wallets").
458
+
459
+
425
460
  ## Hooks
426
461
 
427
462
  ### useNfd
@@ -571,6 +606,74 @@ function App() {
571
606
 
572
607
  See the [Plugin Architecture Guide](PLUGINS.md) for full documentation.
573
608
 
609
+ ## Passkey Wallet
610
+
611
+ [`@txnlab/use-wallet-passkey`](https://github.com/TxnLab/use-wallet/tree/main/packages/wallets/passkey#readme) (use-wallet 5.2+) derives an app-scoped Falcon-1024 account from a passkey. Register it, and the connect dialog shows a Passkey group with **Sign in with passkey** and **Create a passkey**, above your other wallets. The [`passkeyLayout`](#passkey-layout) option can lead with a **Continue with passkey** button instead. A missing passkey and a cancelled prompt raise the same browser error, so creating stays a separate choice.
612
+
613
+ ```bash
614
+ npm install @txnlab/use-wallet-passkey
615
+ ```
616
+
617
+ ```tsx
618
+ import { lute } from '@galaxypay/use-wallet-lute'
619
+ import { pera } from '@perawallet/use-wallet-pera'
620
+ import { passkey } from '@txnlab/use-wallet-passkey'
621
+ import { WalletManager, WalletProvider } from '@txnlab/use-wallet-react'
622
+ import { WalletButton, WalletUIProvider } from '@txnlab/use-wallet-ui-react'
623
+ import { passkeyPlugin } from '@txnlab/use-wallet-ui-react/plugins/passkey'
624
+
625
+ const manager = new WalletManager({
626
+ wallets: [passkey({ session: true }), lute(), pera()],
627
+ })
628
+
629
+ const plugins = [passkeyPlugin({ session: true })]
630
+
631
+ function App() {
632
+ return (
633
+ <WalletProvider manager={manager}>
634
+ <WalletUIProvider plugins={plugins}>
635
+ <WalletButton />
636
+ </WalletUIProvider>
637
+ </WalletProvider>
638
+ )
639
+ }
640
+ ```
641
+
642
+ The connect dialog:
643
+
644
+ - Starts the passkey prompt straight from the tap, as Safari and iOS browsers require
645
+ - While the prompt is open, shows "Waiting for your passkey…" on the control the user pressed and dims the other
646
+ - Stays open on passkey errors and explains them: a cancelled or timed-out prompt (or no passkey found), an in-app browser (open the page in Safari or Chrome), or a passkey provider without the PRF extension (try another provider)
647
+
648
+ The connected wallet menu tags a passkey account with its domain (for example, `Passkey · localhost`), since the account belongs to the site that created it.
649
+
650
+ `passkeyPlugin()` adds to the connected wallet menu, only while the passkey wallet is active:
651
+
652
+ - **Back up account**: a dialog that reveals the account's 25-word recovery phrase after a fresh passkey prompt, and tells users to import it as a Falcon / quantum account (in Lute, Add account → Falcon25 account → Import; in Pera, the quantum import). It hides the phrase after a timeout and clears the clipboard when it closes, if it can.
653
+ - **Session status** (with `session: true`): Locked or Unlocked, with Unlock and Lock buttons
654
+ - **A note on whose account it is** (with `disclosure: true`): "This account is created by and for example.com. Keep only what you need here, and move larger amounts to a wallet you control." It shows until the user chooses **Got it**, once per account.
655
+
656
+ The plugin uses `useWalletManager()`, so it requires `@txnlab/use-wallet-react` 5.2 or later, which any app with the passkey wallet has. The main entry still supports v4.6+. See [Passkey Plugin](PLUGINS.md#passkey-plugin) for options, and the adapter's [security model](https://github.com/TxnLab/use-wallet/tree/main/packages/wallets/passkey#security-model) before you ship it.
657
+
658
+ For your own connect UI, `getPasskeyErrorMessage(error)` returns a message for a `PasskeyError`, or `null` for any other error.
659
+
660
+ ### Passkey layout
661
+
662
+ Choose how the connect dialog presents the passkey wallet with `passkeyLayout`:
663
+
664
+ - **`'list'`** (default): **Sign in with passkey** and **Create a passkey** rows in a "Passkey" group, above a "Wallets" group. For crypto-native apps where most users bring a wallet like Pera or Lute, and the passkey is one choice among many.
665
+ - **`'featured'`**: a full-width **Continue with passkey** button and a "New here? **Create a passkey**" link, then the other wallets under "or connect a wallet". For consumer apps where most users have no wallet, so the passkey is the main way in.
666
+
667
+ ```tsx
668
+ // App-wide
669
+ <WalletUIProvider passkeyLayout="featured">
670
+
671
+ // Per menu: a WalletButton or ConnectWalletMenu prop wins over the provider
672
+ <WalletButton passkeyLayout="list" />
673
+ ```
674
+
675
+ With only the passkey wallet configured, neither layout shows the other-wallets heading. Without a passkey wallet, the dialog is the same in both.
676
+
574
677
  ## License
575
678
 
576
679
  MIT
@@ -2,4 +2,4 @@
2
2
  * tabbable 6.2.0
3
3
  * @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
4
4
  */var rr=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],Ge=rr.join(","),bn=typeof Element>"u",De=bn?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Ze=!bn&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Je=function e(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),i=o===""||o==="true",s=i||n&&t&&e(t.parentNode);return s},or=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},vn=function(t,n,r){if(Je(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(Ge));return n&&De.call(t,Ge)&&o.unshift(t),o=o.filter(r),o},yn=function e(t,n,r){for(var o=[],i=Array.from(t);i.length;){var s=i.shift();if(!Je(s,!1))if(s.tagName==="SLOT"){var c=s.assignedElements(),l=c.length?c:s.children,a=e(l,!0,r);r.flatten?o.push.apply(o,a):o.push({scopeParent:s,candidates:a})}else{var u=De.call(s,Ge);u&&r.filter(s)&&(n||!t.includes(s))&&o.push(s);var d=s.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(s),p=!Je(d,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(s));if(d&&p){var f=e(d===!0?s.children:d.children,!0,r);r.flatten?o.push.apply(o,f):o.push({scopeParent:s,candidates:f})}else i.unshift.apply(i,s.children)}}return o},wn=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},xn=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||or(t))&&!wn(t)?0:t.tabIndex},ir=function(t,n){var r=xn(t);return r<0&&n&&!wn(t)?0:r},sr=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},Rn=function(t){return t.tagName==="INPUT"},cr=function(t){return Rn(t)&&t.type==="hidden"},lr=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},ar=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},ur=function(t){if(!t.name)return!0;var n=t.form||Ze(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(s){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",s.message),!1}var i=ar(o,t.form);return!i||i===t},fr=function(t){return Rn(t)&&t.type==="radio"},dr=function(t){return fr(t)&&!ur(t)},mr=function(t){var n,r=t&&Ze(t),o=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==t){var s,c,l;for(i=!!((s=o)!==null&&s!==void 0&&(c=s.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(l=t.ownerDocument)!==null&&l!==void 0&&l.contains(t));!i&&o;){var a,u,d;r=Ze(o),o=(a=r)===null||a===void 0?void 0:a.host,i=!!((u=o)!==null&&u!==void 0&&(d=u.ownerDocument)!==null&&d!==void 0&&d.contains(o))}}return i},Nt=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},gr=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(getComputedStyle(t).visibility==="hidden")return!0;var i=De.call(t,"details>summary:first-of-type"),s=i?t.parentElement:t;if(De.call(s,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="legacy-full"){if(typeof o=="function"){for(var c=t;t;){var l=t.parentElement,a=Ze(t);if(l&&!l.shadowRoot&&o(l)===!0)return Nt(t);t.assignedSlot?t=t.assignedSlot:!l&&a!==t.ownerDocument?t=a.host:t=l}t=c}if(mr(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Nt(t);return!1},pr=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return De.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},wt=function(t,n){return!(n.disabled||Je(n)||cr(n)||gr(n,t)||lr(n)||pr(n))},xt=function(t,n){return!(dr(n)||xn(n)<0||!wt(t,n))},hr=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},br=function e(t){var n=[],r=[];return t.forEach(function(o,i){var s=!!o.scopeParent,c=s?o.scopeParent:o,l=ir(c,s),a=s?e(o.candidates):c;l===0?s?n.push.apply(n,a):n.push(c):r.push({documentOrder:i,tabIndex:l,item:o,isScope:s,content:a})}),r.sort(sr).reduce(function(o,i){return i.isScope?o.push.apply(o,i.content):o.push(i.content),o},[]).concat(n)},it=function(t,n){n=n||{};var r;return n.getShadowRoot?r=yn([t],n.includeContainer,{filter:xt.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:hr}):r=vn(t,n.includeContainer,xt.bind(null,n)),br(r)},vr=function(t,n){n=n||{};var r;return n.getShadowRoot?r=yn([t],n.includeContainer,{filter:wt.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=vn(t,n.includeContainer,wt.bind(null,n)),r},En=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return De.call(t,Ge)===!1?!1:xt(n,t)};function Sn(){const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform}function Tn(){const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(t=>{let{brand:n,version:r}=t;return n+"/"+r}).join(" "):navigator.userAgent}function yr(){return/apple/i.test(navigator.vendor)}function Rt(){const e=/android/i;return e.test(Sn())||e.test(Tn())}function wr(){return Tn().includes("jsdom/")}const _t="data-floating-ui-focusable",xr="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])";function Oe(e){let t=e.activeElement;for(;((n=t)==null||(n=n.shadowRoot)==null?void 0:n.activeElement)!=null;){var n;t=t.shadowRoot.activeElement}return t}function G(e,t){if(!e||!t)return!1;const n=t.getRootNode==null?void 0:t.getRootNode();if(e.contains(t))return!0;if(n&&Xe(n)){let r=t;for(;r;){if(e===r)return!0;r=r.parentNode||r.host}}return!1}function be(e){return"composedPath"in e?e.composedPath()[0]:e.target}function ft(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function Rr(e){return e.matches("html,body")}function oe(e){return(e==null?void 0:e.ownerDocument)||document}function Cn(e){return q(e)&&e.matches(xr)}function $t(e){return e?e.getAttribute("role")==="combobox"&&Cn(e):!1}function Et(e){return e?e.hasAttribute(_t)?e:e.querySelector("["+_t+"]")||e:null}function Ie(e,t,n){return n===void 0&&(n=!0),e.filter(o=>{var i;return o.parentId===t&&(!n||((i=o.context)==null?void 0:i.open))}).flatMap(o=>[o,...Ie(e,o.id,n)])}function Wt(e,t){var n;let r=[],o=(n=e.find(i=>i.id===t))==null?void 0:n.parentId;for(;o;){const i=e.find(s=>s.id===o);o=i==null?void 0:i.parentId,i&&(r=r.concat(i))}return r}function dt(e){e.preventDefault(),e.stopPropagation()}function Er(e){return"nativeEvent"in e}function Sr(e){return e.mozInputSource===0&&e.isTrusted?!0:Rt()&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function Tr(e){return wr()?!1:!Rt()&&e.width===0&&e.height===0||Rt()&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType==="mouse"||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType==="touch"}function Bt(e,t){return["mouse","pen"].includes(e)}var Cr=typeof document<"u",Ar=function(){},Z=Cr?Tt.useLayoutEffect:Ar;const Or={...g};function mt(e){const t=g.useRef(e);return Z(()=>{t.current=e}),t}const Ir=Or.useInsertionEffect,Mr=Ir||(e=>e());function se(e){const t=g.useRef(()=>{if(process.env.NODE_ENV!=="production")throw new Error("Cannot call an event handler while rendering.")});return Mr(()=>{t.current=e}),g.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}const We=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function An(e,t){const n=it(e,We()),r=n.length;if(r===0)return;const o=Oe(oe(e)),i=n.indexOf(o),s=i===-1?t===1?0:r-1:i+t;return n[s]}function On(e){return An(oe(e).body,1)||e}function In(e){return An(oe(e).body,-1)||e}function Fe(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!G(n,r)}function Pr(e){it(e,We()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Vt(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function jt(e,t,n){let{reference:r,floating:o}=e;const i=fe(t),s=hn(t),c=pn(s),l=we(t),a=i==="y",u=r.x+r.width/2-o.width/2,d=r.y+r.height/2-o.height/2,p=r[c]/2-o[c]/2;let f;switch(l){case"top":f={x:u,y:r.y-o.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:d};break;case"left":f={x:r.x-o.width,y:d};break;default:f={x:r.x,y:r.y}}switch($e(t)){case"start":f[s]-=p*(n&&a?-1:1);break;case"end":f[s]+=p*(n&&a?-1:1);break}return f}async function Mn(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:i,rects:s,elements:c,strategy:l}=e,{boundary:a="clippingAncestors",rootBoundary:u="viewport",elementContext:d="floating",altBoundary:p=!1,padding:f=0}=ke(t,e),h=nr(f),x=c[p?d==="floating"?"reference":"floating":d],y=ze(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(x)))==null||n?x:x.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(c.floating)),boundary:a,rootBoundary:u,strategy:l})),b=d==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,v=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c.floating)),S=await(i.isElement==null?void 0:i.isElement(v))?await(i.getScale==null?void 0:i.getScale(v))||{x:1,y:1}:{x:1,y:1},A=ze(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:b,offsetParent:v,strategy:l}):b);return{top:(y.top-A.top+h.top)/S.y,bottom:(A.bottom-y.bottom+h.bottom)/S.y,left:(y.left-A.left+h.left)/S.x,right:(A.right-y.right+h.right)/S.x}}const Dr=50,kr=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:i=[],platform:s}=n,c=s.detectOverflow?s:{...s,detectOverflow:Mn},l=await(s.isRTL==null?void 0:s.isRTL(t));let a=await s.getElementRects({reference:e,floating:t,strategy:o}),{x:u,y:d}=jt(a,r,l),p=r,f=0;const h={};for(let m=0;m<i.length;m++){const x=i[m];if(!x)continue;const{name:y,fn:b}=x,{x:v,y:S,data:A,reset:O}=await b({x:u,y:d,initialPlacement:r,placement:p,strategy:o,middlewareData:h,rects:a,platform:c,elements:{reference:e,floating:t}});u=v??u,d=S??d,h[y]={...h[y],...A},O&&f<Dr&&(f++,typeof O=="object"&&(O.placement&&(p=O.placement),O.rects&&(a=O.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:o}):O.rects),{x:u,y:d}=jt(a,p,l)),m=-1)}return{x:u,y:d,placement:p,strategy:o,middlewareData:h}},Fr=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:i,rects:s,initialPlacement:c,platform:l,elements:a}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=!0,...x}=ke(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const y=we(o),b=fe(c),v=we(c)===c,S=await(l.isRTL==null?void 0:l.isRTL(a.floating)),A=p||(v||!m?[Ye(c)]:Gn(c)),O=h!=="none";!p&&O&&A.push(...er(c,m,h,S));const M=[c,...A],_=await l.detectOverflow(t,x),K=[];let B=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&K.push(_[y]),d){const R=zn(o,s,S);K.push(_[R[0]],_[R[1]])}if(B=[...B,{placement:o,overflows:K}],!K.every(R=>R<=0)){var $,X;const R=((($=i.flip)==null?void 0:$.index)||0)+1,E=M[R];if(E&&(!(d==="alignment"?b!==fe(E):!1)||B.every(w=>fe(w.placement)===b?w.overflows[0]>0:!0)))return{data:{index:R,overflows:B},reset:{placement:E}};let k=(X=B.filter(L=>L.overflows[0]<=0).sort((L,w)=>L.overflows[1]-w.overflows[1])[0])==null?void 0:X.placement;if(!k)switch(f){case"bestFit":{var j;const L=(j=B.filter(w=>{if(O){const I=fe(w.placement);return I===b||I==="y"}return!0}).map(w=>[w.placement,w.overflows.filter(I=>I>0).reduce((I,N)=>I+N,0)]).sort((w,I)=>w[1]-I[1])[0])==null?void 0:j[0];L&&(k=L);break}case"initialPlacement":k=c;break}if(o!==k)return{reset:{placement:k}}}return{}}}},Lr=new Set(["left","top"]);async function Nr(e,t){const{placement:n,platform:r,elements:o}=e,i=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=we(n),c=$e(n),l=fe(n)==="y",a=Lr.has(s)?-1:1,u=i&&l?-1:1,d=ke(t,e);let{mainAxis:p,crossAxis:f,alignmentAxis:h}=typeof d=="number"?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return c&&typeof h=="number"&&(f=c==="end"?h*-1:h),l?{x:f*u,y:p*a}:{x:p*a,y:f*u}}const _r=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:i,placement:s,middlewareData:c}=t,l=await Nr(t,e);return s===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:i+l.y,data:{...l,placement:s}}}}},$r=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:i}=t,{mainAxis:s=!0,crossAxis:c=!1,limiter:l={fn:y=>{let{x:b,y:v}=y;return{x:b,y:v}}},...a}=ke(e,t),u={x:n,y:r},d=await i.detectOverflow(t,a),p=fe(we(o)),f=gn(p);let h=u[f],m=u[p];if(s){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",v=h+d[y],S=h-d[b];h=kt(v,h,S)}if(c){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",v=m+d[y],S=m-d[b];m=kt(v,m,S)}const x=l.fn({...t,[f]:h,[p]:m});return{...x,data:{x:x.x-n,y:x.y-r,enabled:{[f]:s,[p]:c}}}}}},Wr=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:i,platform:s,elements:c}=t,{apply:l=()=>{},...a}=ke(e,t),u=await s.detectOverflow(t,a),d=we(o),p=$e(o),f=fe(o)==="y",{width:h,height:m}=i.floating;let x,y;d==="top"||d==="bottom"?(x=d,y=p===(await(s.isRTL==null?void 0:s.isRTL(c.floating))?"start":"end")?"left":"right"):(y=d,x=p==="end"?"top":"bottom");const b=m-u.top-u.bottom,v=h-u.left-u.right,S=Se(m-u[x],b),A=Se(h-u[y],v),O=!t.middlewareData.shift;let M=S,_=A;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(_=v),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(M=b),O&&!p){const B=Y(u.left,0),$=Y(u.right,0),X=Y(u.top,0),j=Y(u.bottom,0);f?_=h-2*(B!==0||$!==0?B+$:Y(u.left,u.right)):M=m-2*(X!==0||j!==0?X+j:Y(u.top,u.bottom))}await l({...t,availableWidth:_,availableHeight:M});const K=await s.getDimensions(c.floating);return h!==K.width||m!==K.height?{reset:{rects:!0}}:{}}}};function Pn(e){const t=ne(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=q(e),i=o?e.offsetWidth:n,s=o?e.offsetHeight:r,c=Le(n)!==i||Le(r)!==s;return c&&(n=i,r=s),{width:n,height:r,$:c}}function Ot(e){return W(e)?e:e.contextElement}function Me(e){const t=Ot(e);if(!q(t))return ce(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:i}=Pn(t);let s=(i?Le(n.width):n.width)/r,c=(i?Le(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!c||!Number.isFinite(c))&&(c=1),{x:s,y:c}}const Br=ce(0);function Dn(e){const t=J(e);return!rt()||!t.visualViewport?Br:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Vr(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==J(e)?!1:t}function Te(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),i=Ot(e);let s=ce(1);t&&(r?W(r)&&(s=Me(r)):s=Me(e));const c=Vr(i,n,r)?Dn(i):ce(0);let l=(o.left+c.x)/s.x,a=(o.top+c.y)/s.y,u=o.width/s.x,d=o.height/s.y;if(i){const p=J(i),f=r&&W(r)?J(r):r;let h=p,m=vt(h);for(;m&&r&&f!==h;){const x=Me(m),y=m.getBoundingClientRect(),b=ne(m),v=y.left+(m.clientLeft+parseFloat(b.paddingLeft))*x.x,S=y.top+(m.clientTop+parseFloat(b.paddingTop))*x.y;l*=x.x,a*=x.y,u*=x.x,d*=x.y,l+=v,a+=S,h=J(m),m=vt(h)}}return ze({width:u,height:d,x:l,y:a})}function st(e,t){const n=ot(e).scrollLeft;return t?t.left+n:Te(le(e)).left+n}function kn(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-st(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function jr(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const i=o==="fixed",s=le(r),c=t?nt(t.floating):!1;if(r===s||c&&i)return n;let l={scrollLeft:0,scrollTop:0},a=ce(1);const u=ce(0),d=q(r);if((d||!d&&!i)&&((xe(r)!=="body"||_e(s))&&(l=ot(r)),d)){const f=Te(r);a=Me(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const p=s&&!d&&!i?kn(s,l):ce(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-l.scrollLeft*a.x+u.x+p.x,y:n.y*a.y-l.scrollTop*a.y+u.y+p.y}}function Hr(e){return Array.from(e.getClientRects())}function qr(e){const t=le(e),n=ot(e),r=e.ownerDocument.body,o=Y(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),i=Y(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+st(e);const c=-n.scrollTop;return ne(r).direction==="rtl"&&(s+=Y(t.clientWidth,r.clientWidth)-o),{width:o,height:i,x:s,y:c}}const Ht=25;function Kr(e,t){const n=J(e),r=le(e),o=n.visualViewport;let i=r.clientWidth,s=r.clientHeight,c=0,l=0;if(o){i=o.width,s=o.height;const u=rt();(!u||u&&t==="fixed")&&(c=o.offsetLeft,l=o.offsetTop)}const a=st(r);if(a<=0){const u=r.ownerDocument,d=u.body,p=getComputedStyle(d),f=u.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(r.clientWidth-d.clientWidth-f);h<=Ht&&(i-=h)}else a<=Ht&&(i+=a);return{width:i,height:s,x:c,y:l}}function Ur(e,t){const n=Te(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,i=q(e)?Me(e):ce(1),s=e.clientWidth*i.x,c=e.clientHeight*i.y,l=o*i.x,a=r*i.y;return{width:s,height:c,x:l,y:a}}function qt(e,t,n){let r;if(t==="viewport")r=Kr(e,n);else if(t==="document")r=qr(le(e));else if(W(t))r=Ur(t,n);else{const o=Dn(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return ze(r)}function Fn(e,t){const n=me(e);return n===t||!W(n)||de(n)?!1:ne(n).position==="fixed"||Fn(n,t)}function Xr(e,t){const n=t.get(e);if(n)return n;let r=ye(e,[],!1).filter(c=>W(c)&&xe(c)!=="body"),o=null;const i=ne(e).position==="fixed";let s=i?me(e):e;for(;W(s)&&!de(s);){const c=ne(s),l=At(s);!l&&c.position==="fixed"&&(o=null),(i?!l&&!o:!l&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||_e(s)&&!l&&Fn(e,s))?r=r.filter(u=>u!==s):o=c,s=me(s)}return t.set(e,r),r}function Yr(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const s=[...n==="clippingAncestors"?nt(t)?[]:Xr(t,this._c):[].concat(n),r],c=qt(t,s[0],o);let l=c.top,a=c.right,u=c.bottom,d=c.left;for(let p=1;p<s.length;p++){const f=qt(t,s[p],o);l=Y(f.top,l),a=Se(f.right,a),u=Se(f.bottom,u),d=Y(f.left,d)}return{width:a-d,height:u-l,x:d,y:l}}function zr(e){const{width:t,height:n}=Pn(e);return{width:t,height:n}}function Gr(e,t,n){const r=q(t),o=le(t),i=n==="fixed",s=Te(e,!0,i,t);let c={scrollLeft:0,scrollTop:0};const l=ce(0);function a(){l.x=st(o)}if(r||!r&&!i)if((xe(t)!=="body"||_e(o))&&(c=ot(t)),r){const f=Te(t,!0,i,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else o&&a();i&&!r&&o&&a();const u=o&&!r&&!i?kn(o,c):ce(0),d=s.left+c.scrollLeft-l.x-u.x,p=s.top+c.scrollTop-l.y-u.y;return{x:d,y:p,width:s.width,height:s.height}}function gt(e){return ne(e).position==="static"}function Kt(e,t){if(!q(e)||ne(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return le(e)===n&&(n=n.ownerDocument.body),n}function Ln(e,t){const n=J(e);if(nt(e))return n;if(!q(e)){let o=me(e);for(;o&&!de(o);){if(W(o)&&!gt(o))return o;o=me(o)}return n}let r=Kt(e,t);for(;r&&qn(r)&&gt(r);)r=Kt(r,t);return r&&de(r)&&gt(r)&&!At(r)?n:r||Xn(e)||n}const Zr=async function(e){const t=this.getOffsetParent||Ln,n=this.getDimensions,r=await n(e.floating);return{reference:Gr(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jr(e){return ne(e).direction==="rtl"}const Qr={convertOffsetParentRelativeRectToViewportRelativeRect:jr,getDocumentElement:le,getClippingRect:Yr,getOffsetParent:Ln,getElementRects:Zr,getClientRects:Hr,getDimensions:zr,getScale:Me,isElement:W,isRTL:Jr};function Nn(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function eo(e,t){let n=null,r;const o=le(e);function i(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function s(c,l){c===void 0&&(c=!1),l===void 0&&(l=1),i();const a=e.getBoundingClientRect(),{left:u,top:d,width:p,height:f}=a;if(c||t(),!p||!f)return;const h=je(d),m=je(o.clientWidth-(u+p)),x=je(o.clientHeight-(d+f)),y=je(u),v={rootMargin:-h+"px "+-m+"px "+-x+"px "+-y+"px",threshold:Y(0,Se(1,l))||1};let S=!0;function A(O){const M=O[0].intersectionRatio;if(M!==l){if(!S)return s();M?s(!1,M):r=setTimeout(()=>{s(!1,1e-7)},1e3)}M===1&&!Nn(a,e.getBoundingClientRect())&&s(),S=!1}try{n=new IntersectionObserver(A,{...v,root:o.ownerDocument})}catch{n=new IntersectionObserver(A,v)}n.observe(e)}return s(!0),i}function to(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,a=Ot(e),u=o||i?[...a?ye(a):[],...t?ye(t):[]]:[];u.forEach(y=>{o&&y.addEventListener("scroll",n,{passive:!0}),i&&y.addEventListener("resize",n)});const d=a&&c?eo(a,n):null;let p=-1,f=null;s&&(f=new ResizeObserver(y=>{let[b]=y;b&&b.target===a&&f&&t&&(f.unobserve(t),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var v;(v=f)==null||v.observe(t)})),n()}),a&&!l&&f.observe(a),t&&f.observe(t));let h,m=l?Te(e):null;l&&x();function x(){const y=Te(e);m&&!Nn(m,y)&&n(),m=y,h=requestAnimationFrame(x)}return n(),()=>{var y;u.forEach(b=>{o&&b.removeEventListener("scroll",n),i&&b.removeEventListener("resize",n)}),d==null||d(),(y=f)==null||y.disconnect(),f=null,l&&cancelAnimationFrame(h)}}const no=Mn,ro=_r,oo=$r,io=Fr,so=Wr,co=(e,t,n)=>{const r=new Map,o={platform:Qr,...n},i={...o.platform,_c:r};return kr(e,t,{...o,platform:i})};var lo=typeof document<"u",ao=function(){},Ue=lo?Tt.useLayoutEffect:ao;function Qe(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Qe(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const i=o[r];if(!(i==="_owner"&&e.$$typeof)&&!Qe(e[i],t[i]))return!1}return!0}return e!==e&&t!==t}function _n(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Ut(e,t){const n=_n(e);return Math.round(t*n)/n}function pt(e){const t=g.useRef(e);return Ue(()=>{t.current=e}),t}function $n(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:i,floating:s}={},transform:c=!0,whileElementsMounted:l,open:a}=e,[u,d]=g.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[p,f]=g.useState(r);Qe(p,r)||f(r);const[h,m]=g.useState(null),[x,y]=g.useState(null),b=g.useCallback(w=>{w!==O.current&&(O.current=w,m(w))},[]),v=g.useCallback(w=>{w!==M.current&&(M.current=w,y(w))},[]),S=i||h,A=s||x,O=g.useRef(null),M=g.useRef(null),_=g.useRef(u),K=l!=null,B=pt(l),$=pt(o),X=pt(a),j=g.useCallback(()=>{if(!O.current||!M.current)return;const w={placement:t,strategy:n,middleware:p};$.current&&(w.platform=$.current),co(O.current,M.current,w).then(I=>{const N={...I,isPositioned:X.current!==!1};R.current&&!Qe(_.current,N)&&(_.current=N,dn.flushSync(()=>{d(N)}))})},[p,t,n,$,X]);Ue(()=>{a===!1&&_.current.isPositioned&&(_.current.isPositioned=!1,d(w=>({...w,isPositioned:!1})))},[a]);const R=g.useRef(!1);Ue(()=>(R.current=!0,()=>{R.current=!1}),[]),Ue(()=>{if(S&&(O.current=S),A&&(M.current=A),S&&A){if(B.current)return B.current(S,A,j);j()}},[S,A,j,B,K]);const E=g.useMemo(()=>({reference:O,floating:M,setReference:b,setFloating:v}),[b,v]),k=g.useMemo(()=>({reference:S,floating:A}),[S,A]),L=g.useMemo(()=>{const w={position:n,left:0,top:0};if(!k.floating)return w;const I=Ut(k.floating,u.x),N=Ut(k.floating,u.y);return c?{...w,transform:"translate("+I+"px, "+N+"px)",..._n(k.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:I,top:N}},[n,c,k.floating,u.x,u.y]);return g.useMemo(()=>({...u,update:j,refs:E,elements:k,floatingStyles:L}),[u,j,E,k,L])}const uo=(e,t)=>{const n=ro(e);return{name:n.name,fn:n.fn,options:[e,t]}},fo=(e,t)=>{const n=oo(e);return{name:n.name,fn:n.fn,options:[e,t]}},mo=(e,t)=>{const n=io(e);return{name:n.name,fn:n.fn,options:[e,t]}},go=(e,t)=>{const n=so(e);return{name:n.name,fn:n.fn,options:[e,t]}};function po(e){const t=g.useRef(void 0),n=g.useCallback(r=>{const o=e.map(i=>{if(i!=null){if(typeof i=="function"){const s=i,c=s(r);return typeof c=="function"?c:()=>{s(null)}}return i.current=r,()=>{i.current=null}}});return()=>{o.forEach(i=>i==null?void 0:i())}},e);return g.useMemo(()=>e.every(r=>r==null)?null:r=>{t.current&&(t.current(),t.current=void 0),r!=null&&(t.current=n(r))},e)}const ho="data-floating-ui-focusable",Xt="active",Yt="selected",bo={...g};let zt=!1,vo=0;const Gt=()=>"floating-ui-"+Math.random().toString(36).slice(2,6)+vo++;function yo(){const[e,t]=g.useState(()=>zt?Gt():void 0);return Z(()=>{e==null&&t(Gt())},[]),g.useEffect(()=>{zt=!0},[]),e}const wo=bo.useId,ct=wo||yo;let St;process.env.NODE_ENV!=="production"&&(St=new Set);function xo(){for(var e,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];const o="Floating UI: "+n.join(" ");if(!((e=St)!=null&&e.has(o))){var i;(i=St)==null||i.add(o),console.error(o)}}function Ro(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const Eo=g.createContext(null),So=g.createContext(null),Wn=()=>{var e;return((e=g.useContext(Eo))==null?void 0:e.id)||null},It=()=>g.useContext(So);function Ne(e){return"data-floating-ui-"+e}function To(e){e.current!==-1&&(clearTimeout(e.current),e.current=-1)}let Zt=0;function Ae(e,t){t===void 0&&(t={});const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Zt);const i=()=>e==null?void 0:e.focus({preventScroll:n});o?i():Zt=requestAnimationFrame(i)}function Co(e){return(e==null?void 0:e.ownerDocument)||document}const Pe={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function Jt(e){return e==="inert"?Pe.inert:e==="aria-hidden"?Pe["aria-hidden"]:Pe.none}let He=new WeakSet,qe={},ht=0;const Ao=()=>typeof HTMLElement<"u"&&"inert"in HTMLElement.prototype;function Bn(e){return e?Xe(e)?e.host:Bn(e.parentNode):null}const Oo=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=Bn(n);return e.contains(r)?r:null}).filter(n=>n!=null);function Io(e,t,n,r){const o="data-floating-ui-inert",i=r?"inert":n?"aria-hidden":null,s=Oo(t,e),c=new Set,l=new Set(s),a=[];qe[o]||(qe[o]=new WeakMap);const u=qe[o];s.forEach(d),p(t),c.clear();function d(f){!f||c.has(f)||(c.add(f),f.parentNode&&d(f.parentNode))}function p(f){!f||l.has(f)||[].forEach.call(f.children,h=>{if(xe(h)!=="script")if(c.has(h))p(h);else{const m=i?h.getAttribute(i):null,x=m!==null&&m!=="false",y=Jt(i),b=(y.get(h)||0)+1,v=(u.get(h)||0)+1;y.set(h,b),u.set(h,v),a.push(h),b===1&&x&&He.add(h),v===1&&h.setAttribute(o,""),!x&&i&&h.setAttribute(i,i==="inert"?"":"true")}})}return ht++,()=>{a.forEach(f=>{const h=Jt(i),x=(h.get(f)||0)-1,y=(u.get(f)||0)-1;h.set(f,x),u.set(f,y),x||(!He.has(f)&&i&&f.removeAttribute(i),He.delete(f)),y||f.removeAttribute(o)}),ht--,ht||(Pe.inert=new WeakMap,Pe["aria-hidden"]=new WeakMap,Pe.none=new WeakMap,He=new WeakSet,qe={})}}function Qt(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);const r=Co(e[0]).body;return Io(e.concat(Array.from(r.querySelectorAll('[aria-live],[role="status"],output'))),r,t,n)}const Mt={border:0,clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:0,position:"fixed",whiteSpace:"nowrap",width:"1px",top:0,left:0},et=g.forwardRef(function(t,n){const[r,o]=g.useState();Z(()=>{yr()&&o("button")},[]);const i={ref:n,tabIndex:0,role:r,"aria-hidden":r?void 0:!0,[Ne("focus-guard")]:"",style:Mt};return te.jsx("span",{...t,...i})}),Mo={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Vn=g.createContext(null),en=Ne("portal");function Po(e){e===void 0&&(e={});const{id:t,root:n}=e,r=ct(),o=jn(),[i,s]=g.useState(null),c=g.useRef(null);return Z(()=>()=>{i==null||i.remove(),queueMicrotask(()=>{c.current=null})},[i]),Z(()=>{if(!r||c.current)return;const l=t?document.getElementById(t):null;if(!l)return;const a=document.createElement("div");a.id=r,a.setAttribute(en,""),l.appendChild(a),c.current=a,s(a)},[t,r]),Z(()=>{if(n===null||!r||c.current)return;let l=n||(o==null?void 0:o.portalNode);l&&!Ct(l)&&(l=l.current),l=l||document.body;let a=null;t&&(a=document.createElement("div"),a.id=t,l.appendChild(a));const u=document.createElement("div");u.id=r,u.setAttribute(en,""),l=a||l,l.appendChild(u),c.current=u,s(u)},[t,n,r,o]),i}function Do(e){const{children:t,id:n,root:r,preserveTabOrder:o=!0}=e,i=Po({id:n,root:r}),[s,c]=g.useState(null),l=g.useRef(null),a=g.useRef(null),u=g.useRef(null),d=g.useRef(null),p=s==null?void 0:s.modal,f=s==null?void 0:s.open,h=!!s&&!s.modal&&s.open&&o&&!!(r||i);return g.useEffect(()=>{if(!i||!o||p)return;function m(x){i&&Fe(x)&&(x.type==="focusin"?Vt:Pr)(i)}return i.addEventListener("focusin",m,!0),i.addEventListener("focusout",m,!0),()=>{i.removeEventListener("focusin",m,!0),i.removeEventListener("focusout",m,!0)}},[i,o,p]),g.useEffect(()=>{i&&(f||Vt(i))},[f,i]),te.jsxs(Vn.Provider,{value:g.useMemo(()=>({preserveTabOrder:o,beforeOutsideRef:l,afterOutsideRef:a,beforeInsideRef:u,afterInsideRef:d,portalNode:i,setFocusManagerState:c}),[o,i]),children:[h&&i&&te.jsx(et,{"data-type":"outside",ref:l,onFocus:m=>{if(Fe(m,i)){var x;(x=u.current)==null||x.focus()}else{const y=s?s.domReference:null,b=In(y);b==null||b.focus()}}}),h&&i&&te.jsx("span",{"aria-owns":i.id,style:Mo}),i&&dn.createPortal(t,i),h&&i&&te.jsx(et,{"data-type":"outside",ref:a,onFocus:m=>{if(Fe(m,i)){var x;(x=d.current)==null||x.focus()}else{const y=s?s.domReference:null,b=On(y);b==null||b.focus(),s!=null&&s.closeOnFocusOut&&(s==null||s.onOpenChange(!1,m.nativeEvent,"focus-out"))}}})]})}const jn=()=>g.useContext(Vn);function tn(e){return g.useMemo(()=>t=>{e.forEach(n=>{n&&(n.current=t)})},e)}const nn=20;let ve=[];function Pt(){ve=ve.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function ko(e){Pt(),e&&xe(e)!=="body"&&(ve.push(new WeakRef(e)),ve.length>nn&&(ve=ve.slice(-nn)))}function rn(){Pt();const e=ve[ve.length-1];return e==null?void 0:e.deref()}function Fo(e){const t=We();return En(e,t)?e:it(e,t)[0]||e}function on(e,t){var n;if(!t.current.includes("floating")&&!((n=e.getAttribute("role"))!=null&&n.includes("dialog")))return;const r=We(),i=vr(e,r).filter(c=>{const l=c.getAttribute("data-tabindex")||"";return En(c,r)||c.hasAttribute("data-tabindex")&&!l.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||i.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}const Lo=g.forwardRef(function(t,n){return te.jsx("button",{...t,type:"button",ref:n,tabIndex:-1,style:Mt})});function No(e){const{context:t,children:n,disabled:r=!1,order:o=["content"],guards:i=!0,initialFocus:s=0,returnFocus:c=!0,restoreFocus:l=!1,modal:a=!0,visuallyHiddenDismiss:u=!1,closeOnFocusOut:d=!0,outsideElementsInert:p=!1,getInsideElements:f=()=>[]}=e,{open:h,onOpenChange:m,events:x,dataRef:y,elements:{domReference:b,floating:v}}=t,S=se(()=>{var T;return(T=y.current.floatingContext)==null?void 0:T.nodeId}),A=se(f),O=typeof s=="number"&&s<0,M=$t(b)&&O,_=Ao(),K=_?i:!0,B=!K||_&&p,$=mt(o),X=mt(s),j=mt(c),R=It(),E=jn(),k=g.useRef(null),L=g.useRef(null),w=g.useRef(!1),I=g.useRef(!1),N=g.useRef(-1),re=g.useRef(-1),Ce=E!=null,P=Et(v),ie=se(function(T){return T===void 0&&(T=P),T?it(T,We()):[]}),H=se(T=>{const D=ie(T);return $.current.map(C=>b&&C==="reference"?b:P&&C==="floating"?P:D).filter(Boolean).flat()});g.useEffect(()=>{if(r||!a)return;function T(C){if(C.key==="Tab"){G(P,Oe(oe(P)))&&ie().length===0&&!M&&dt(C);const V=H(),U=be(C);$.current[0]==="reference"&&U===b&&(dt(C),C.shiftKey?Ae(V[V.length-1]):Ae(V[1])),$.current[1]==="floating"&&U===P&&C.shiftKey&&(dt(C),Ae(V[0]))}}const D=oe(P);return D.addEventListener("keydown",T),()=>{D.removeEventListener("keydown",T)}},[r,b,P,a,$,M,ie,H]),g.useEffect(()=>{if(r||!v)return;function T(D){const C=be(D),U=ie().indexOf(C);U!==-1&&(N.current=U)}return v.addEventListener("focusin",T),()=>{v.removeEventListener("focusin",T)}},[r,v,ie]),g.useEffect(()=>{if(r||!d)return;function T(){I.current=!0,setTimeout(()=>{I.current=!1})}function D(U){const F=U.relatedTarget,ae=U.currentTarget,ee=be(U);queueMicrotask(()=>{const z=S(),Re=!(G(b,F)||G(v,F)||G(F,v)||G(E==null?void 0:E.portalNode,F)||F!=null&&F.hasAttribute(Ne("focus-guard"))||R&&(Ie(R.nodesRef.current,z).find(pe=>{var ue,he;return G((ue=pe.context)==null?void 0:ue.elements.floating,F)||G((he=pe.context)==null?void 0:he.elements.domReference,F)})||Wt(R.nodesRef.current,z).find(pe=>{var ue,he,Dt;return[(ue=pe.context)==null?void 0:ue.elements.floating,Et((he=pe.context)==null?void 0:he.elements.floating)].includes(F)||((Dt=pe.context)==null?void 0:Dt.elements.domReference)===F})));if(ae===b&&P&&on(P,$),l&&ae!==b&&!(ee!=null&&ee.isConnected)&&Oe(oe(P))===oe(P).body){q(P)&&P.focus();const pe=N.current,ue=ie(),he=ue[pe]||ue[ue.length-1]||P;q(he)&&he.focus()}if(y.current.insideReactTree){y.current.insideReactTree=!1;return}(M||!a)&&F&&Re&&!I.current&&F!==rn()&&(w.current=!0,m(!1,U,"focus-out"))})}const C=!!(!R&&E);function V(){To(re),y.current.insideReactTree=!0,re.current=window.setTimeout(()=>{y.current.insideReactTree=!1})}if(v&&q(b))return b.addEventListener("focusout",D),b.addEventListener("pointerdown",T),v.addEventListener("focusout",D),C&&v.addEventListener("focusout",V,!0),()=>{b.removeEventListener("focusout",D),b.removeEventListener("pointerdown",T),v.removeEventListener("focusout",D),C&&v.removeEventListener("focusout",V,!0)}},[r,b,v,P,a,R,E,m,d,l,ie,M,S,$,y]);const Q=g.useRef(null),ge=g.useRef(null),lt=tn([Q,E==null?void 0:E.beforeInsideRef]),at=tn([ge,E==null?void 0:E.afterInsideRef]);g.useEffect(()=>{var T,D;if(r||!v)return;const C=Array.from((E==null||(T=E.portalNode)==null?void 0:T.querySelectorAll("["+Ne("portal")+"]"))||[]),U=(D=(R?Wt(R.nodesRef.current,S()):[]).find(ee=>{var z;return $t(((z=ee.context)==null?void 0:z.elements.domReference)||null)}))==null||(D=D.context)==null?void 0:D.elements.domReference,F=[v,U,...C,...A(),k.current,L.current,Q.current,ge.current,E==null?void 0:E.beforeOutsideRef.current,E==null?void 0:E.afterOutsideRef.current,$.current.includes("reference")||M?b:null].filter(ee=>ee!=null),ae=a||M?Qt(F,!B,B):Qt(F);return()=>{ae()}},[r,b,v,a,$,E,M,K,B,R,S,A]),Z(()=>{if(r||!q(P))return;const T=oe(P),D=Oe(T);queueMicrotask(()=>{const C=H(P),V=X.current,U=(typeof V=="number"?C[V]:V.current)||P,F=G(P,D);!O&&!F&&h&&Ae(U,{preventScroll:U===P})})},[r,h,P,O,H,X]),Z(()=>{if(r||!P)return;const T=oe(P),D=Oe(T);ko(D);function C(F){let{reason:ae,event:ee,nested:z}=F;if(["hover","safe-polygon"].includes(ae)&&ee.type==="mouseleave"&&(w.current=!0),ae==="outside-press")if(z)w.current=!1;else if(Sr(ee)||Tr(ee))w.current=!1;else{let Re=!1;document.createElement("div").focus({get preventScroll(){return Re=!0,!1}}),Re?w.current=!1:w.current=!0}}x.on("openchange",C);const V=T.createElement("span");V.setAttribute("tabindex","-1"),V.setAttribute("aria-hidden","true"),Object.assign(V.style,Mt),Ce&&b&&b.insertAdjacentElement("afterend",V);function U(){if(typeof j.current=="boolean"){const F=b||rn();return F&&F.isConnected?F:V}return j.current.current||V}return()=>{x.off("openchange",C);const F=Oe(T),ae=G(v,F)||R&&Ie(R.nodesRef.current,S(),!1).some(z=>{var Re;return G((Re=z.context)==null?void 0:Re.elements.floating,F)}),ee=U();queueMicrotask(()=>{const z=Fo(ee);j.current&&!w.current&&q(z)&&(!(z!==F&&F!==T.body)||ae)&&z.focus({preventScroll:!0}),V.remove()})}},[r,v,P,j,y,x,R,Ce,b,S]),g.useEffect(()=>(queueMicrotask(()=>{w.current=!1}),()=>{queueMicrotask(Pt)}),[r]),Z(()=>{if(!r&&E)return E.setFocusManagerState({modal:a,closeOnFocusOut:d,open:h,onOpenChange:m,domReference:b}),()=>{E.setFocusManagerState(null)}},[r,E,a,h,m,d,b]),Z(()=>{r||P&&on(P,$)},[r,P,$]);function Be(T){return r||!u||!a?null:te.jsx(Lo,{ref:T==="start"?k:L,onClick:D=>m(!1,D.nativeEvent),children:typeof u=="string"?u:"Dismiss"})}const Ve=!r&&K&&(a?!M:!0)&&(Ce||a);return te.jsxs(te.Fragment,{children:[Ve&&te.jsx(et,{"data-type":"inside",ref:lt,onFocus:T=>{if(a){const C=H();Ae(o[0]==="reference"?C[0]:C[C.length-1])}else if(E!=null&&E.preserveTabOrder&&E.portalNode)if(w.current=!1,Fe(T,E.portalNode)){const C=On(b);C==null||C.focus()}else{var D;(D=E.beforeOutsideRef.current)==null||D.focus()}}}),!M&&Be("start"),n,Be("end"),Ve&&te.jsx(et,{"data-type":"inside",ref:at,onFocus:T=>{if(a)Ae(H()[0]);else if(E!=null&&E.preserveTabOrder&&E.portalNode)if(d&&(w.current=!0),Fe(T,E.portalNode)){const C=In(b);C==null||C.focus()}else{var D;(D=E.afterOutsideRef.current)==null||D.focus()}}})]})}let Ke=0;const sn="--floating-ui-scrollbar-width";function _o(){const e=Sn(),t=/iP(hone|ad|od)|iOS/.test(e)||e==="MacIntel"&&navigator.maxTouchPoints>1,n=document.body.style,o=Math.round(document.documentElement.getBoundingClientRect().left)+document.documentElement.scrollLeft?"paddingLeft":"paddingRight",i=window.innerWidth-document.documentElement.clientWidth,s=n.left?parseFloat(n.left):window.scrollX,c=n.top?parseFloat(n.top):window.scrollY;if(n.overflow="hidden",n.setProperty(sn,i+"px"),i&&(n[o]=i+"px"),t){var l,a;const u=((l=window.visualViewport)==null?void 0:l.offsetLeft)||0,d=((a=window.visualViewport)==null?void 0:a.offsetTop)||0;Object.assign(n,{position:"fixed",top:-(c-Math.floor(d))+"px",left:-(s-Math.floor(u))+"px",right:"0"})}return()=>{Object.assign(n,{overflow:"",[o]:""}),n.removeProperty(sn),t&&(Object.assign(n,{position:"",top:"",left:"",right:""}),window.scrollTo(s,c))}}let cn=()=>{};const $o=g.forwardRef(function(t,n){const{lockScroll:r=!1,...o}=t;return Z(()=>{if(r)return Ke++,Ke===1&&(cn=_o()),()=>{Ke--,Ke===0&&cn()}},[r]),te.jsx("div",{ref:n,...o,style:{position:"fixed",overflow:"auto",top:0,right:0,bottom:0,left:0,...o.style}})});function ln(e){return q(e.target)&&e.target.tagName==="BUTTON"}function Wo(e){return q(e.target)&&e.target.tagName==="A"}function an(e){return Cn(e)}function Bo(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,dataRef:o,elements:{domReference:i}}=e,{enabled:s=!0,event:c="click",toggle:l=!0,ignoreMouse:a=!1,keyboardHandlers:u=!0,stickIfOpen:d=!0}=t,p=g.useRef(),f=g.useRef(!1),h=g.useMemo(()=>({onPointerDown(m){p.current=m.pointerType},onMouseDown(m){const x=p.current;m.button===0&&c!=="click"&&(Bt(x)&&a||(n&&l&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="mousedown")?r(!1,m.nativeEvent,"click"):(m.preventDefault(),r(!0,m.nativeEvent,"click"))))},onClick(m){const x=p.current;if(c==="mousedown"&&p.current){p.current=void 0;return}Bt(x)&&a||(n&&l&&(!(o.current.openEvent&&d)||o.current.openEvent.type==="click")?r(!1,m.nativeEvent,"click"):r(!0,m.nativeEvent,"click"))},onKeyDown(m){p.current=void 0,!(m.defaultPrevented||!u||ln(m))&&(m.key===" "&&!an(i)&&(m.preventDefault(),f.current=!0),!Wo(m)&&m.key==="Enter"&&r(!(n&&l),m.nativeEvent,"click"))},onKeyUp(m){m.defaultPrevented||!u||ln(m)||an(i)||m.key===" "&&f.current&&(f.current=!1,r(!(n&&l),m.nativeEvent,"click"))}}),[o,i,c,a,u,r,n,d,l]);return g.useMemo(()=>s?{reference:h}:{},[s,h])}const Vo={pointerdown:"onPointerDown",mousedown:"onMouseDown",click:"onClick"},jo={pointerdown:"onPointerDownCapture",mousedown:"onMouseDownCapture",click:"onClickCapture"},un=e=>{var t,n;return{escapeKey:typeof e=="boolean"?e:(t=e==null?void 0:e.escapeKey)!=null?t:!1,outsidePress:typeof e=="boolean"?e:(n=e==null?void 0:e.outsidePress)!=null?n:!0}};function Ho(e,t){t===void 0&&(t={});const{open:n,onOpenChange:r,elements:o,dataRef:i}=e,{enabled:s=!0,escapeKey:c=!0,outsidePress:l=!0,outsidePressEvent:a="pointerdown",referencePress:u=!1,referencePressEvent:d="pointerdown",ancestorScroll:p=!1,bubbles:f,capture:h}=t,m=It(),x=se(typeof l=="function"?l:()=>!1),y=typeof l=="function"?x:l,b=g.useRef(!1),{escapeKey:v,outsidePress:S}=un(f),{escapeKey:A,outsidePress:O}=un(h),M=g.useRef(!1),_=se(R=>{var E;if(!n||!s||!c||R.key!=="Escape"||M.current)return;const k=(E=i.current.floatingContext)==null?void 0:E.nodeId,L=m?Ie(m.nodesRef.current,k):[];if(!v&&(R.stopPropagation(),L.length>0)){let w=!0;if(L.forEach(I=>{var N;if((N=I.context)!=null&&N.open&&!I.context.dataRef.current.__escapeKeyBubbles){w=!1;return}}),!w)return}r(!1,Er(R)?R.nativeEvent:R,"escape-key")}),K=se(R=>{var E;const k=()=>{var L;_(R),(L=be(R))==null||L.removeEventListener("keydown",k)};(E=be(R))==null||E.addEventListener("keydown",k)}),B=se(R=>{var E;const k=i.current.insideReactTree;i.current.insideReactTree=!1;const L=b.current;if(b.current=!1,a==="click"&&L||k||typeof y=="function"&&!y(R))return;const w=be(R),I="["+Ne("inert")+"]",N=oe(o.floating).querySelectorAll(I);let re=W(w)?w:null;for(;re&&!de(re);){const H=me(re);if(de(H)||!W(H))break;re=H}if(N.length&&W(w)&&!Rr(w)&&!G(w,o.floating)&&Array.from(N).every(H=>!G(re,H)))return;if(q(w)&&j){const H=de(w),Q=ne(w),ge=/auto|scroll/,lt=H||ge.test(Q.overflowX),at=H||ge.test(Q.overflowY),Be=lt&&w.clientWidth>0&&w.scrollWidth>w.clientWidth,Ve=at&&w.clientHeight>0&&w.scrollHeight>w.clientHeight,T=Q.direction==="rtl",D=Ve&&(T?R.offsetX<=w.offsetWidth-w.clientWidth:R.offsetX>w.clientWidth),C=Be&&R.offsetY>w.clientHeight;if(D||C)return}const Ce=(E=i.current.floatingContext)==null?void 0:E.nodeId,P=m&&Ie(m.nodesRef.current,Ce).some(H=>{var Q;return ft(R,(Q=H.context)==null?void 0:Q.elements.floating)});if(ft(R,o.floating)||ft(R,o.domReference)||P)return;const ie=m?Ie(m.nodesRef.current,Ce):[];if(ie.length>0){let H=!0;if(ie.forEach(Q=>{var ge;if((ge=Q.context)!=null&&ge.open&&!Q.context.dataRef.current.__outsidePressBubbles){H=!1;return}}),!H)return}r(!1,R,"outside-press")}),$=se(R=>{var E;const k=()=>{var L;B(R),(L=be(R))==null||L.removeEventListener(a,k)};(E=be(R))==null||E.addEventListener(a,k)});g.useEffect(()=>{if(!n||!s)return;i.current.__escapeKeyBubbles=v,i.current.__outsidePressBubbles=S;let R=-1;function E(N){r(!1,N,"ancestor-scroll")}function k(){window.clearTimeout(R),M.current=!0}function L(){R=window.setTimeout(()=>{M.current=!1},rt()?5:0)}const w=oe(o.floating);c&&(w.addEventListener("keydown",A?K:_,A),w.addEventListener("compositionstart",k),w.addEventListener("compositionend",L)),y&&w.addEventListener(a,O?$:B,O);let I=[];return p&&(W(o.domReference)&&(I=ye(o.domReference)),W(o.floating)&&(I=I.concat(ye(o.floating))),!W(o.reference)&&o.reference&&o.reference.contextElement&&(I=I.concat(ye(o.reference.contextElement)))),I=I.filter(N=>{var re;return N!==((re=w.defaultView)==null?void 0:re.visualViewport)}),I.forEach(N=>{N.addEventListener("scroll",E,{passive:!0})}),()=>{c&&(w.removeEventListener("keydown",A?K:_,A),w.removeEventListener("compositionstart",k),w.removeEventListener("compositionend",L)),y&&w.removeEventListener(a,O?$:B,O),I.forEach(N=>{N.removeEventListener("scroll",E)}),window.clearTimeout(R)}},[i,o,c,y,a,n,r,p,s,v,S,_,A,K,B,O,$]),g.useEffect(()=>{i.current.insideReactTree=!1},[i,y,a]);const X=g.useMemo(()=>({onKeyDown:_,...u&&{[Vo[d]]:R=>{r(!1,R.nativeEvent,"reference-press")},...d!=="click"&&{onClick(R){r(!1,R.nativeEvent,"reference-press")}}}}),[_,r,u,d]),j=g.useMemo(()=>{function R(E){E.button===0&&(b.current=!0)}return{onKeyDown:_,onMouseDown:R,onMouseUp:R,[jo[a]]:()=>{i.current.insideReactTree=!0}}},[_,a,i]);return g.useMemo(()=>s?{reference:X,floating:j}:{},[s,X,j])}function qo(e){const{open:t=!1,onOpenChange:n,elements:r}=e,o=ct(),i=g.useRef({}),[s]=g.useState(()=>Ro()),c=Wn()!=null;if(process.env.NODE_ENV!=="production"){const f=r.reference;f&&!W(f)&&xo("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `refs.setPositionReference()`","instead.")}const[l,a]=g.useState(r.reference),u=se((f,h,m)=>{i.current.openEvent=f?h:void 0,s.emit("openchange",{open:f,event:h,reason:m,nested:c}),n==null||n(f,h,m)}),d=g.useMemo(()=>({setPositionReference:a}),[]),p=g.useMemo(()=>({reference:l||r.reference||null,floating:r.floating||null,domReference:r.reference}),[l,r.reference,r.floating]);return g.useMemo(()=>({dataRef:i,open:t,onOpenChange:u,elements:p,events:s,floatingId:o,refs:d}),[t,u,p,s,o,d])}function Ko(e){e===void 0&&(e={});const{nodeId:t}=e,n=qo({...e,elements:{reference:null,floating:null,...e.elements}}),r=e.rootContext||n,o=r.elements,[i,s]=g.useState(null),[c,l]=g.useState(null),u=(o==null?void 0:o.domReference)||i,d=g.useRef(null),p=It();Z(()=>{u&&(d.current=u)},[u]);const f=$n({...e,elements:{...o,...c&&{reference:c}}}),h=g.useCallback(v=>{const S=W(v)?{getBoundingClientRect:()=>v.getBoundingClientRect(),getClientRects:()=>v.getClientRects(),contextElement:v}:v;l(S),f.refs.setReference(S)},[f.refs]),m=g.useCallback(v=>{(W(v)||v===null)&&(d.current=v,s(v)),(W(f.refs.reference.current)||f.refs.reference.current===null||v!==null&&!W(v))&&f.refs.setReference(v)},[f.refs]),x=g.useMemo(()=>({...f.refs,setReference:m,setPositionReference:h,domReference:d}),[f.refs,m,h]),y=g.useMemo(()=>({...f.elements,domReference:u}),[f.elements,u]),b=g.useMemo(()=>({...f,...r,refs:x,elements:y,nodeId:t}),[f,x,y,t,r]);return Z(()=>{r.dataRef.current.floatingContext=b;const v=p==null?void 0:p.nodesRef.current.find(S=>S.id===t);v&&(v.context=b)}),g.useMemo(()=>({...f,context:b,refs:x,elements:y}),[f,x,y,b])}function bt(e,t,n){const r=new Map,o=n==="item";let i=e;if(o&&e){const{[Xt]:s,[Yt]:c,...l}=e;i=l}return{...n==="floating"&&{tabIndex:-1,[ho]:""},...i,...t.map(s=>{const c=s?s[n]:null;return typeof c=="function"?e?c(e):null:c}).concat(e).reduce((s,c)=>(c&&Object.entries(c).forEach(l=>{let[a,u]=l;if(!(o&&[Xt,Yt].includes(a)))if(a.indexOf("on")===0){if(r.has(a)||r.set(a,[]),typeof u=="function"){var d;(d=r.get(a))==null||d.push(u),s[a]=function(){for(var p,f=arguments.length,h=new Array(f),m=0;m<f;m++)h[m]=arguments[m];return(p=r.get(a))==null?void 0:p.map(x=>x(...h)).find(x=>x!==void 0)}}}else s[a]=u}),s),{})}}function Uo(e){e===void 0&&(e=[]);const t=e.map(c=>c==null?void 0:c.reference),n=e.map(c=>c==null?void 0:c.floating),r=e.map(c=>c==null?void 0:c.item),o=g.useCallback(c=>bt(c,e,"reference"),t),i=g.useCallback(c=>bt(c,e,"floating"),n),s=g.useCallback(c=>bt(c,e,"item"),r);return g.useMemo(()=>({getReferenceProps:o,getFloatingProps:i,getItemProps:s}),[o,i,s])}const Xo=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function Yo(e,t){var n,r;t===void 0&&(t={});const{open:o,elements:i,floatingId:s}=e,{enabled:c=!0,role:l="dialog"}=t,a=ct(),u=((n=i.domReference)==null?void 0:n.id)||a,d=g.useMemo(()=>{var b;return((b=Et(i.floating))==null?void 0:b.id)||s},[i.floating,s]),p=(r=Xo.get(l))!=null?r:l,h=Wn()!=null,m=g.useMemo(()=>p==="tooltip"||l==="label"?{["aria-"+(l==="label"?"labelledby":"describedby")]:o?d:void 0}:{"aria-expanded":o?"true":"false","aria-haspopup":p==="alertdialog"?"dialog":p,"aria-controls":o?d:void 0,...p==="listbox"&&{role:"combobox"},...p==="menu"&&{id:u},...p==="menu"&&h&&{role:"menuitem"},...l==="select"&&{"aria-autocomplete":"none"},...l==="combobox"&&{"aria-autocomplete":"list"}},[p,d,h,o,u,l]),x=g.useMemo(()=>{const b={id:d,...p&&{role:p}};return p==="tooltip"||l==="label"?b:{...b,...p==="menu"&&{"aria-labelledby":u}}},[p,d,u,l]),y=g.useCallback(b=>{let{active:v,selected:S}=b;const A={role:"option",...v&&{id:d+"-fui-option"}};switch(l){case"select":case"combobox":return{...A,"aria-selected":S}}return{}},[d,l]);return g.useMemo(()=>c?{reference:m,floating:x,item:y}:{},[c,m,x,y])}exports.FloatingFocusManager=No;exports.FloatingOverlay=$o;exports.FloatingPortal=Do;exports.autoUpdate=to;exports.detectOverflow=no;exports.evaluate=ke;exports.flip=mo;exports.isElement=W;exports.max=Y;exports.min=Se;exports.offset=uo;exports.round=Le;exports.shift=fo;exports.size=go;exports.useClick=Bo;exports.useDismiss=Ho;exports.useFloating=Ko;exports.useFloating$1=$n;exports.useId=ct;exports.useInteractions=Uo;exports.useMergeRefs=po;exports.useRole=Yo;
5
- //# sourceMappingURL=floating-ui.react-O3sXJ80G.cjs.map
5
+ //# sourceMappingURL=floating-ui.react-ChfuPAKc.cjs.map