@dhzh/foundry 4.0.1 → 6.0.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.
@@ -1,5 +1,14 @@
1
1
  # Captures
2
2
 
3
+ A capture is an agent-facing bookmark. It records what a saved URL is about so
4
+ an agent can decide whether the URL is relevant and then visit it or run a fresh
5
+ web search for details.
6
+
7
+ Foundry does not store a page copy as the primary capture result. It sends one
8
+ capture-discovery request through the configured fetcher and stores the raw
9
+ response. The response contains result titles, descriptions, metadata, and
10
+ summaries that help identify the product, library, or resource.
11
+
3
12
  ## Commands
4
13
 
5
14
  ```bash
@@ -24,15 +33,19 @@ nested job `get` supports `show`.
24
33
  ```json
25
34
  {
26
35
  "id": "<capture-id>",
27
- "url": "https://example.com/article",
28
- "title": "Article title",
29
- "userNote": "Read later",
36
+ "url": "https://ui.shadcn.com/",
37
+ "title": "shadcn/ui - The Foundation for your Design System",
38
+ "userNote": "Components for the next project",
30
39
  "latestSuccessfulJobId": "<job-id>",
31
40
  "createdAt": "<iso>",
32
41
  "updatedAt": "<iso>"
33
42
  }
34
43
  ```
35
44
 
45
+ The title comes from the best matching fetcher result. Exact URL results are
46
+ preferred, then the same site's homepage, then the first result on the same
47
+ site.
48
+
36
49
  ## Capture Detail
37
50
 
38
51
  `captures get` returns:
@@ -41,22 +54,69 @@ nested job `get` supports `show`.
41
54
  {
42
55
  "capture": {
43
56
  "id": "<capture-id>",
44
- "url": "https://example.com/article",
45
- "title": "Article title",
46
- "userNote": "Read later",
57
+ "url": "https://ui.shadcn.com/",
58
+ "title": "shadcn/ui - The Foundation for your Design System",
59
+ "userNote": "Components for the next project",
47
60
  "latestSuccessfulJobId": "<job-id>",
48
61
  "createdAt": "<iso>",
49
62
  "updatedAt": "<iso>"
50
63
  },
51
- "content": {
52
- "jobId": "<job-id>",
53
- "markdown": "# Article"
64
+ "rawResponse": {
65
+ "success": true,
66
+ "data": {
67
+ "web": [
68
+ {
69
+ "url": "https://ui.shadcn.com/",
70
+ "title": "shadcn/ui - The Foundation for your Design System",
71
+ "description": "Composable, accessible components...",
72
+ "summary": "The fetcher's longer page summary...",
73
+ "metadata": {
74
+ "sourceURL": "https://ui.shadcn.com/",
75
+ "statusCode": 200
76
+ }
77
+ }
78
+ ]
79
+ },
80
+ "creditsUsed": 2
54
81
  }
55
82
  }
56
83
  ```
57
84
 
58
- `content` is the latest successful scrape content. It is `null` when no job has
59
- succeeded yet or the stored response has no usable Markdown/content string.
85
+ `rawResponse` is the unmodified response from the configured fetcher. It is
86
+ `null` until a job succeeds. The response shape depends on that fetcher; use
87
+ result metadata and descriptions as supporting evidence rather than treating
88
+ any generated summary as the canonical product description.
89
+
90
+ ## Fetcher Behavior
91
+
92
+ The current fetcher implementation uses the official Firecrawl Node SDK to call
93
+ `POST /v2/search`. A fetch job uses a query derived from the submitted URL:
94
+
95
+ - Root URL: `site:<hostname> <brand-token>`
96
+ - Path URL: `site:<hostname> <last-meaningful-path-segment>`
97
+
98
+ Examples:
99
+
100
+ | URL | Query |
101
+ | --- | --- |
102
+ | `https://ui.shadcn.com/` | `site:ui.shadcn.com shadcn` |
103
+ | `https://ui.shadcn.com/docs` | `site:ui.shadcn.com docs` |
104
+ | `https://models.dev/labs/apodex/` | `site:models.dev apodex` |
105
+ | `https://github.com/vercel/next.js` | `site:github.com next.js` |
106
+
107
+ The request uses five web results, `formats: ["summary"]`, main-content
108
+ filtering, cache reuse, ad blocking, automatic proxy selection, and a
109
+ two-day `maxAge`. `captures.maxAttempts` is passed to the SDK as its total
110
+ request-attempt limit; Foundry does not run a separate retry loop. In the
111
+ current Firecrawl SDK, automatic retries apply only to HTTP `502` responses.
112
+ Other retryable Firecrawl errors, including `408`, `429`, and other `5xx`
113
+ responses, are returned immediately.
114
+
115
+ Foundry records the final SDK response only. A job succeeds when Firecrawl
116
+ returns a valid successful response with a numeric `creditsUsed` value,
117
+ including when the search has zero results or no result on the requested site.
118
+ The job fails when the SDK request fails, Firecrawl reports an error, or the
119
+ response does not contain `creditsUsed`.
60
120
 
61
121
  ## Child Jobs
62
122
 
@@ -82,6 +142,7 @@ Job shape:
82
142
  "captureId": "<capture-id>",
83
143
  "status": "succeeded",
84
144
  "fetcher": "firecrawl",
145
+ "creditsUsed": 2,
85
146
  "errorCode": null,
86
147
  "errorMessage": null,
87
148
  "createdAt": "<iso>",
@@ -92,114 +153,55 @@ Job shape:
92
153
  Statuses:
93
154
 
94
155
  - `pending`: queued, not started.
95
- - `running`: scrape request in progress.
96
- - `succeeded`: scrape completed and latest successful job pointer may be set.
97
- - `failed`: scrape exhausted its attempt or failed non-retryably.
156
+ - `running`: fetcher request in progress.
157
+ - `succeeded`: Firecrawl returned a valid response with `creditsUsed`, and the
158
+ raw response was persisted. Zero search results still count as success.
159
+ - `failed`: the SDK request failed, Firecrawl reported an error, or the
160
+ response did not report `creditsUsed`.
98
161
 
99
- The job response does not include captured Markdown. Use
100
- `foundry captures get <capture-id>` for the latest successful content.
162
+ The job response does not include the raw response. Use
163
+ `foundry captures get <capture-id>` for the latest successful response.
164
+ `creditsUsed` is the authoritative per-job Firecrawl charge; `null` means no
165
+ charge was reported.
101
166
 
102
- `jobs list` returns the capture's non-deleted jobs, newest first. This matches
103
- the Web UI Jobs page. An existing capture with no jobs returns `[]`.
167
+ `jobs list` returns the capture's non-deleted jobs, newest first. An existing
168
+ capture with no jobs returns `[]`.
104
169
 
105
170
  `jobs recapture` creates a new job with the current fetcher configuration, waits
106
171
  for it to reach `succeeded` or `failed`, and returns the final job summary.
107
- Preconditions are the same as capture recapture: the capture exists, no active
108
- job already exists, and the current fetcher/API key are configured.
109
-
110
- The Web UI Jobs page supports listing status, fetcher, created/updated time,
111
- and error details; refresh by rerunning `jobs list`; and recapture. It does not
112
- expose cancel, delete, retry-in-place, or a global job list. The CLI deliberately
113
- matches those capabilities.
114
-
115
- ## List And Counts
116
-
117
- ```bash
118
- foundry captures list
119
- foundry captures list --filter no-successful
120
- foundry captures counts
121
- ```
122
-
123
- Filters:
124
-
125
- - `all`: every non-deleted capture.
126
- - `no-successful`: captures with no latest successful job.
127
-
128
- Counts shape:
129
-
130
- ```json
131
- {
132
- "all": 6,
133
- "noSuccessful": 1
134
- }
135
- ```
136
172
 
137
173
  ## Create
138
174
 
139
175
  ```bash
140
- foundry captures create https://example.com/article --note "Read later"
176
+ foundry captures create https://ui.shadcn.com/ --note "Component library"
141
177
  ```
142
178
 
143
179
  Preconditions:
144
180
 
145
- - `settings.features.library.captures.fetcher` must be `firecrawl` or `deepseek`.
146
- - The selected fetcher's API key must be non-empty.
147
- - URL must be HTTP or HTTPS after trimming whitespace.
181
+ - `settings.features.library.captures.fetcher` must be `firecrawl` or `null`.
182
+ - The configured fetcher API key must be non-empty.
183
+ - The URL must be HTTP or HTTPS after trimming whitespace.
148
184
  - The same normalized URL cannot already have an active capture.
149
185
 
150
- The command creates the capture, queues its first scrape job, waits until that
151
- job reaches `succeeded` or `failed`, and returns:
186
+ The command creates the capture, queues its first fetch job, waits until that
187
+ job reaches `succeeded` or `failed`, and returns `capture`, `rawResponse`, and
188
+ `job`.
152
189
 
153
- ```json
154
- {
155
- "capture": {
156
- "id": "<capture-id>",
157
- "url": "https://example.com/article",
158
- "title": "Article title",
159
- "userNote": "Read later",
160
- "latestSuccessfulJobId": "<job-id>",
161
- "createdAt": "<iso>",
162
- "updatedAt": "<iso>"
163
- },
164
- "content": {
165
- "jobId": "<job-id>",
166
- "markdown": "# Article"
167
- },
168
- "job": {
169
- "id": "<job-id>",
170
- "captureId": "<capture-id>",
171
- "status": "succeeded",
172
- "fetcher": "firecrawl",
173
- "errorCode": null,
174
- "errorMessage": null,
175
- "createdAt": "<iso>",
176
- "updatedAt": "<iso>"
177
- }
178
- }
179
- ```
180
-
181
- Important: a completed create command can return `job.status: "failed"` and
182
- `content: null`. That is a scrape failure, not a capture-create failure. Read
183
- `errorCode` and `errorMessage`.
190
+ A completed create command can return `job.status: "failed"` and
191
+ `rawResponse: null`. That is a discovery failure, not a capture-create failure.
192
+ Read `errorCode` and `errorMessage`.
184
193
 
185
194
  ## Recapture
186
195
 
187
- ```bash
188
- foundry captures recapture <capture-id>
189
- ```
190
-
191
- This creates a new child job, waits for completion, and returns the same
192
- `capture`, `content`, and `job` structure as `captures create`.
196
+ `foundry captures recapture <capture-id>` creates a new child job, waits for
197
+ completion, and returns the same `capture`, `rawResponse`, and `job` structure
198
+ as `captures create`.
193
199
 
194
200
  Preconditions:
195
201
 
196
202
  - The capture must exist.
197
203
  - No pending or running job may already exist for it.
198
- - The current capture fetcher and key must be configured.
199
-
200
- This is the capture-level equivalent of `captures jobs recapture`; it returns
201
- the capture detail along with the final job, while the nested jobs command
202
- returns only the final job.
204
+ - The current fetcher and its API key must be configured.
203
205
 
204
206
  ## Update Note
205
207
 
@@ -212,10 +214,6 @@ Notes are trimmed. An empty string stores `null` and clears the note.
212
214
 
213
215
  ## Delete
214
216
 
215
- ```bash
216
- foundry captures delete <capture-id>
217
- ```
218
-
219
217
  Deletion is soft deletion of the capture and its jobs. It is blocked while a
220
218
  pending or running job exists. Response:
221
219
 
@@ -226,16 +224,14 @@ pending or running job exists. Response:
226
224
  }
227
225
  ```
228
226
 
229
- Deleting the capture also removes its job history from normal queries.
230
-
231
227
  ## Errors
232
228
 
233
229
  - `INVALID_URL`: URL is not HTTP or HTTPS.
234
230
  - `CAPTURE_ALREADY_EXISTS`: active capture with the same URL exists.
235
- - `FETCHER_NOT_CONFIGURED`: no capture fetcher/key configured.
231
+ - `FETCHER_NOT_CONFIGURED`: no fetcher or fetcher API key is configured.
236
232
  - `ACTIVE_JOB_EXISTS`: capture already has pending/running work.
237
233
  - `CAPTURE_NOT_FOUND`: unknown or deleted capture.
238
234
  - `JOB_NOT_FOUND`: unknown job or a job owned by another capture.
239
235
 
240
236
  Job failures are returned as a valid final job with `status: "failed"`; do not
241
- assume a successful command means a successful scrape.
237
+ assume a successful command means a successful fetcher response.
@@ -32,8 +32,8 @@ Command aliases:
32
32
 
33
33
  ## JSON Contract
34
34
 
35
- Successful feature commands write one JSON value to stdout. Do not scrape or
36
- parse localized human prose. Help output is plain text and is only for command
35
+ Successful feature commands write one JSON value to stdout. Do not parse
36
+ localized human prose. Help output is plain text and is only for command
37
37
  discovery.
38
38
 
39
39
  Expected domain failures write a JSON envelope to stderr:
@@ -47,7 +47,7 @@ Expected domain failures write a JSON envelope to stderr:
47
47
  }
48
48
  ```
49
49
 
50
- The process exit code is `1` for handled command errors. A failed scrape is
50
+ The process exit code is `1` for handled command errors. A failed fetch is
51
51
  different: capture commands can return successful JSON with `job.status` set to
52
52
  `"failed"`, so always inspect the job payload.
53
53
 
@@ -23,8 +23,8 @@ accepted but may expose the secret in shell history or process inspection.
23
23
  }
24
24
  ```
25
25
 
26
- `activeJobCount` counts pending/running scrape jobs. Export, inspect, and import
27
- are blocked when the current Foundry database has active jobs. Concurrent
26
+ `activeJobCount` counts pending/running fetch jobs. Export, inspect, and import
27
+ are blocked when the current Foundry storage has active jobs. Concurrent
28
28
  transfers return `BUSY`.
29
29
 
30
30
  ## Export
@@ -36,7 +36,12 @@ foundry data-transfer export --output ./foundry.foundry-backup
36
36
 
37
37
  Behavior:
38
38
 
39
+ - Exports and imports JSON snapshots with `data/foundry.json`. SQLite-based
40
+ backup archives are not supported.
41
+
39
42
  - Produces an encrypted `.foundry-backup` archive.
43
+ - Settings are included in the JSON snapshot. Device connection configuration
44
+ is not exported.
40
45
  - If `--output` is omitted, writes `foundry-<iso-timestamp>.foundry-backup` in
41
46
  the current directory.
42
47
  - Appends `.foundry-backup` when the destination lacks that extension.
@@ -68,8 +73,7 @@ Inspection:
68
73
  - requires a non-empty passphrase
69
74
  - blocks if current Foundry has active jobs
70
75
  - decrypts and validates the archive
71
- - verifies manifest, checksums, database integrity, foreign keys, schema
72
- compatibility, provider/capture/job rows, and capture success pointers
76
+ - verifies manifest, checksums, JSON format compatibility, record references, provider/capture/job rows, and capture success pointers
73
77
  - returns a preview without replacing current data
74
78
 
75
79
  Response:
@@ -80,7 +84,7 @@ Response:
80
84
  "fileName": "foundry.foundry-backup",
81
85
  "exportedAt": "<iso>",
82
86
  "appVersion": "3.1.3",
83
- "databaseSchemaVersion": 1,
87
+ "dataFormatVersion": 1,
84
88
  "settingsVersion": 1,
85
89
  "providerCount": 2,
86
90
  "captureCount": 10,
@@ -103,11 +107,11 @@ Import performs inspection and commit in one process:
103
107
 
104
108
  1. Validate current state has no active jobs.
105
109
  2. Decrypt and validate the archive.
106
- 3. Stage the imported database and settings.
107
- 4. Replace current providers, captures, scrape jobs, and settings in a
108
- transaction where applicable.
110
+ 3. Stage the imported JSON snapshot, including settings.
111
+ 4. Replace current providers, captures, fetch jobs, and settings in one
112
+ recoverable JSON file transaction. Device connection configuration is left unchanged.
109
113
 
110
- This operation is destructive: the current Foundry database and settings are
114
+ This operation is destructive: the current Foundry storage and settings are
111
115
  replaced by the archive. Run `inspect` first and summarize the preview unless
112
116
  the user explicitly asked for immediate restoration of a known-good file.
113
117
 
@@ -121,7 +125,7 @@ Response:
121
125
  "fileName": "foundry.foundry-backup",
122
126
  "exportedAt": "<iso>",
123
127
  "appVersion": "3.1.3",
124
- "databaseSchemaVersion": 1,
128
+ "dataFormatVersion": 1,
125
129
  "settingsVersion": 1,
126
130
  "providerCount": 2,
127
131
  "captureCount": 10,
@@ -139,7 +143,7 @@ After import, query the affected feature commands to verify the new state.
139
143
  - `INVALID_ARCHIVE`: malformed, incomplete, corrupt, or semantically invalid
140
144
  backup.
141
145
  - `UNSUPPORTED_ARCHIVE`: unsupported archive or settings version.
142
- - `NEWER_SCHEMA`: archive database is newer than the installed Foundry.
146
+ - `NEWER_SCHEMA`: archive data format is newer than the installed Foundry.
143
147
  - `ACTIVE_JOBS`: pending/running jobs block transfer.
144
148
  - `BUSY`: another transfer is already running.
145
149
  - `IMPORT_NOT_FOUND`: staged import is unavailable.
@@ -32,9 +32,8 @@ folder and returns its path.
32
32
  "captures": {
33
33
  "fetcher": null,
34
34
  "maxAttempts": 1,
35
- "scrapeConcurrency": 2,
36
- "firecrawl": { "apiKey": "" },
37
- "deepseek": { "apiKey": "" }
35
+ "fetchConcurrency": 2,
36
+ "firecrawl": { "apiKey": "" }
38
37
  }
39
38
  }
40
39
  },
@@ -56,11 +55,10 @@ Allowed fields:
56
55
  | `language` | `system`, `en-US`, `zh-CN`, `zh-TW`, `ja-JP` |
57
56
  | `timeFormat` | `YYYY-MM-DD HH:mm:ss`, `YYYY-MM-DD`, `YYYY/MM/DD HH:mm:ss`, `DD/MM/YYYY HH:mm:ss`, `MM/DD/YYYY hh:mm:ss A`, `HH:mm:ss` |
58
57
  | `timezone` | `America/Los_Angeles`, `America/New_York`, `Asia/Shanghai`, `Asia/Taipei`, `Asia/Tokyo`, `UTC` |
59
- | `captures.fetcher` | `firecrawl`, `deepseek`, or `null` |
58
+ | `captures.fetcher` | `firecrawl` or `null` |
60
59
  | `captures.maxAttempts` | integer `1..10` |
61
- | `captures.scrapeConcurrency` | integer `1..5` |
60
+ | `captures.fetchConcurrency` | integer `1..5` |
62
61
  | `captures.firecrawlApiKey` | string, trimmed |
63
- | `captures.deepseekApiKey` | string, trimmed |
64
62
 
65
63
  The nested patch object is:
66
64
 
@@ -69,9 +67,8 @@ The nested patch object is:
69
67
  "captures": {
70
68
  "fetcher": "firecrawl",
71
69
  "maxAttempts": 2,
72
- "scrapeConcurrency": 2,
73
- "firecrawlApiKey": "<key>",
74
- "deepseekApiKey": "<key>"
70
+ "fetchConcurrency": 2,
71
+ "firecrawlApiKey": "<key>"
75
72
  }
76
73
  }
77
74
  ```
@@ -90,7 +87,7 @@ may be ignored, so verify the returned settings after a mutation.
90
87
  - The update response contains the complete resulting settings plus
91
88
  `configFolder`.
92
89
  - Appearance, language, and display-time settings affect the Web UI rendering.
93
- - Capture fetcher, retry count, and concurrency affect newly scheduled scrape
90
+ - Capture fetcher, retry count, and concurrency affect newly scheduled fetch
94
91
  jobs.
95
92
 
96
93
  ## Examples
@@ -113,7 +110,7 @@ foundry settings update --input '{
113
110
  "fetcher": "firecrawl",
114
111
  "firecrawlApiKey": "<key>",
115
112
  "maxAttempts": 2,
116
- "scrapeConcurrency": 2
113
+ "fetchConcurrency": 2
117
114
  }
118
115
  }'
119
116
  ```
@@ -131,4 +128,4 @@ foundry settings update --input '{"captures":{"fetcher":null}}'
131
128
  - `INPUT_REQUIRED`, `CONFLICTING_INPUT`, `INVALID_JSON`: JSON input transport
132
129
  errors described in `cli-conventions.md`.
133
130
 
134
- Do not edit `settings.json` directly. Read current settings and issue a patch.
131
+ Settings are stored in `<home>/.foundry/settings.json`. Read current settings and issue a patch through the CLI so process locking and atomic writes are preserved.
@@ -1 +1 @@
1
- import{r as n,u as Mt,a as Ne,b as It,j as K,L as jt,p as Je,c as Bt,d as At,e as Dt,g as Nt,h as qt,m as mt,k as Ht,o as Yt,l as _t,n as Ft,t as $t,s as Vt,q as Kt,v as Gt,w as Ut}from"./index-C2YHuD05.js";const Wt=48,Xt=.25,Jt=/^(\d+(?:\.\d+)?|\.\d+)(px|%)$/i;function St(e,o){if(typeof e=="number")return Number.isFinite(e)&&e>0&&e<=1?e*o:null;const s=Jt.exec(e.trim());if(s===null)return null;const c=Number.parseFloat(s[1]);return c>0?s[2].toLowerCase()==="%"?c/100*o:c:null}function Qt(e){return St(e,1)!==null}function Zt(e,o){const s=[];for(const c of e){const h=St(c,o);h!==null&&s.push(h)}return s}function en(e,o,s=Wt){const h=[0,...o.filter(f=>f>0&&f<e).map(f=>e-f)].sort((f,u)=>f-u),p=[];for(const f of h){const u=p[p.length-1];(u===void 0||f-u>=s)&&p.push(f)}return p}function tn(e,o){return o.reduce((s,c)=>Math.abs(c-e)<Math.abs(s-e)?c:s,o[0])}const nn=.3;function rn(e,o){if(e.length<2||o<=0)return null;const s=e[e.length-1];return o-s<=Xt*o?s:null}function Ye(e,o,s,c){const h=c!==null,p=h?o[o.length-2]:o[o.length-1],f=h?c:s,u=h?nn:0;return e<=p?1:e>=f?u:1-(1-u)*((e-p)/(f-p))}function on(e,o,s,c){let h=o;if(s>0){const p=o.filter(f=>f>=c);p.length>0&&(h=p)}else if(s<0){const p=o.filter(f=>f<=c);p.length>0&&(h=p)}return tn(e,h)}const _e="--_sheet-keyboard-inset",sn=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function Ve(){return window.visualViewport?.height??window.innerHeight}function cn(){return Ve()>=window.innerHeight-.5}function an(){const e=window.navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||e.includes("Macintosh")&&window.navigator.maxTouchPoints>1}function Ke(e){return e instanceof HTMLTextAreaElement?!e.disabled&&!e.readOnly:e instanceof HTMLInputElement?!e.disabled&&!e.readOnly&&!sn.has((e.getAttribute("type")??"text").toLowerCase()):e instanceof HTMLElement&&e.matches('[contenteditable]:not([contenteditable="false"])')}function gt(e,o){if(!(e instanceof Element))return null;const s=e.closest('input, textarea, [contenteditable]:not([contenteditable="false"])');if(o.contains(s)&&Ke(s))return s;const c=e.closest("label"),h=c instanceof HTMLLabelElement?c.control:null;return o.contains(h)&&Ke(h)?h:null}function ln({bodyRef:e,bottomClearance:o,isEnabled:s,isFullyExpanded:c,isPageScrollLocked:h,isSheetTraveling:p,isOpen:f,isPresented:u,sheetRef:j}){const E=n.useRef(!1),B=n.useRef(!1),A=n.useRef(c),M=n.useRef(f);A.current=c,M.current=f,n.useEffect(()=>{if(!s||!p)return;const i=j.current,b=document.activeElement;i&&b instanceof HTMLElement&&b!==i&&i.contains(b)&&(B.current=E.current,i.focus({preventScroll:!0}))},[s,p,j]),n.useEffect(()=>{if(!s||!u||f)return;const i=j.current,b=document.activeElement;i&&b instanceof HTMLElement&&b!==i&&i.contains(b)&&(B.current=E.current,b.blur())},[s,f,u,j]),n.useEffect(()=>{const i=e.current,b=j.current;if(!s||!u||!i)return;let P=null,D=null;const N=an(),ee=()=>{i.style.setProperty(_e,"0px"),P=null,D=null,E.current=!1,B.current=!1},F=(d,x)=>{if(typeof i.scrollBy!="function"){i.scrollTop+=d;return}const S=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;i.scrollBy({top:d,behavior:x&&!S?"smooth":"instant"})},Q=(d,x)=>{const S=i.getBoundingClientRect(),I=d.getBoundingClientRect(),q=Ve(),se=Math.max(0,S.bottom-q)>0?o:0,re=S.top,C=Math.min(S.bottom,q-se);C<=re||(I.bottom>C?F(I.bottom-C,x):I.top<re&&F(I.top-re,x))},R=d=>{const x=Ve();if(cn()){ee();return}if(Math.max(0,d.bodyBottom-x)===0){ee();return}const I=Math.max(0,d.bodyBottom-(x-o));i.style.setProperty(_e,`${I}px`)},w=d=>{if(!A.current)return;const x=gt(d.relatedTarget,i);if(x){x!==document.activeElement&&x.focus({preventScroll:!0});return}const S=gt(d.target,i);M.current&&S&&!d.relatedTarget&&b?.focus({preventScroll:!0})},te=()=>{const d=document.activeElement;if(!A.current||!(d instanceof HTMLElement)||!i.contains(d)||!Ke(d)){if(B.current&&P){R(P);return}ee();return}B.current=!1;const x=i.getBoundingClientRect(),S=Ve(),I=Math.max(0,x.bottom-S),q=I>0?o:0;P=I>0?{bodyBottom:x.bottom}:null,h&&I>0&&!E.current&&(D={x:window.scrollX,y:window.scrollY}),E.current=I>0;const me=I>0?Math.max(0,x.bottom-(S-q)):0;i.style.setProperty(_e,`${me}px`),Q(d,I>0)};let H=0;const k=()=>{cancelAnimationFrame(H),H=requestAnimationFrame(te)},X=()=>{const d=D;if(d==null||window.scrollX===d.x&&window.scrollY===d.y)return;window.scrollTo(d.x,d.y);const x=document.activeElement;x instanceof HTMLElement&&i.contains(x)&&Ke(x)&&Q(x,!1)},y=typeof ResizeObserver>"u"?null:new ResizeObserver(k),$=()=>{if(!y)return;y.disconnect();const d=new Set([i]);b&&d.add(b);for(const S of i.children)d.add(S);const x=document.activeElement;if(x instanceof HTMLElement&&i.contains(x))for(let S=x;S&&S!==i;S=S.parentElement)d.add(S);for(const S of d)y.observe(S)},G=typeof MutationObserver>"u"?null:new MutationObserver(d=>{d.every(x=>x.type==="attributes"&&x.target===i)||($(),k())}),U=()=>{$(),k()},Y=()=>{B.current=E.current,k()},_=d=>{d.target===b&&d.propertyName==="transform"&&k()},ne=window.visualViewport;return N&&document.addEventListener("blur",w,!0),i.addEventListener("focusin",U),i.addEventListener("focusout",Y),b?.addEventListener("transitionend",_),ne?.addEventListener("resize",k),ne?.addEventListener("scroll",k),window.addEventListener("scroll",X),window.addEventListener("resize",k),G?.observe(i,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),$(),k(),()=>{cancelAnimationFrame(H),N&&document.removeEventListener("blur",w,!0),i.removeEventListener("focusin",U),i.removeEventListener("focusout",Y),b?.removeEventListener("transitionend",_),ne?.removeEventListener("resize",k),ne?.removeEventListener("scroll",k),window.removeEventListener("scroll",X),window.removeEventListener("resize",k),y?.disconnect(),G?.disconnect(),i.style.removeProperty(_e),E.current=!1,B.current=!1}},[e,o,s,h,u,j])}const pt=.998,un=pt/(1-pt),fn=48,Qe=100,Fe=.4,yt=40;function Ze(e){return e.syntheticTouch===!0}const dn=.35,xn=4,et=8;function hn(){typeof navigator>"u"||typeof navigator.vibrate!="function"||Rt()||navigator.vibrate(8)}function mn(e,o){let s=o[0],c=Math.abs(e-s);for(const f of o){const u=Math.abs(e-f);u<c&&(c=u,s=f)}if(c>=yt)return e;const h=c/yt,p=1-h*h;return e+(s-e)*p}function tt(e,o,s){return Math.max(0,e-o-s)}function Tt(e){const o=Number.parseFloat(getComputedStyle(e).paddingBlockEnd);return Number.isFinite(o)?o:0}function bt(e){if(!e)return 0;const o=Tt(e);return Math.max(0,e.scrollHeight-e.clientHeight-o)-e.scrollTop}function gn(e){if(e.scrollHeight-e.clientHeight<=1)return!1;const{overflowY:o}=getComputedStyle(e);return o==="auto"||o==="scroll"}function kt(e,o){const s=[];for(let c=e instanceof Element?e:null;c!=null&&c!==o;c=c.parentElement)c instanceof HTMLElement&&gn(c)&&s.push(c);return s.push(o),s}function pn(e){return e.scrollTop<=0}function yn(e){return e.scrollTop+e.clientHeight>=e.scrollHeight-1}function $e(e){return e.every(pn)}function nt(e){return e.every(yn)}function Le(e,o,s){return Math.max(0,e-s-o)}function Rt(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function bn({isOpen:e,canDismiss:o=!0,offscreenBlockEndInset:s=0,onDismiss:c,snapHeights:h,onSnap:p,onScrimOpacity:f}){const[u,j]=n.useState(0),[E,B]=n.useState(0),[A,M]=n.useState(!1),[i,b]=n.useState(!1),[P,D]=n.useState(0),[N,ee]=n.useState(0),[F,Q]=n.useState(0),R=n.useRef(0),w=n.useRef(0),[te,H]=n.useState(null),[k,X]=n.useState(!1),y=n.useRef(0),$=n.useRef(null),G=n.useRef(null),U=n.useRef(s);U.current=Math.max(0,s);const Y=n.useCallback(t=>{const r=Math.max(0,t);R.current=r,Q(r)},[]),_=n.useCallback(t=>{const r=Math.max(0,t);Math.abs(r-y.current)>.5&&(y.current=r,ee(r))},[]),ne=n.useCallback(()=>{X(!0),$.current=null,H(null);const t=G.current;G.current=null,t!=null&&_(t)},[_]),d=n.useCallback((t,r,m,T,g,L,a)=>{const v=tt(t,m,L);if(a&&Math.abs(T-r)>.5&&!Rt()){G.current=v,$.current=g,H(g);return}G.current=null,$.current=null,H(null),X(Math.abs(g-m)>.5),_(v)},[_]),x=n.useRef(0);A||(x.current=E);const S=n.useRef(e);S.current=e;const I=n.useRef(h);I.current=h;const q=n.useRef(c),me=n.useRef(o),se=n.useRef(p),re=n.useRef(f);n.useEffect(()=>{q.current=c,me.current=o,se.current=p,re.current=f});const C=n.useRef(null),ge=n.useRef(0),pe=n.useRef(null),ye=n.useRef(null),be=n.useRef(null);n.useLayoutEffect(()=>{if(!k)return;pe.current?.offsetHeight;const t=requestAnimationFrame(()=>{X(!1)});return()=>cancelAnimationFrame(t)},[k]);const le=n.useCallback(t=>{t<=0||!S.current||x.current>0||(ge.current=t,D(r=>r===t?r:t))},[]),Ge=n.useCallback(t=>{if(be.current?.disconnect(),be.current=null,pe.current=t,!t||typeof ResizeObserver>"u"){t&&le(t.getBoundingClientRect().height);return}le(t.getBoundingClientRect().height);const r=new ResizeObserver(m=>{const T=m[0];if(T){const g=T.borderBoxSize?.[0]?.blockSize;le(g??T.target.getBoundingClientRect().height)}});r.observe(t),be.current=r},[le]);n.useEffect(()=>()=>be.current?.disconnect(),[]),n.useEffect(()=>{e&&(j(0),B(0),M(!1),b(!1),X(!1),Y(0),w.current=0,y.current=0,$.current=null,G.current=null,ee(0),H(null))},[e,Y]);const ue=n.useCallback(()=>ge.current>0?ge.current:pe.current?.getBoundingClientRect().height??0,[]),oe=n.useCallback(t=>{const r=Le(t,0,U.current),m=en(r,I.current?.()??[]);return{offsets:m,peekOffset:rn(m,r)}},[]),Re=n.useCallback(()=>{const t=pe.current;if(!t)return ge.current;const r=t.style.height;if(r==="")return t.getBoundingClientRect().height;t.style.height="";const m=t.getBoundingClientRect().height;return t.style.height=r,m},[]),ce=n.useCallback(()=>{if(!S.current||C.current!=null||$.current!=null)return;const t=Re();if(t<=0)return;const{offsets:r,peekOffset:m}=oe(t),T=Math.min(w.current,r.length-1),g=r[T],L=g===m?0:g,a=R.current;if(t===ge.current&&Math.abs(g-x.current)<=.5&&Math.abs(L-a)<=.5)return;ge.current=t,D(t),w.current=T,d(a,g,L,g,a,bt(ye.current),!1),Y(L),B(g),se.current?.(Le(t,g,U.current));const v=r[r.length-1],l=Le(t,v,U.current);re.current?.(Ye(g,r,v+l*Fe,m))},[Re,d,Y,oe]);n.useEffect(()=>{if(!(!e||typeof window>"u"))return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),()=>{window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce)}},[e,ce]);const Be=n.useRef(!1);n.useLayoutEffect(()=>{if(!Be.current){Be.current=!0;return}ce()},[ce,h]);const qe=n.useCallback((t,r)=>{const m=pe.current;if(m==null)return;const T=t-r;m.style.transform=T!==0?`translateY(${T}px)`:""},[]),J=n.useCallback(t=>{const r=C.current;if(r==null)return;C.current=null,t?.hasPointerCapture?.(r.pointerId)&&t.releasePointerCapture(r.pointerId),j(r.baseOffset),M(!1),b(!1),d(r.baseLayoutOffset,r.baseOffset,r.baseLayoutOffset,r.renderedOffset,r.layoutOffset,r.naturalEndGap,!0);const{offsets:m,peekOffset:T}=oe(r.height),g=m[m.length-1],L=Le(r.height,g,U.current),a=g+L*Fe;re.current?.(Ye(r.baseOffset,m,a,T))},[d,oe]);n.useEffect(()=>{const t=()=>J(),r=()=>{document.visibilityState==="hidden"&&J()};return window.addEventListener("blur",t),document.addEventListener("visibilitychange",r),()=>{window.removeEventListener("blur",t),document.removeEventListener("visibilitychange",r)}},[J]);const He=n.useCallback((t,r,m,T,g,L,a,v,l,z)=>{const{offsets:W,peekOffset:xe}=oe(m),Se=W[W.length-1],ae=Le(m,Se,U.current),Oe=Se+ae*Fe,De=g>fn?t+r*un:t,xt=Te=>{const ht=Te===xe?0:Te;d(a,Te,ht,v,l,z,!0),Y(ht),w.current=Math.max(0,W.indexOf(Te)),B(Te),se.current?.(Le(m,Te,U.current)),re.current?.(Ye(Te,W,Oe,xe)),Te!==L&&hn()};if(T>0&&De>Oe){me.current?(d(a,L,a,a,a,z,!1),q.current()):xt(Se);return}const zt=on(Math.min(Math.max(De,0),Se),W,T,L);xt(zt)},[d,Y,oe]),O=n.useCallback((t,r,m)=>{const T=t.currentTarget,g=Ze(t);g||T.setPointerCapture?.(t.pointerId);const L=m??t.clientY,a=bt(ye.current),v=R.current;C.current={syntheticTouch:g,pointerId:t.pointerId,startCoord:L,lastCoord:t.clientY,lastTime:t.timeStamp,samples:[{t:t.timeStamp,y:t.clientY}],velocity:0,height:r,baseOffset:E,baseLayoutOffset:v,renderedOffset:E,layoutOffset:v,naturalEndGap:a,hasTraveled:!1},_(tt(v,v,a)),j(E),M(!0)},[E,_]),ke=n.useCallback(t=>{t.button!==0||!t.isPrimary||(t.preventDefault(),O(t,ue()))},[O,ue]),Z=n.useCallback(t=>{C.current!=null&&(t.preventDefault(),J(t.currentTarget))},[J]),fe=n.useCallback(t=>{C.current?.syntheticTouch||C.current?.pointerId===t.pointerId&&J()},[J]),ve=n.useCallback(t=>{const r=C.current;if(!r||r.pointerId!==t.pointerId||r.syntheticTouch&&!Ze(t))return;const m=t.clientY-r.startCoord;if(t.timeStamp-r.lastTime>0){for(r.lastCoord=t.clientY,r.lastTime=t.timeStamp,r.samples.push({t:t.timeStamp,y:t.clientY});r.samples.length>2&&t.timeStamp-r.samples[0].t>Qe;)r.samples.shift();const Oe=r.samples[0],De=Math.min(t.timeStamp-Oe.t,Qe);r.velocity=De>0?(t.clientY-Oe.y)/De:0}const{offsets:g,peekOffset:L}=oe(r.height),a=r.baseOffset+m,v=g[g.length-1];let l;a<0?l=Math.max(-48,a*dn):a>v?l=a:l=mn(a,g);const z=l<r.baseOffset?0:r.baseLayoutOffset,W=z!==r.layoutOffset;r.renderedOffset=l,r.layoutOffset=z,x.current=l,qe(l,z),W&&j(l),!r.hasTraveled&&l!==r.baseOffset&&(r.hasTraveled=!0,b(!0)),_(tt(r.baseLayoutOffset,z,r.naturalEndGap));const xe=g[g.length-1],Se=Le(r.height,xe,U.current),ae=xe+Se*Fe;re.current?.(Ye(l,g,ae,L))},[oe,_,qe]),Ee=n.useCallback(t=>{const r=C.current;if(!r||r.pointerId!==t.pointerId||r.syntheticTouch&&!Ze(t))return;const m=t.currentTarget,T=t.clientY-r.startCoord,g=Math.max(0,r.baseOffset+T),L=T===0?0:T>0?1:-1,a=t.timeStamp-r.lastTime<Qe?r.velocity:0;C.current=null,r.syntheticTouch||m.releasePointerCapture?.(t.pointerId),M(!1),b(!1),He(g,a,r.height||1,L,Math.abs(T),r.baseOffset,r.baseLayoutOffset,r.renderedOffset,r.layoutOffset,r.naturalEndGap)},[He]),de=n.useRef(null),Ce=n.useCallback(t=>{if(t.button!==0||!t.isPrimary)return;const r=kt(t.target,t.currentTarget);if(!$e(r)){de.current=null;return}de.current={pointerId:t.pointerId,startCoord:t.clientY,scrollers:r}},[]),ze=n.useCallback(t=>{if(C.current){ve(t);return}const r=de.current;if(!r||r.pointerId!==t.pointerId)return;const m=t.clientY-r.startCoord;m>et&&$e(r.scrollers)?(de.current=null,O(t,ue(),r.startCoord),ve(t)):m<0&&(de.current=null)},[O,ve,ue]),Ae=n.useCallback(t=>{de.current=null,!C.current?.syntheticTouch&&C.current&&Ee(t)},[Ee]),we=n.useRef(null),Me=n.useRef(null),ie=n.useCallback(t=>{we.current=null,de.current=null,J(t)},[J]),V=n.useRef(O),Ie=n.useRef(J),je=n.useRef(ie),Pe=n.useRef(ve),st=n.useRef(Ee),Ue=n.useRef(ue);n.useEffect(()=>{V.current=O,Ie.current=J,je.current=ie,Pe.current=ve,st.current=Ee,Ue.current=ue});const ct=n.useCallback(t=>{const r=(a,v)=>({syntheticTouch:!0,pointerId:a.identifier,clientY:a.clientY,timeStamp:Date.now(),currentTarget:v,setPointerCapture:()=>{},releasePointerCapture:()=>{}}),m=a=>{const v=a.currentTarget;if(a.touches.length>1){je.current(v);return}const l=a.changedTouches[0];if(!l){we.current=null;return}const z=kt(a.target,v),W=$e(z),xe=nt(z)&&x.current>0;we.current={id:l.identifier,startY:l.clientY,scrollers:z,top:W,bottom:xe,contentEndY:null,promotedAtContentEnd:!1}},T=a=>{const v=a.currentTarget;if(a.touches.length>1){je.current(v);return}const l=we.current;if(C.current){const ae=[...a.changedTouches].find(Oe=>Oe.identifier===C.current?.pointerId);if(!ae)return;if(l?.promotedAtContentEnd&&l.contentEndY!=null){if(ae.clientY>=l.contentEndY){l.contentEndY=null,l.promotedAtContentEnd=!1,Ie.current(v);return}Pe.current(r(ae,v));return}a.preventDefault(),Pe.current(r(ae,v));return}if(!l)return;const z=[...a.changedTouches].find(ae=>ae.identifier===l.id);if(!z)return;const W=z.clientY-l.startY,xe=l.top&&W>et&&$e(l.scrollers),Se=l.bottom&&W<-et&&nt(l.scrollers);if(xe||Se){a.preventDefault(),we.current=null,V.current(r(z,v),Ue.current(),l.startY),Pe.current(r(z,v));return}(l.top&&W<0||l.bottom&&W>0)&&(l.top=!1,l.bottom=!1),x.current>0&&nt(l.scrollers)?l.contentEndY==null?l.contentEndY=z.clientY:l.contentEndY-z.clientY>=xn&&(l.promotedAtContentEnd=!0,V.current(r(z,v),Ue.current(),l.contentEndY),Pe.current(r(z,v))):l.contentEndY=null},g=a=>{we.current=null;const v=C.current?.pointerId;if(v==null)return;const l=[...a.changedTouches].find(W=>W.identifier===v),z=a.currentTarget;l?st.current(r(l,z)):a.touches.length===0&&Ie.current(z)},L=ye.current;if(L&&Me.current){const a=Me.current;L.removeEventListener("touchstart",a.start),L.removeEventListener("touchmove",a.move),L.removeEventListener("touchend",a.end),L.removeEventListener("touchcancel",a.end)}ye.current=t,t?(t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",T,{passive:!1}),t.addEventListener("touchend",g,{passive:!0}),t.addEventListener("touchcancel",g,{passive:!0}),Me.current={start:m,move:T,end:g}):Me.current=null},[]),it=Mt("(prefers-reduced-motion: reduce)"),at=n.useCallback(t=>{if(y.current<=0)return;const r=Tt(t),m=Math.max(0,t.scrollHeight-t.clientHeight-r),T=Math.max(0,t.scrollTop-m);T<y.current-.5&&_(T)},[_]),lt=n.useCallback(t=>{C.current!=null||$.current!=null||at(t.currentTarget)},[at]),ut=n.useCallback(t=>{if(!t.isPrimary){ie(t.currentTarget);return}ke(t)},[ke,ie]),ft=n.useCallback(t=>{if(!t.isPrimary){ie(t.currentTarget);return}Ce(t)},[Ce,ie]),We=n.useCallback(t=>{t.touches.length>1&&ie(t.currentTarget)},[ie]),dt=n.useCallback(t=>{const r=C.current;r?.pointerId!==t.pointerId||r.syntheticTouch||J(t.currentTarget)},[J]),Xe=A?u:E,Pt=n.useMemo(()=>({style:{transform:Xe!==0?`translateY(${Xe}px)`:void 0,transition:e&&(A||k||it)?"none":void 0,touchAction:"pinch-zoom",overscrollBehavior:"contain"}}),[Xe,A,e,k,it]),Ot=n.useMemo(()=>({style:{touchAction:"pinch-zoom",cursor:"grab"},onContextMenu:Z,onLostPointerCapture:fe,onPointerDown:ut,onPointerMove:ve,onPointerUp:Ee,onPointerCancel:dt,onTouchStart:We,onTouchMove:We}),[Ee,Z,dt,ut,We,fe,ve]),Lt=n.useMemo(()=>({ref:ct,onContextMenu:Z,onLostPointerCapture:fe,onPointerDown:ft,onPointerMove:ze,onPointerUp:Ae,onPointerCancel:Ae,onScroll:lt}),[ct,Ae,ft,ze,lt,Z,fe]);return{sheetRef:Ge,contentProps:Pt,handleProps:Ot,bodyProps:Lt,bodyElementRef:ye,dragOffset:u,settledOffset:E,isDragging:A,isTraveling:i,activeOffsetRef:x,sheetHeight:P,scrollPreservationInset:N,settlingLayoutOffset:te,settledLayoutOffset:F,completeScrollAreaSettle:ne}}const vt={hug:"92dvh",capped:"62dvh",tall:"92dvh"},kn=48,vn=48,En=50;function wn(){return typeof window>"u"?0:window.innerHeight}function Sn(e){let o="";for(const s of e??[])o+=`${typeof s}:${s}|`;return o}const he={sheet:{kfzvcC:"x67bb7w",kB7OPa:"x9f619",kVAEAm:"x1n2onr6",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kAzted:"x2lwn1j",kzqmXN:"xh8yej3",ks0D6T:"x11gisft",kWkggS:"x10xzikg",kEafiO:"x11xkdxz",kPef9Z:"x13fuv20",kLZC3w:"x1pc3f07",k2ei4v:"xgbv0en",kVhnKS:"x1t7ytsu",kGJrpR:"x1j92z86",ke9TFa:"xw8tdv1",k8ry5P:"x18b5jzi",kBCPoo:"x1gejf6u",krdFHd:"x81l70g",kfmiAY:"x7hs6f1",kGVxlE:"x1kcpxr7",kI3sdo:"x1a2a7pz",kVQacm:"xb3r6kr",kGO01o:"x1wkw6tp",k1K539:"x1if0o47",k3aq6I:"xnn1q72 xhbqy3z",kSiTet:"x1hc1fzr",k1ekBW:"xwcsmn1",kIyJzY:"x80gvsz",kAMwcw:"xlr8y92",k6sLGO:"x1q1rmc8",k6CgDc:"xzg1mie",$$css:!0},sheetClosing:{k3aq6I:"x1weeur4",kAMwcw:"xv2sgk5",$$css:!0},sheetFading:{kSiTet:"xg01cxk",$$css:!0},sheetInactive:{kfzvcC:"x47corl",$$css:!0},body:{kzQI83:"x1iyjqo2",kAzted:"x2lwn1j",kB7OPa:"x9f619",kFalU9:"xge0x1e",kInvED:"x1wfwxd8 x1nw7mhf",kWkggS:"x10xzikg",kGO01o:"x18d9i69",$$css:!0},content:{k1xSpc:"xufnvkl",kB7OPa:"x9f619",kZKoxP:"x5yr21d",kAzted:"x121v3j4",$$css:!0},tallKeyboardBody:{kFlMNQ:"xrw9175",k5JduY:"x1s928wv",kc3QkE:"xhkezso",k4zj60:"xu6fald",kloYau:"x2q1x1w",$$css:!0},budget:{kZKoxP:"x1tpcejd",$$css:!0},hugHeight:{kZKoxP:"xg7h5cd",kskxy:"x14bu9tk",$$css:!0}};function Tn(e){return e.kind==="open"?e.entering?"entering":null:e.kind==="retained"?e.motion==="covered"?null:e.motion:e.kind==="exiting"?"exiting":null}function Et(e,o,s){if(e==null)return s(),()=>{};let c=!1,h=null;const p=()=>{c||(c=!0,h!=null&&clearTimeout(h),e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f),s())},f=i=>{i.target===e&&i.propertyName===o&&p()};e.addEventListener("transitionend",f),e.addEventListener("transitioncancel",f);const u=getComputedStyle(e);if(e.style.transition.trim()==="none"||u.transition.trim()==="none")return p(),()=>{};const j=u.transitionProperty.split(",").map(i=>i.trim()),E=u.transitionDuration.split(",").map(wt),B=u.transitionDelay.split(",").map(wt);let A=!1;const M=j.reduce((i,b,P)=>{if(b!==o&&b!=="all")return i;const D=E[P%E.length],N=B[P%B.length];return D==null||N==null?(A=!0,i):Math.max(i,D+N)},0);return A?()=>{e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f)}:M<=0?(p(),()=>{}):(h=setTimeout(p,M+En),()=>{h!=null&&clearTimeout(h),e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f)})}function wt(e){const o=e.trim();if(!/^-?(?:\d+|\d*\.\d+)(?:ms|s)$/.test(o))return null;const s=Number.parseFloat(e);return o.endsWith("ms")?s:s*1e3}function rt({ref:e,state:o,height:s,label:c,children:h,padding:p,snapPoints:f,className:u,style:j,tabIndex:E,xstyle:B,isSwipeDismissAllowed:A=!0,isPageScrollLocked:M=!1,onDismiss:i,onScrimOpacity:b,onElementChange:P,onMotionStart:D,onMotionComplete:N,...ee}){const F=n.useRef(null),Q=n.useRef(o),R=n.useRef(!1),w=n.useRef(D),te=n.useRef(N),H=n.useRef(null),k=n.useRef(null),X=o.kind==="open"&&o.entering,y=Q.current,$=y.kind==="open"&&y.entering;X&&!$?R.current=y.kind==="retained":X||(R.current=!1),n.useLayoutEffect(()=>{Q.current=o,w.current=D,te.current=N},[N,D,o]);const G=o.kind==="open",U=o.kind!=="hidden",Y=o.kind==="retained",_=Y||o.kind==="exiting",ne=o.kind==="exiting",d=Y&&o.motion==="fading",x=Y?o.alignmentOffset:0,S=Sn(f),I=n.useRef(f);I.current=f;const{snapHeights:q,ignoredSnapPointsMessage:me}=n.useMemo(()=>{if(S==="")return{snapHeights:void 0,ignoredSnapPointsMessage:""};const V=(I.current??[]).filter(Ie=>!Qt(Ie));return{snapHeights:()=>Zt(I.current??[],wn()),ignoredSnapPointsMessage:V.length===0?"":`snapPoints ignored ${JSON.stringify(V)}. A snap point is a viewport fraction above 0 and up to 1 (0.5 is half the screen), a px length ('320px'), or a percentage ('50%').`}},[S]);Ne("BottomSheet",me,me!=="");const{contentProps:se,handleProps:re,bodyProps:C,bodyElementRef:ge,sheetRef:pe,dragOffset:ye,settledOffset:be,isDragging:le,isTraveling:Ge,sheetHeight:ue,scrollPreservationInset:oe,settlingLayoutOffset:Re,settledLayoutOffset:ce,completeScrollAreaSettle:Be}=bn({isOpen:G,canDismiss:A,offscreenBlockEndInset:kn,onDismiss:i,snapHeights:q,onScrimOpacity:b}),{getViewportProps:qe,getContentProps:J}=It({axis:"both",keyboardAccess:{owner:"contentOrViewport",label:c},overscroll:"contain",stickyContainment:"always"}),He=n.useCallback(V=>{pe(V),F.current=V,P?.(V)},[P,pe]);ln({bodyRef:ge,bottomClearance:vn,isEnabled:s==="tall",isFullyExpanded:be===0,isPageScrollLocked:M,isSheetTraveling:Ge,isOpen:G,isPresented:U,sheetRef:F}),n.useImperativeHandle(e,()=>F.current,[]);const O=Tn(o);n.useLayoutEffect(()=>{if(O!=null){if(H.current=null,k.current=null,O==="entering"&&R.current){k.current=O;return}return Et(F.current,O==="fading"?"opacity":"transform",()=>{H.current===O?te.current?.(O):k.current=O})}},[O]),n.useLayoutEffect(()=>{if(Re!=null)return Et(F.current,"transform",Be)},[Be,Re]),n.useEffect(()=>{if(O!=null)return w.current?.(O),H.current=O,k.current===O&&(k.current=null,te.current?.(O)),()=>{H.current===O&&(H.current=null),k.current===O&&(k.current=null)}},[O]);const ke=p==null,Z=p??4,fe=Vt[Z],Ee=typeof s=="string"&&s in vt?vt[s]:typeof s=="number"?`${s}px`:s,de=ue>0;let Ce=se.style.transform,ze;if(de){const V=le?ye<be?0:ce:Re??ce,je=(le?ye:be)-V,Pe=le||Re!=null;ze=V>0||Pe?`${Math.max(0,ue-Math.max(0,V))}px`:void 0,Ce=je!==0?`translateY(${je}px)`:void 0}const Ae=x>0?[Ce,`translateY(${x}px)`].filter(Boolean).join(" "):Ce,we=G?Ce:Y?Ae:void 0,Me=j?.transform;n.useLayoutEffect(()=>{if(le||Me!=null)return;const V=F.current;V!=null&&(V.style.transform=we??"")});const ie={transition:se.style.transition,touchAction:se.style.touchAction,overscrollBehavior:se.style.overscrollBehavior,height:ze};return K.jsxs("div",{...ee,ref:He,tabIndex:E??-1,...mt($t("bottom-sheet"),Je(Ft.reset,_t.reset,he.sheet,Yt.reset,s==="hug"?he.hugHeight:he.budget,ne&&he.sheetClosing,d&&he.sheetFading,_&&he.sheetInactive,B),u,{"--_sheet-budget":Ee,...G?ie:Y||ne?{height:ze}:{},...j}),children:[K.jsx("div",{className:"x10l6tqk x13vifvy x1o0tod xtijo5x x1vjfegm x78zum5 x6s0dn4 xl56j7k xvpftlf xafqdz2 x1j4r261 x1jm3nie x16khyan",...re,"aria-hidden":"true",children:K.jsx("div",{className:"x1m747yf x11c6zpc xjspbzw x1m4xfpy"})}),K.jsx("div",{...qe({...C,...mt(Je(Ht.focusVisible,he.body,s==="tall"&&he.tallKeyboardBody),oe>0?{style:{paddingBlockEnd:`${oe}px`}}:{})}),children:K.jsx("div",{...J(Je(he.content,...Bt(ke?{useThemeDefault:"bottom-sheet"}:{paddingInnerX:fe,paddingInnerY:fe,paddingOuterX:fe,paddingOuterY:fe}),!ke&&Z!==4&&At[Z],!ke&&Z!==4&&Dt[Z],!ke&&Z!==4&&Nt[Z],!ke&&Z!==4&&qt[Z])),children:K.jsx(jt,{children:h})})})]})}rt.displayName="BottomSheetPanel";function Rn(){return K.jsx("div",{className:"xixxii4 x17y0mx6 x1ey2m1c x1kpxq89 x10xzikg xhtitgo x47corl x1cb67k9 xt2iwb0","data-sheet-edge-tint":"","aria-hidden":"true"})}const ot=n.createContext(null);ot.displayName="BottomSheetSwitcherContext";function Cn(e,o){switch(e){case"active":return{kind:"open",entering:!1};case"entering":return{kind:"open",entering:!0};case"covered":case"aligning":case"fading":return{kind:"retained",motion:e,alignmentOffset:o};case"exiting":return{kind:"exiting"};case"hidden":return{kind:"hidden"}}}function Ct(e,o){const s=document.activeElement;if(s!=null&&e?.contains(s))return;const c=e?.querySelector("[data-autofocus]");c!=null?c.focus({preventScroll:!0}):o&&e?.focus({preventScroll:!0})}function Pn({ref:e,isOpen:o,onOpenChange:s,label:c,children:h,height:p="capped",snapPoints:f,hasScrim:u=!0,finalFocusRef:j,purpose:E="info",xstyle:B,...A}){const M=n.useRef(null),i=n.useRef(null),b=n.useRef(null),[P,D]=n.useState(o),N=o||P,ee=o?{kind:"open",entering:!1}:P?{kind:"exiting"}:{kind:"hidden"},F=n.useCallback(()=>{o&&E!=="required"&&s(!1)},[o,s,E]),Q=n.useCallback(()=>{E==="info"&&s(!1)},[s,E]),R=n.useCallback(y=>{i.current=y},[]),w=n.useCallback(y=>{M.current?.style.setProperty("--_sheet-scrim-opacity",String(y))},[]);n.useEffect(()=>{const y=M.current;if(y==null||!o)return;D(!0),y.style.setProperty("--_sheet-scrim-opacity","1"),y.open||(u?(b.current=document.activeElement,y.showModal()):y.show(),Ct(i.current,u))},[u,o]),n.useEffect(()=>{!o&&P&&u&&w(0)},[w,u,o,P]);const te=n.useCallback(y=>{if(y!=="exiting"||o)return;const $=M.current;$?.open&&$.close(),D(!1),(j?.current??b.current)?.focus(),b.current=null},[j,o]);Kt(N&&u),Ne("BottomSheet","requires a non-empty `label` for an accessible name; the open sheet has no built-in heading to derive one from.",o&&!c);const{shouldDismissOnCloseRequest:H}=Gt({isActive:N,escapeBehavior:o&&E!=="required"?"close":"block",onDismiss:F,getContainer:()=>M.current,isPresent:()=>M.current?.open??!1}),k=n.useCallback(y=>{y.preventDefault(),H()&&F()},[F,H]),X=n.useCallback(y=>{u&&y.target===y.currentTarget&&Q()},[Q,u]);return K.jsxs("dialog",{...{0:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz"},8:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq"},4:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w"},12:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w"},2:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x"},10:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x"},6:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x"},14:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x"},1:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x47corl xfo81ep xh8yej3 x5yr21d"},9:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x47corl xfo81ep xh8yej3 x5yr21d"},5:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w x47corl xfo81ep xh8yej3 x5yr21d"},13:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w x47corl xfo81ep xh8yej3 x5yr21d"},3:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},11:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},7:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},15:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"}}[!!N<<3|!!u<<2|!!(u&&!o&&P)<<1|!u<<0],ref:M,"aria-label":c,"aria-hidden":!o&&P?"true":void 0,"aria-modal":u&&o?"true":void 0,role:E==="required"?"alertdialog":void 0,inert:!o&&P?!0:void 0,onCancel:k,onClick:X,children:[K.jsx("div",{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl",children:K.jsx(rt,{...A,ref:e,state:ee,height:p,label:c,snapPoints:f,isSwipeDismissAllowed:E==="info",isPageScrollLocked:N&&u,xstyle:B,onDismiss:Q,onScrimOpacity:w,onElementChange:R,onMotionComplete:te,children:K.jsx(Ut,{children:h})})}),K.jsx(Rn,{})]})}function On({switcher:e,ref:o,sheetId:s,label:c,children:h,height:p="capped",snapPoints:f,purpose:u="info",xstyle:j,...E}){const{activeSheet:B,hasScrim:A,onActiveSheetChange:M,getSheetPhase:i,getSheetAlignmentOffset:b,registerSheetElement:P,registerSheetLabel:D,registerSheetPurpose:N,onSheetEnterStart:ee,onSheetTransitionComplete:F,onSheetScrimOpacityChange:Q}=e,R=typeof s=="string"&&s.length>0,w=R?i(s):"hidden",te=R?b(s):0,H=Cn(w,te),k=w==="active"||w==="entering",X=w==="covered"||w==="aligning"||w==="fading"||w==="exiting",y=w!=="hidden",$=w==="active"||w==="entering",G=n.useRef(null),U=n.useRef(w),Y=U.current,_=n.useRef(!1);n.useLayoutEffect(()=>{U.current=w},[w]);const ne=n.useCallback(()=>{u==="info"&&R&&B===s&&M(null)},[B,R,M,u,s]),d=n.useCallback(q=>{G.current=q,R&&P(s,q)},[R,P,s]),x=n.useCallback(q=>{q==="entering"&&R&&ee(s)},[R,ee,s]),S=n.useCallback(q=>{R&&F({sheetId:s,phase:q})},[R,F,s]),I=n.useCallback(q=>{R&&Q(s,q)},[R,Q,s]);return n.useLayoutEffect(()=>{if(R)return D(s,c),()=>D(s,null)},[R,c,D,s]),n.useLayoutEffect(()=>{if(R)return N(s,u),()=>N(s,null)},[R,u,N,s]),n.useEffect(()=>{if(k){const q=Y==="active"||Y==="entering";(!_.current||!q)&&Ct(G.current,A),_.current=!0}else w==="hidden"&&(_.current=!1)},[A,k,w,Y]),Ne("BottomSheet","requires a non-empty `label` for an accessible name; the open sheet has no built-in heading to derive one from.",k&&!c),K.jsx("div",{...{0:{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl"},2:{className:"x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg"},1:{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl x1vjfegm"},3:{className:"x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg x1vjfegm"}}[!y<<1|!!$<<0],hidden:!y,"aria-hidden":X?"true":void 0,inert:X?!0:void 0,children:K.jsx(rt,{...E,ref:o,state:H,height:p,label:c,snapPoints:f,isSwipeDismissAllowed:u==="info",isPageScrollLocked:A,xstyle:j,onDismiss:ne,onScrimOpacity:I,onElementChange:d,onMotionStart:x,onMotionComplete:S,children:K.jsx(ot,{value:null,children:h})})})}function Ln(e){const o=n.use(ot),s=e.sheetId,c=typeof s=="string"&&s.length>0;return Ne("BottomSheet","requires a non-empty `sheetId` when nested in BottomSheetSwitcher; standalone `isOpen` / `onOpenChange` props are ignored there.",o!=null&&!c),Ne("BottomSheet","`sheetId` only works inside BottomSheetSwitcher. Use `isOpen` and `onOpenChange` for a standalone sheet.",o==null&&s!=null),o!=null?K.jsx(On,{...e,switcher:o}):K.jsx(Pn,{...e})}Ln.displayName="BottomSheet";export{Ln as BottomSheet};
1
+ import{r as n,u as Mt,a as Ne,b as It,j as K,L as jt,p as Je,c as Bt,d as At,e as Dt,g as Nt,h as qt,m as mt,k as Ht,o as Yt,l as _t,n as Ft,t as $t,s as Vt,q as Kt,v as Gt,w as Ut}from"./index-B90pNaUa.js";const Wt=48,Xt=.25,Jt=/^(\d+(?:\.\d+)?|\.\d+)(px|%)$/i;function St(e,o){if(typeof e=="number")return Number.isFinite(e)&&e>0&&e<=1?e*o:null;const s=Jt.exec(e.trim());if(s===null)return null;const c=Number.parseFloat(s[1]);return c>0?s[2].toLowerCase()==="%"?c/100*o:c:null}function Qt(e){return St(e,1)!==null}function Zt(e,o){const s=[];for(const c of e){const h=St(c,o);h!==null&&s.push(h)}return s}function en(e,o,s=Wt){const h=[0,...o.filter(f=>f>0&&f<e).map(f=>e-f)].sort((f,u)=>f-u),p=[];for(const f of h){const u=p[p.length-1];(u===void 0||f-u>=s)&&p.push(f)}return p}function tn(e,o){return o.reduce((s,c)=>Math.abs(c-e)<Math.abs(s-e)?c:s,o[0])}const nn=.3;function rn(e,o){if(e.length<2||o<=0)return null;const s=e[e.length-1];return o-s<=Xt*o?s:null}function Ye(e,o,s,c){const h=c!==null,p=h?o[o.length-2]:o[o.length-1],f=h?c:s,u=h?nn:0;return e<=p?1:e>=f?u:1-(1-u)*((e-p)/(f-p))}function on(e,o,s,c){let h=o;if(s>0){const p=o.filter(f=>f>=c);p.length>0&&(h=p)}else if(s<0){const p=o.filter(f=>f<=c);p.length>0&&(h=p)}return tn(e,h)}const _e="--_sheet-keyboard-inset",sn=new Set(["button","checkbox","color","file","hidden","image","radio","range","reset","submit"]);function Ve(){return window.visualViewport?.height??window.innerHeight}function cn(){return Ve()>=window.innerHeight-.5}function an(){const e=window.navigator.userAgent;return/iPad|iPhone|iPod/.test(e)||e.includes("Macintosh")&&window.navigator.maxTouchPoints>1}function Ke(e){return e instanceof HTMLTextAreaElement?!e.disabled&&!e.readOnly:e instanceof HTMLInputElement?!e.disabled&&!e.readOnly&&!sn.has((e.getAttribute("type")??"text").toLowerCase()):e instanceof HTMLElement&&e.matches('[contenteditable]:not([contenteditable="false"])')}function gt(e,o){if(!(e instanceof Element))return null;const s=e.closest('input, textarea, [contenteditable]:not([contenteditable="false"])');if(o.contains(s)&&Ke(s))return s;const c=e.closest("label"),h=c instanceof HTMLLabelElement?c.control:null;return o.contains(h)&&Ke(h)?h:null}function ln({bodyRef:e,bottomClearance:o,isEnabled:s,isFullyExpanded:c,isPageScrollLocked:h,isSheetTraveling:p,isOpen:f,isPresented:u,sheetRef:j}){const E=n.useRef(!1),B=n.useRef(!1),A=n.useRef(c),M=n.useRef(f);A.current=c,M.current=f,n.useEffect(()=>{if(!s||!p)return;const i=j.current,b=document.activeElement;i&&b instanceof HTMLElement&&b!==i&&i.contains(b)&&(B.current=E.current,i.focus({preventScroll:!0}))},[s,p,j]),n.useEffect(()=>{if(!s||!u||f)return;const i=j.current,b=document.activeElement;i&&b instanceof HTMLElement&&b!==i&&i.contains(b)&&(B.current=E.current,b.blur())},[s,f,u,j]),n.useEffect(()=>{const i=e.current,b=j.current;if(!s||!u||!i)return;let P=null,D=null;const N=an(),ee=()=>{i.style.setProperty(_e,"0px"),P=null,D=null,E.current=!1,B.current=!1},F=(d,x)=>{if(typeof i.scrollBy!="function"){i.scrollTop+=d;return}const S=typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches;i.scrollBy({top:d,behavior:x&&!S?"smooth":"instant"})},Q=(d,x)=>{const S=i.getBoundingClientRect(),I=d.getBoundingClientRect(),q=Ve(),se=Math.max(0,S.bottom-q)>0?o:0,re=S.top,C=Math.min(S.bottom,q-se);C<=re||(I.bottom>C?F(I.bottom-C,x):I.top<re&&F(I.top-re,x))},R=d=>{const x=Ve();if(cn()){ee();return}if(Math.max(0,d.bodyBottom-x)===0){ee();return}const I=Math.max(0,d.bodyBottom-(x-o));i.style.setProperty(_e,`${I}px`)},w=d=>{if(!A.current)return;const x=gt(d.relatedTarget,i);if(x){x!==document.activeElement&&x.focus({preventScroll:!0});return}const S=gt(d.target,i);M.current&&S&&!d.relatedTarget&&b?.focus({preventScroll:!0})},te=()=>{const d=document.activeElement;if(!A.current||!(d instanceof HTMLElement)||!i.contains(d)||!Ke(d)){if(B.current&&P){R(P);return}ee();return}B.current=!1;const x=i.getBoundingClientRect(),S=Ve(),I=Math.max(0,x.bottom-S),q=I>0?o:0;P=I>0?{bodyBottom:x.bottom}:null,h&&I>0&&!E.current&&(D={x:window.scrollX,y:window.scrollY}),E.current=I>0;const me=I>0?Math.max(0,x.bottom-(S-q)):0;i.style.setProperty(_e,`${me}px`),Q(d,I>0)};let H=0;const k=()=>{cancelAnimationFrame(H),H=requestAnimationFrame(te)},X=()=>{const d=D;if(d==null||window.scrollX===d.x&&window.scrollY===d.y)return;window.scrollTo(d.x,d.y);const x=document.activeElement;x instanceof HTMLElement&&i.contains(x)&&Ke(x)&&Q(x,!1)},y=typeof ResizeObserver>"u"?null:new ResizeObserver(k),$=()=>{if(!y)return;y.disconnect();const d=new Set([i]);b&&d.add(b);for(const S of i.children)d.add(S);const x=document.activeElement;if(x instanceof HTMLElement&&i.contains(x))for(let S=x;S&&S!==i;S=S.parentElement)d.add(S);for(const S of d)y.observe(S)},G=typeof MutationObserver>"u"?null:new MutationObserver(d=>{d.every(x=>x.type==="attributes"&&x.target===i)||($(),k())}),U=()=>{$(),k()},Y=()=>{B.current=E.current,k()},_=d=>{d.target===b&&d.propertyName==="transform"&&k()},ne=window.visualViewport;return N&&document.addEventListener("blur",w,!0),i.addEventListener("focusin",U),i.addEventListener("focusout",Y),b?.addEventListener("transitionend",_),ne?.addEventListener("resize",k),ne?.addEventListener("scroll",k),window.addEventListener("scroll",X),window.addEventListener("resize",k),G?.observe(i,{attributes:!0,characterData:!0,childList:!0,subtree:!0}),$(),k(),()=>{cancelAnimationFrame(H),N&&document.removeEventListener("blur",w,!0),i.removeEventListener("focusin",U),i.removeEventListener("focusout",Y),b?.removeEventListener("transitionend",_),ne?.removeEventListener("resize",k),ne?.removeEventListener("scroll",k),window.removeEventListener("scroll",X),window.removeEventListener("resize",k),y?.disconnect(),G?.disconnect(),i.style.removeProperty(_e),E.current=!1,B.current=!1}},[e,o,s,h,u,j])}const pt=.998,un=pt/(1-pt),fn=48,Qe=100,Fe=.4,yt=40;function Ze(e){return e.syntheticTouch===!0}const dn=.35,xn=4,et=8;function hn(){typeof navigator>"u"||typeof navigator.vibrate!="function"||Rt()||navigator.vibrate(8)}function mn(e,o){let s=o[0],c=Math.abs(e-s);for(const f of o){const u=Math.abs(e-f);u<c&&(c=u,s=f)}if(c>=yt)return e;const h=c/yt,p=1-h*h;return e+(s-e)*p}function tt(e,o,s){return Math.max(0,e-o-s)}function Tt(e){const o=Number.parseFloat(getComputedStyle(e).paddingBlockEnd);return Number.isFinite(o)?o:0}function bt(e){if(!e)return 0;const o=Tt(e);return Math.max(0,e.scrollHeight-e.clientHeight-o)-e.scrollTop}function gn(e){if(e.scrollHeight-e.clientHeight<=1)return!1;const{overflowY:o}=getComputedStyle(e);return o==="auto"||o==="scroll"}function kt(e,o){const s=[];for(let c=e instanceof Element?e:null;c!=null&&c!==o;c=c.parentElement)c instanceof HTMLElement&&gn(c)&&s.push(c);return s.push(o),s}function pn(e){return e.scrollTop<=0}function yn(e){return e.scrollTop+e.clientHeight>=e.scrollHeight-1}function $e(e){return e.every(pn)}function nt(e){return e.every(yn)}function Le(e,o,s){return Math.max(0,e-s-o)}function Rt(){return typeof window>"u"||!window.matchMedia?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}function bn({isOpen:e,canDismiss:o=!0,offscreenBlockEndInset:s=0,onDismiss:c,snapHeights:h,onSnap:p,onScrimOpacity:f}){const[u,j]=n.useState(0),[E,B]=n.useState(0),[A,M]=n.useState(!1),[i,b]=n.useState(!1),[P,D]=n.useState(0),[N,ee]=n.useState(0),[F,Q]=n.useState(0),R=n.useRef(0),w=n.useRef(0),[te,H]=n.useState(null),[k,X]=n.useState(!1),y=n.useRef(0),$=n.useRef(null),G=n.useRef(null),U=n.useRef(s);U.current=Math.max(0,s);const Y=n.useCallback(t=>{const r=Math.max(0,t);R.current=r,Q(r)},[]),_=n.useCallback(t=>{const r=Math.max(0,t);Math.abs(r-y.current)>.5&&(y.current=r,ee(r))},[]),ne=n.useCallback(()=>{X(!0),$.current=null,H(null);const t=G.current;G.current=null,t!=null&&_(t)},[_]),d=n.useCallback((t,r,m,T,g,L,a)=>{const v=tt(t,m,L);if(a&&Math.abs(T-r)>.5&&!Rt()){G.current=v,$.current=g,H(g);return}G.current=null,$.current=null,H(null),X(Math.abs(g-m)>.5),_(v)},[_]),x=n.useRef(0);A||(x.current=E);const S=n.useRef(e);S.current=e;const I=n.useRef(h);I.current=h;const q=n.useRef(c),me=n.useRef(o),se=n.useRef(p),re=n.useRef(f);n.useEffect(()=>{q.current=c,me.current=o,se.current=p,re.current=f});const C=n.useRef(null),ge=n.useRef(0),pe=n.useRef(null),ye=n.useRef(null),be=n.useRef(null);n.useLayoutEffect(()=>{if(!k)return;pe.current?.offsetHeight;const t=requestAnimationFrame(()=>{X(!1)});return()=>cancelAnimationFrame(t)},[k]);const le=n.useCallback(t=>{t<=0||!S.current||x.current>0||(ge.current=t,D(r=>r===t?r:t))},[]),Ge=n.useCallback(t=>{if(be.current?.disconnect(),be.current=null,pe.current=t,!t||typeof ResizeObserver>"u"){t&&le(t.getBoundingClientRect().height);return}le(t.getBoundingClientRect().height);const r=new ResizeObserver(m=>{const T=m[0];if(T){const g=T.borderBoxSize?.[0]?.blockSize;le(g??T.target.getBoundingClientRect().height)}});r.observe(t),be.current=r},[le]);n.useEffect(()=>()=>be.current?.disconnect(),[]),n.useEffect(()=>{e&&(j(0),B(0),M(!1),b(!1),X(!1),Y(0),w.current=0,y.current=0,$.current=null,G.current=null,ee(0),H(null))},[e,Y]);const ue=n.useCallback(()=>ge.current>0?ge.current:pe.current?.getBoundingClientRect().height??0,[]),oe=n.useCallback(t=>{const r=Le(t,0,U.current),m=en(r,I.current?.()??[]);return{offsets:m,peekOffset:rn(m,r)}},[]),Re=n.useCallback(()=>{const t=pe.current;if(!t)return ge.current;const r=t.style.height;if(r==="")return t.getBoundingClientRect().height;t.style.height="";const m=t.getBoundingClientRect().height;return t.style.height=r,m},[]),ce=n.useCallback(()=>{if(!S.current||C.current!=null||$.current!=null)return;const t=Re();if(t<=0)return;const{offsets:r,peekOffset:m}=oe(t),T=Math.min(w.current,r.length-1),g=r[T],L=g===m?0:g,a=R.current;if(t===ge.current&&Math.abs(g-x.current)<=.5&&Math.abs(L-a)<=.5)return;ge.current=t,D(t),w.current=T,d(a,g,L,g,a,bt(ye.current),!1),Y(L),B(g),se.current?.(Le(t,g,U.current));const v=r[r.length-1],l=Le(t,v,U.current);re.current?.(Ye(g,r,v+l*Fe,m))},[Re,d,Y,oe]);n.useEffect(()=>{if(!(!e||typeof window>"u"))return window.addEventListener("resize",ce),window.addEventListener("orientationchange",ce),()=>{window.removeEventListener("resize",ce),window.removeEventListener("orientationchange",ce)}},[e,ce]);const Be=n.useRef(!1);n.useLayoutEffect(()=>{if(!Be.current){Be.current=!0;return}ce()},[ce,h]);const qe=n.useCallback((t,r)=>{const m=pe.current;if(m==null)return;const T=t-r;m.style.transform=T!==0?`translateY(${T}px)`:""},[]),J=n.useCallback(t=>{const r=C.current;if(r==null)return;C.current=null,t?.hasPointerCapture?.(r.pointerId)&&t.releasePointerCapture(r.pointerId),j(r.baseOffset),M(!1),b(!1),d(r.baseLayoutOffset,r.baseOffset,r.baseLayoutOffset,r.renderedOffset,r.layoutOffset,r.naturalEndGap,!0);const{offsets:m,peekOffset:T}=oe(r.height),g=m[m.length-1],L=Le(r.height,g,U.current),a=g+L*Fe;re.current?.(Ye(r.baseOffset,m,a,T))},[d,oe]);n.useEffect(()=>{const t=()=>J(),r=()=>{document.visibilityState==="hidden"&&J()};return window.addEventListener("blur",t),document.addEventListener("visibilitychange",r),()=>{window.removeEventListener("blur",t),document.removeEventListener("visibilitychange",r)}},[J]);const He=n.useCallback((t,r,m,T,g,L,a,v,l,z)=>{const{offsets:W,peekOffset:xe}=oe(m),Se=W[W.length-1],ae=Le(m,Se,U.current),Oe=Se+ae*Fe,De=g>fn?t+r*un:t,xt=Te=>{const ht=Te===xe?0:Te;d(a,Te,ht,v,l,z,!0),Y(ht),w.current=Math.max(0,W.indexOf(Te)),B(Te),se.current?.(Le(m,Te,U.current)),re.current?.(Ye(Te,W,Oe,xe)),Te!==L&&hn()};if(T>0&&De>Oe){me.current?(d(a,L,a,a,a,z,!1),q.current()):xt(Se);return}const zt=on(Math.min(Math.max(De,0),Se),W,T,L);xt(zt)},[d,Y,oe]),O=n.useCallback((t,r,m)=>{const T=t.currentTarget,g=Ze(t);g||T.setPointerCapture?.(t.pointerId);const L=m??t.clientY,a=bt(ye.current),v=R.current;C.current={syntheticTouch:g,pointerId:t.pointerId,startCoord:L,lastCoord:t.clientY,lastTime:t.timeStamp,samples:[{t:t.timeStamp,y:t.clientY}],velocity:0,height:r,baseOffset:E,baseLayoutOffset:v,renderedOffset:E,layoutOffset:v,naturalEndGap:a,hasTraveled:!1},_(tt(v,v,a)),j(E),M(!0)},[E,_]),ke=n.useCallback(t=>{t.button!==0||!t.isPrimary||(t.preventDefault(),O(t,ue()))},[O,ue]),Z=n.useCallback(t=>{C.current!=null&&(t.preventDefault(),J(t.currentTarget))},[J]),fe=n.useCallback(t=>{C.current?.syntheticTouch||C.current?.pointerId===t.pointerId&&J()},[J]),ve=n.useCallback(t=>{const r=C.current;if(!r||r.pointerId!==t.pointerId||r.syntheticTouch&&!Ze(t))return;const m=t.clientY-r.startCoord;if(t.timeStamp-r.lastTime>0){for(r.lastCoord=t.clientY,r.lastTime=t.timeStamp,r.samples.push({t:t.timeStamp,y:t.clientY});r.samples.length>2&&t.timeStamp-r.samples[0].t>Qe;)r.samples.shift();const Oe=r.samples[0],De=Math.min(t.timeStamp-Oe.t,Qe);r.velocity=De>0?(t.clientY-Oe.y)/De:0}const{offsets:g,peekOffset:L}=oe(r.height),a=r.baseOffset+m,v=g[g.length-1];let l;a<0?l=Math.max(-48,a*dn):a>v?l=a:l=mn(a,g);const z=l<r.baseOffset?0:r.baseLayoutOffset,W=z!==r.layoutOffset;r.renderedOffset=l,r.layoutOffset=z,x.current=l,qe(l,z),W&&j(l),!r.hasTraveled&&l!==r.baseOffset&&(r.hasTraveled=!0,b(!0)),_(tt(r.baseLayoutOffset,z,r.naturalEndGap));const xe=g[g.length-1],Se=Le(r.height,xe,U.current),ae=xe+Se*Fe;re.current?.(Ye(l,g,ae,L))},[oe,_,qe]),Ee=n.useCallback(t=>{const r=C.current;if(!r||r.pointerId!==t.pointerId||r.syntheticTouch&&!Ze(t))return;const m=t.currentTarget,T=t.clientY-r.startCoord,g=Math.max(0,r.baseOffset+T),L=T===0?0:T>0?1:-1,a=t.timeStamp-r.lastTime<Qe?r.velocity:0;C.current=null,r.syntheticTouch||m.releasePointerCapture?.(t.pointerId),M(!1),b(!1),He(g,a,r.height||1,L,Math.abs(T),r.baseOffset,r.baseLayoutOffset,r.renderedOffset,r.layoutOffset,r.naturalEndGap)},[He]),de=n.useRef(null),Ce=n.useCallback(t=>{if(t.button!==0||!t.isPrimary)return;const r=kt(t.target,t.currentTarget);if(!$e(r)){de.current=null;return}de.current={pointerId:t.pointerId,startCoord:t.clientY,scrollers:r}},[]),ze=n.useCallback(t=>{if(C.current){ve(t);return}const r=de.current;if(!r||r.pointerId!==t.pointerId)return;const m=t.clientY-r.startCoord;m>et&&$e(r.scrollers)?(de.current=null,O(t,ue(),r.startCoord),ve(t)):m<0&&(de.current=null)},[O,ve,ue]),Ae=n.useCallback(t=>{de.current=null,!C.current?.syntheticTouch&&C.current&&Ee(t)},[Ee]),we=n.useRef(null),Me=n.useRef(null),ie=n.useCallback(t=>{we.current=null,de.current=null,J(t)},[J]),V=n.useRef(O),Ie=n.useRef(J),je=n.useRef(ie),Pe=n.useRef(ve),st=n.useRef(Ee),Ue=n.useRef(ue);n.useEffect(()=>{V.current=O,Ie.current=J,je.current=ie,Pe.current=ve,st.current=Ee,Ue.current=ue});const ct=n.useCallback(t=>{const r=(a,v)=>({syntheticTouch:!0,pointerId:a.identifier,clientY:a.clientY,timeStamp:Date.now(),currentTarget:v,setPointerCapture:()=>{},releasePointerCapture:()=>{}}),m=a=>{const v=a.currentTarget;if(a.touches.length>1){je.current(v);return}const l=a.changedTouches[0];if(!l){we.current=null;return}const z=kt(a.target,v),W=$e(z),xe=nt(z)&&x.current>0;we.current={id:l.identifier,startY:l.clientY,scrollers:z,top:W,bottom:xe,contentEndY:null,promotedAtContentEnd:!1}},T=a=>{const v=a.currentTarget;if(a.touches.length>1){je.current(v);return}const l=we.current;if(C.current){const ae=[...a.changedTouches].find(Oe=>Oe.identifier===C.current?.pointerId);if(!ae)return;if(l?.promotedAtContentEnd&&l.contentEndY!=null){if(ae.clientY>=l.contentEndY){l.contentEndY=null,l.promotedAtContentEnd=!1,Ie.current(v);return}Pe.current(r(ae,v));return}a.preventDefault(),Pe.current(r(ae,v));return}if(!l)return;const z=[...a.changedTouches].find(ae=>ae.identifier===l.id);if(!z)return;const W=z.clientY-l.startY,xe=l.top&&W>et&&$e(l.scrollers),Se=l.bottom&&W<-et&&nt(l.scrollers);if(xe||Se){a.preventDefault(),we.current=null,V.current(r(z,v),Ue.current(),l.startY),Pe.current(r(z,v));return}(l.top&&W<0||l.bottom&&W>0)&&(l.top=!1,l.bottom=!1),x.current>0&&nt(l.scrollers)?l.contentEndY==null?l.contentEndY=z.clientY:l.contentEndY-z.clientY>=xn&&(l.promotedAtContentEnd=!0,V.current(r(z,v),Ue.current(),l.contentEndY),Pe.current(r(z,v))):l.contentEndY=null},g=a=>{we.current=null;const v=C.current?.pointerId;if(v==null)return;const l=[...a.changedTouches].find(W=>W.identifier===v),z=a.currentTarget;l?st.current(r(l,z)):a.touches.length===0&&Ie.current(z)},L=ye.current;if(L&&Me.current){const a=Me.current;L.removeEventListener("touchstart",a.start),L.removeEventListener("touchmove",a.move),L.removeEventListener("touchend",a.end),L.removeEventListener("touchcancel",a.end)}ye.current=t,t?(t.addEventListener("touchstart",m,{passive:!0}),t.addEventListener("touchmove",T,{passive:!1}),t.addEventListener("touchend",g,{passive:!0}),t.addEventListener("touchcancel",g,{passive:!0}),Me.current={start:m,move:T,end:g}):Me.current=null},[]),it=Mt("(prefers-reduced-motion: reduce)"),at=n.useCallback(t=>{if(y.current<=0)return;const r=Tt(t),m=Math.max(0,t.scrollHeight-t.clientHeight-r),T=Math.max(0,t.scrollTop-m);T<y.current-.5&&_(T)},[_]),lt=n.useCallback(t=>{C.current!=null||$.current!=null||at(t.currentTarget)},[at]),ut=n.useCallback(t=>{if(!t.isPrimary){ie(t.currentTarget);return}ke(t)},[ke,ie]),ft=n.useCallback(t=>{if(!t.isPrimary){ie(t.currentTarget);return}Ce(t)},[Ce,ie]),We=n.useCallback(t=>{t.touches.length>1&&ie(t.currentTarget)},[ie]),dt=n.useCallback(t=>{const r=C.current;r?.pointerId!==t.pointerId||r.syntheticTouch||J(t.currentTarget)},[J]),Xe=A?u:E,Pt=n.useMemo(()=>({style:{transform:Xe!==0?`translateY(${Xe}px)`:void 0,transition:e&&(A||k||it)?"none":void 0,touchAction:"pinch-zoom",overscrollBehavior:"contain"}}),[Xe,A,e,k,it]),Ot=n.useMemo(()=>({style:{touchAction:"pinch-zoom",cursor:"grab"},onContextMenu:Z,onLostPointerCapture:fe,onPointerDown:ut,onPointerMove:ve,onPointerUp:Ee,onPointerCancel:dt,onTouchStart:We,onTouchMove:We}),[Ee,Z,dt,ut,We,fe,ve]),Lt=n.useMemo(()=>({ref:ct,onContextMenu:Z,onLostPointerCapture:fe,onPointerDown:ft,onPointerMove:ze,onPointerUp:Ae,onPointerCancel:Ae,onScroll:lt}),[ct,Ae,ft,ze,lt,Z,fe]);return{sheetRef:Ge,contentProps:Pt,handleProps:Ot,bodyProps:Lt,bodyElementRef:ye,dragOffset:u,settledOffset:E,isDragging:A,isTraveling:i,activeOffsetRef:x,sheetHeight:P,scrollPreservationInset:N,settlingLayoutOffset:te,settledLayoutOffset:F,completeScrollAreaSettle:ne}}const vt={hug:"92dvh",capped:"62dvh",tall:"92dvh"},kn=48,vn=48,En=50;function wn(){return typeof window>"u"?0:window.innerHeight}function Sn(e){let o="";for(const s of e??[])o+=`${typeof s}:${s}|`;return o}const he={sheet:{kfzvcC:"x67bb7w",kB7OPa:"x9f619",kVAEAm:"x1n2onr6",k1xSpc:"x78zum5",kXwgrk:"xdt5ytf",kAzted:"x2lwn1j",kzqmXN:"xh8yej3",ks0D6T:"x11gisft",kWkggS:"x10xzikg",kEafiO:"x11xkdxz",kPef9Z:"x13fuv20",kLZC3w:"x1pc3f07",k2ei4v:"xgbv0en",kVhnKS:"x1t7ytsu",kGJrpR:"x1j92z86",ke9TFa:"xw8tdv1",k8ry5P:"x18b5jzi",kBCPoo:"x1gejf6u",krdFHd:"x81l70g",kfmiAY:"x7hs6f1",kGVxlE:"x1kcpxr7",kI3sdo:"x1a2a7pz",kVQacm:"xb3r6kr",kGO01o:"x1wkw6tp",k1K539:"x1if0o47",k3aq6I:"xnn1q72 xhbqy3z",kSiTet:"x1hc1fzr",k1ekBW:"xwcsmn1",kIyJzY:"x80gvsz",kAMwcw:"xlr8y92",k6sLGO:"x1q1rmc8",k6CgDc:"xzg1mie",$$css:!0},sheetClosing:{k3aq6I:"x1weeur4",kAMwcw:"xv2sgk5",$$css:!0},sheetFading:{kSiTet:"xg01cxk",$$css:!0},sheetInactive:{kfzvcC:"x47corl",$$css:!0},body:{kzQI83:"x1iyjqo2",kAzted:"x2lwn1j",kB7OPa:"x9f619",kFalU9:"xge0x1e",kInvED:"x1wfwxd8 x1nw7mhf",kWkggS:"x10xzikg",kGO01o:"x18d9i69",$$css:!0},content:{k1xSpc:"xufnvkl",kB7OPa:"x9f619",kZKoxP:"x5yr21d",kAzted:"x121v3j4",$$css:!0},tallKeyboardBody:{kFlMNQ:"xrw9175",k5JduY:"x1s928wv",kc3QkE:"xhkezso",k4zj60:"xu6fald",kloYau:"x2q1x1w",$$css:!0},budget:{kZKoxP:"x1tpcejd",$$css:!0},hugHeight:{kZKoxP:"xg7h5cd",kskxy:"x14bu9tk",$$css:!0}};function Tn(e){return e.kind==="open"?e.entering?"entering":null:e.kind==="retained"?e.motion==="covered"?null:e.motion:e.kind==="exiting"?"exiting":null}function Et(e,o,s){if(e==null)return s(),()=>{};let c=!1,h=null;const p=()=>{c||(c=!0,h!=null&&clearTimeout(h),e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f),s())},f=i=>{i.target===e&&i.propertyName===o&&p()};e.addEventListener("transitionend",f),e.addEventListener("transitioncancel",f);const u=getComputedStyle(e);if(e.style.transition.trim()==="none"||u.transition.trim()==="none")return p(),()=>{};const j=u.transitionProperty.split(",").map(i=>i.trim()),E=u.transitionDuration.split(",").map(wt),B=u.transitionDelay.split(",").map(wt);let A=!1;const M=j.reduce((i,b,P)=>{if(b!==o&&b!=="all")return i;const D=E[P%E.length],N=B[P%B.length];return D==null||N==null?(A=!0,i):Math.max(i,D+N)},0);return A?()=>{e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f)}:M<=0?(p(),()=>{}):(h=setTimeout(p,M+En),()=>{h!=null&&clearTimeout(h),e.removeEventListener("transitionend",f),e.removeEventListener("transitioncancel",f)})}function wt(e){const o=e.trim();if(!/^-?(?:\d+|\d*\.\d+)(?:ms|s)$/.test(o))return null;const s=Number.parseFloat(e);return o.endsWith("ms")?s:s*1e3}function rt({ref:e,state:o,height:s,label:c,children:h,padding:p,snapPoints:f,className:u,style:j,tabIndex:E,xstyle:B,isSwipeDismissAllowed:A=!0,isPageScrollLocked:M=!1,onDismiss:i,onScrimOpacity:b,onElementChange:P,onMotionStart:D,onMotionComplete:N,...ee}){const F=n.useRef(null),Q=n.useRef(o),R=n.useRef(!1),w=n.useRef(D),te=n.useRef(N),H=n.useRef(null),k=n.useRef(null),X=o.kind==="open"&&o.entering,y=Q.current,$=y.kind==="open"&&y.entering;X&&!$?R.current=y.kind==="retained":X||(R.current=!1),n.useLayoutEffect(()=>{Q.current=o,w.current=D,te.current=N},[N,D,o]);const G=o.kind==="open",U=o.kind!=="hidden",Y=o.kind==="retained",_=Y||o.kind==="exiting",ne=o.kind==="exiting",d=Y&&o.motion==="fading",x=Y?o.alignmentOffset:0,S=Sn(f),I=n.useRef(f);I.current=f;const{snapHeights:q,ignoredSnapPointsMessage:me}=n.useMemo(()=>{if(S==="")return{snapHeights:void 0,ignoredSnapPointsMessage:""};const V=(I.current??[]).filter(Ie=>!Qt(Ie));return{snapHeights:()=>Zt(I.current??[],wn()),ignoredSnapPointsMessage:V.length===0?"":`snapPoints ignored ${JSON.stringify(V)}. A snap point is a viewport fraction above 0 and up to 1 (0.5 is half the screen), a px length ('320px'), or a percentage ('50%').`}},[S]);Ne("BottomSheet",me,me!=="");const{contentProps:se,handleProps:re,bodyProps:C,bodyElementRef:ge,sheetRef:pe,dragOffset:ye,settledOffset:be,isDragging:le,isTraveling:Ge,sheetHeight:ue,scrollPreservationInset:oe,settlingLayoutOffset:Re,settledLayoutOffset:ce,completeScrollAreaSettle:Be}=bn({isOpen:G,canDismiss:A,offscreenBlockEndInset:kn,onDismiss:i,snapHeights:q,onScrimOpacity:b}),{getViewportProps:qe,getContentProps:J}=It({axis:"both",keyboardAccess:{owner:"contentOrViewport",label:c},overscroll:"contain",stickyContainment:"always"}),He=n.useCallback(V=>{pe(V),F.current=V,P?.(V)},[P,pe]);ln({bodyRef:ge,bottomClearance:vn,isEnabled:s==="tall",isFullyExpanded:be===0,isPageScrollLocked:M,isSheetTraveling:Ge,isOpen:G,isPresented:U,sheetRef:F}),n.useImperativeHandle(e,()=>F.current,[]);const O=Tn(o);n.useLayoutEffect(()=>{if(O!=null){if(H.current=null,k.current=null,O==="entering"&&R.current){k.current=O;return}return Et(F.current,O==="fading"?"opacity":"transform",()=>{H.current===O?te.current?.(O):k.current=O})}},[O]),n.useLayoutEffect(()=>{if(Re!=null)return Et(F.current,"transform",Be)},[Be,Re]),n.useEffect(()=>{if(O!=null)return w.current?.(O),H.current=O,k.current===O&&(k.current=null,te.current?.(O)),()=>{H.current===O&&(H.current=null),k.current===O&&(k.current=null)}},[O]);const ke=p==null,Z=p??4,fe=Vt[Z],Ee=typeof s=="string"&&s in vt?vt[s]:typeof s=="number"?`${s}px`:s,de=ue>0;let Ce=se.style.transform,ze;if(de){const V=le?ye<be?0:ce:Re??ce,je=(le?ye:be)-V,Pe=le||Re!=null;ze=V>0||Pe?`${Math.max(0,ue-Math.max(0,V))}px`:void 0,Ce=je!==0?`translateY(${je}px)`:void 0}const Ae=x>0?[Ce,`translateY(${x}px)`].filter(Boolean).join(" "):Ce,we=G?Ce:Y?Ae:void 0,Me=j?.transform;n.useLayoutEffect(()=>{if(le||Me!=null)return;const V=F.current;V!=null&&(V.style.transform=we??"")});const ie={transition:se.style.transition,touchAction:se.style.touchAction,overscrollBehavior:se.style.overscrollBehavior,height:ze};return K.jsxs("div",{...ee,ref:He,tabIndex:E??-1,...mt($t("bottom-sheet"),Je(Ft.reset,_t.reset,he.sheet,Yt.reset,s==="hug"?he.hugHeight:he.budget,ne&&he.sheetClosing,d&&he.sheetFading,_&&he.sheetInactive,B),u,{"--_sheet-budget":Ee,...G?ie:Y||ne?{height:ze}:{},...j}),children:[K.jsx("div",{className:"x10l6tqk x13vifvy x1o0tod xtijo5x x1vjfegm x78zum5 x6s0dn4 xl56j7k xvpftlf xafqdz2 x1j4r261 x1jm3nie x16khyan",...re,"aria-hidden":"true",children:K.jsx("div",{className:"x1m747yf x11c6zpc xjspbzw x1m4xfpy"})}),K.jsx("div",{...qe({...C,...mt(Je(Ht.focusVisible,he.body,s==="tall"&&he.tallKeyboardBody),oe>0?{style:{paddingBlockEnd:`${oe}px`}}:{})}),children:K.jsx("div",{...J(Je(he.content,...Bt(ke?{useThemeDefault:"bottom-sheet"}:{paddingInnerX:fe,paddingInnerY:fe,paddingOuterX:fe,paddingOuterY:fe}),!ke&&Z!==4&&At[Z],!ke&&Z!==4&&Dt[Z],!ke&&Z!==4&&Nt[Z],!ke&&Z!==4&&qt[Z])),children:K.jsx(jt,{children:h})})})]})}rt.displayName="BottomSheetPanel";function Rn(){return K.jsx("div",{className:"xixxii4 x17y0mx6 x1ey2m1c x1kpxq89 x10xzikg xhtitgo x47corl x1cb67k9 xt2iwb0","data-sheet-edge-tint":"","aria-hidden":"true"})}const ot=n.createContext(null);ot.displayName="BottomSheetSwitcherContext";function Cn(e,o){switch(e){case"active":return{kind:"open",entering:!1};case"entering":return{kind:"open",entering:!0};case"covered":case"aligning":case"fading":return{kind:"retained",motion:e,alignmentOffset:o};case"exiting":return{kind:"exiting"};case"hidden":return{kind:"hidden"}}}function Ct(e,o){const s=document.activeElement;if(s!=null&&e?.contains(s))return;const c=e?.querySelector("[data-autofocus]");c!=null?c.focus({preventScroll:!0}):o&&e?.focus({preventScroll:!0})}function Pn({ref:e,isOpen:o,onOpenChange:s,label:c,children:h,height:p="capped",snapPoints:f,hasScrim:u=!0,finalFocusRef:j,purpose:E="info",xstyle:B,...A}){const M=n.useRef(null),i=n.useRef(null),b=n.useRef(null),[P,D]=n.useState(o),N=o||P,ee=o?{kind:"open",entering:!1}:P?{kind:"exiting"}:{kind:"hidden"},F=n.useCallback(()=>{o&&E!=="required"&&s(!1)},[o,s,E]),Q=n.useCallback(()=>{E==="info"&&s(!1)},[s,E]),R=n.useCallback(y=>{i.current=y},[]),w=n.useCallback(y=>{M.current?.style.setProperty("--_sheet-scrim-opacity",String(y))},[]);n.useEffect(()=>{const y=M.current;if(y==null||!o)return;D(!0),y.style.setProperty("--_sheet-scrim-opacity","1"),y.open||(u?(b.current=document.activeElement,y.showModal()):y.show(),Ct(i.current,u))},[u,o]),n.useEffect(()=>{!o&&P&&u&&w(0)},[w,u,o,P]);const te=n.useCallback(y=>{if(y!=="exiting"||o)return;const $=M.current;$?.open&&$.close(),D(!1),(j?.current??b.current)?.focus(),b.current=null},[j,o]);Kt(N&&u),Ne("BottomSheet","requires a non-empty `label` for an accessible name; the open sheet has no built-in heading to derive one from.",o&&!c);const{shouldDismissOnCloseRequest:H}=Gt({isActive:N,escapeBehavior:o&&E!=="required"?"close":"block",onDismiss:F,getContainer:()=>M.current,isPresent:()=>M.current?.open??!1}),k=n.useCallback(y=>{y.preventDefault(),H()&&F()},[F,H]),X=n.useCallback(y=>{u&&y.target===y.currentTarget&&Q()},[Q,u]);return K.jsxs("dialog",{...{0:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz"},8:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq"},4:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w"},12:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w"},2:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x"},10:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x"},6:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x"},14:{className:"xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x"},1:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x47corl xfo81ep xh8yej3 x5yr21d"},9:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x47corl xfo81ep xh8yej3 x5yr21d"},5:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w x47corl xfo81ep xh8yej3 x5yr21d"},13:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x15h3t91 x142juwg x1viac0w x47corl xfo81ep xh8yej3 x5yr21d"},3:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},11:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},7:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"},15:{className:"xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a xft5bk6 x142juwg x1viac0w x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"}}[!!N<<3|!!u<<2|!!(u&&!o&&P)<<1|!u<<0],ref:M,"aria-label":c,"aria-hidden":!o&&P?"true":void 0,"aria-modal":u&&o?"true":void 0,role:E==="required"?"alertdialog":void 0,inert:!o&&P?!0:void 0,onCancel:k,onClick:X,children:[K.jsx("div",{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl",children:K.jsx(rt,{...A,ref:e,state:ee,height:p,label:c,snapPoints:f,isSwipeDismissAllowed:E==="info",isPageScrollLocked:N&&u,xstyle:B,onDismiss:Q,onScrimOpacity:w,onElementChange:R,onMotionComplete:te,children:K.jsx(Ut,{children:h})})}),K.jsx(Rn,{})]})}function On({switcher:e,ref:o,sheetId:s,label:c,children:h,height:p="capped",snapPoints:f,purpose:u="info",xstyle:j,...E}){const{activeSheet:B,hasScrim:A,onActiveSheetChange:M,getSheetPhase:i,getSheetAlignmentOffset:b,registerSheetElement:P,registerSheetLabel:D,registerSheetPurpose:N,onSheetEnterStart:ee,onSheetTransitionComplete:F,onSheetScrimOpacityChange:Q}=e,R=typeof s=="string"&&s.length>0,w=R?i(s):"hidden",te=R?b(s):0,H=Cn(w,te),k=w==="active"||w==="entering",X=w==="covered"||w==="aligning"||w==="fading"||w==="exiting",y=w!=="hidden",$=w==="active"||w==="entering",G=n.useRef(null),U=n.useRef(w),Y=U.current,_=n.useRef(!1);n.useLayoutEffect(()=>{U.current=w},[w]);const ne=n.useCallback(()=>{u==="info"&&R&&B===s&&M(null)},[B,R,M,u,s]),d=n.useCallback(q=>{G.current=q,R&&P(s,q)},[R,P,s]),x=n.useCallback(q=>{q==="entering"&&R&&ee(s)},[R,ee,s]),S=n.useCallback(q=>{R&&F({sheetId:s,phase:q})},[R,F,s]),I=n.useCallback(q=>{R&&Q(s,q)},[R,Q,s]);return n.useLayoutEffect(()=>{if(R)return D(s,c),()=>D(s,null)},[R,c,D,s]),n.useLayoutEffect(()=>{if(R)return N(s,u),()=>N(s,null)},[R,u,N,s]),n.useEffect(()=>{if(k){const q=Y==="active"||Y==="entering";(!_.current||!q)&&Ct(G.current,A),_.current=!0}else w==="hidden"&&(_.current=!1)},[A,k,w,Y]),Ne("BottomSheet","requires a non-empty `label` for an accessible name; the open sheet has no built-in heading to derive one from.",k&&!c),K.jsx("div",{...{0:{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl"},2:{className:"x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg"},1:{className:"x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl x1vjfegm"},3:{className:"x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg x1vjfegm"}}[!y<<1|!!$<<0],hidden:!y,"aria-hidden":X?"true":void 0,inert:X?!0:void 0,children:K.jsx(rt,{...E,ref:o,state:H,height:p,label:c,snapPoints:f,isSwipeDismissAllowed:u==="info",isPageScrollLocked:A,xstyle:j,onDismiss:ne,onScrimOpacity:I,onElementChange:d,onMotionStart:x,onMotionComplete:S,children:K.jsx(ot,{value:null,children:h})})})}function Ln(e){const o=n.use(ot),s=e.sheetId,c=typeof s=="string"&&s.length>0;return Ne("BottomSheet","requires a non-empty `sheetId` when nested in BottomSheetSwitcher; standalone `isOpen` / `onOpenChange` props are ignored there.",o!=null&&!c),Ne("BottomSheet","`sheetId` only works inside BottomSheetSwitcher. Use `isOpen` and `onOpenChange` for a standalone sheet.",o==null&&s!=null),o!=null?K.jsx(On,{...e,switcher:o}):K.jsx(Pn,{...e})}Ln.displayName="BottomSheet";export{Ln as BottomSheet};