@onside/install-widget 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,71 +1,183 @@
1
1
  # Onside Install Widget
2
2
 
3
- ## Install package (for partner landing pages)
3
+ ## Install Flow Contract (Target Behavior)
4
4
 
5
- ### From npm
5
+ This section defines the expected runtime behavior of the install package.
6
+ It is the source of truth for UX + analytics for partner integrations.
6
7
 
7
- Install the package and its peer dependencies:
8
+ ### Scenario Matrix
8
9
 
9
- ```bash
10
- pnpm add onside-install-widget react react-dom zustand
11
- ```
10
+ | Scenario | Condition | Button text | Modal | GTM event(s) | Action |
11
+ | --- | --- | --- | --- | --- | --- |
12
+ | Direct install | `canInstall === true` and `isEligible !== false` and install URL loaded | `Install Onside` | none | `install_button_click` with `event_type=install_click` (or `ios_18_6_plus`) | Redirect to install URL |
13
+ | Browser unsupported on iOS | `shouldGoToSafari === true` | `Install Onside` | `go_to_safari` instruction modal | `go_to_safari.opened` | Block redirect until user opens supported browser |
14
+ | iOS version unsupported | `shouldUpdateIOS === true` | `Install Onside` | `update_ios` instruction modal | `update_ios.opened` | Block redirect until iOS update |
15
+ | Android device | `isAndroid === true` | `Onside is for iPhone and iPad` | `is_android` info modal | `is_android.opened` | Block install |
16
+ | Region not eligible | `isEligible === false` | `Install Onside` + caption `Only available in the EU. Install from an eligible region.` | none | optional `install_button_click` with `event_type=not_eligible` | Allow install attempt (system flow may still permit install) |
17
+ | Install API error | install URL fetch failed after retries | `Install Onside` | none | optional `install_button_click` with `event_type=api_error` | Show inline error only; fallback modal/retry flow is not required for current release |
12
18
 
13
- **Note:** You do **not** need `QueryClientProvider` or `@tanstack/react-query`. The package uses Zustand for install URL state.
19
+ ### Notes
14
20
 
15
- ### From your CDN
21
+ - Required analytics context in GTM payload: `location`, `page`, `onside_token`, `attribution_token`, `platform`, `browser`.
22
+ - If a modal is shown, redirect must not happen in the same click action.
23
+ - `onside_token` cookie must be present before requesting install URL.
16
24
 
17
- Upload the contents of `dist-lib/` to your CDN with the version in the path, for example:
25
+ ## Delivery Modes
18
26
 
19
- - Base URL: `https://<your-cdn>/onside-install-widget/1.0.0/`
20
- - ESM bundle: `https://<your-cdn>/onside-install-widget/1.0.0/install-package.js`
21
- - CJS bundle: `https://<your-cdn>/onside-install-widget/1.0.0/install-package.cjs`
27
+ The button is delivered in two supported ways:
22
28
 
23
- When loading from CDN, partners must also provide React, React DOM and Zustand (e.g. via import map or their own bundle).
29
+ 1. React package (`@onside/install-widget`)
30
+ 2. CDN script (IIFE widget, no React required in host app)
24
31
 
25
- Example ESM in the browser with import map:
32
+ ### 1) React package
26
33
 
27
- ```html
28
- <script type="importmap">
29
- {
30
- "imports": {
31
- "onside-install-widget": "https://<your-cdn>/onside-install-widget/1.0.0/install-package.js",
32
- "react": "https://esm.sh/react@19",
33
- "react-dom": "https://esm.sh/react-dom@19",
34
- "react-dom/client": "https://esm.sh/react-dom@19/client",
35
- "zustand": "https://esm.sh/zustand@5"
36
- }
34
+ Install dependencies:
35
+
36
+ ```bash
37
+ pnpm add @onside/install-widget react react-dom
38
+ ```
39
+
40
+ Usage:
41
+
42
+ ```tsx
43
+ import { InstallAppButton, InstallWidgetProvider } from "@onside/install-widget";
44
+ import "@onside/install-widget/styles.css";
45
+
46
+ function App() {
47
+ return (
48
+ <InstallWidgetProvider>
49
+ <InstallAppButton />
50
+ </InstallWidgetProvider>
51
+ );
37
52
  }
38
- </script>
39
- <script type="module">
40
- import { InstallAppButton } from "onside-install-widget";
41
- // mount InstallAppButton in your app
42
- </script>
43
53
  ```
44
54
 
45
- ### Usage (npm or CDN)
55
+ Mount `InstallWidgetProvider` once per page. It hosts all install modals and supports multiple `InstallAppButton` instances.
56
+ For per-button attribution, set `id` and `location` on each button (`button_id` + `location` in analytics events).
57
+
58
+ Optional custom analytics callback:
46
59
 
47
60
  ```tsx
48
- import { InstallAppButton } from "onside-install-widget";
61
+ import { InstallAppButton, InstallWidgetProvider } from "@onside/install-widget";
62
+ import "@onside/install-widget/styles.css";
49
63
 
50
64
  function App() {
51
- return <InstallAppButton />;
65
+ return (
66
+ <InstallWidgetProvider>
67
+ <InstallAppButton
68
+ customAnalytics={{
69
+ onEvent: (event) => {
70
+ // full enriched event payload (event_name, event_properties, url, etc.)
71
+ console.log(event);
72
+ },
73
+ }}
74
+ />
75
+ </InstallWidgetProvider>
76
+ );
52
77
  }
53
78
  ```
54
79
 
55
- ---
80
+ Style customization:
81
+
82
+ ```tsx
83
+ <InstallAppButton
84
+ className="w-full"
85
+ captionClassName="opacity-80"
86
+ styleVars={
87
+ {
88
+ "--onside-btn-bg": "#111827",
89
+ "--onside-btn-bg-hover": "#1f2937",
90
+ "--onside-btn-text": "#ffffff",
91
+ "--onside-btn-radius": "16px",
92
+ "--onside-btn-px": "24px",
93
+ "--onside-btn-py": "14px",
94
+ "--onside-btn-font-size": "16px",
95
+ "--onside-caption-color": "rgba(17,24,39,0.7)",
96
+ "--onside-caption-size": "12px",
97
+ "--onside-caption-line-height": "16px",
98
+ }
99
+ }
100
+ />
101
+ ```
102
+
103
+ ### 2) CDN script (no React in host)
56
104
 
57
- ## Demo / widget (IIFE)
105
+ Build artifacts are produced in `dist/` (widget script) and loaded directly on the partner page.
106
+
107
+ Example:
58
108
 
59
109
  ```html
60
110
  <!DOCTYPE html>
61
111
  <html lang="en">
62
112
  <head>
63
- <meta charset="UTF-8">
64
- <title>Title</title>
113
+ <meta charset="UTF-8" />
114
+ <title>Onside Widget</title>
65
115
  </head>
66
116
  <body>
67
- <script src="http://localhost:4173/provider-widget.iife.js" data-selector=".install-button" data-css-href="http://localhost:4173/onside-install-widget.css"></script>
117
+ <div class="install-button"></div>
118
+ <script
119
+ src="https://<your-cdn>/provider-widget.iife.js"
120
+ data-selector=".install-button"
121
+ data-css-href="https://<your-cdn>/onside-install-widget.css"
122
+ ></script>
68
123
  </body>
69
124
  </html>
70
125
  ```
71
126
 
127
+ Required script attributes:
128
+
129
+ - `data-selector`: CSS selector of target container.
130
+ - `data-css-href`: URL to widget stylesheet.
131
+
132
+ ### CDN media manifest (images/video)
133
+
134
+ Media paths are resolved by `cdn("/path/to/file")` using a local manifest snapshot:
135
+
136
+ - source manifest URL: `https://cdn.onside.io/assets/onside-install-widget/manifest.json`
137
+ - generated file in repo: `src/generated/cdnManifest.ts`
138
+
139
+ Update the local snapshot before release:
140
+
141
+ ```bash
142
+ pnpm run sync:cdn-manifest
143
+ ```
144
+
145
+ ## Release Preflight
146
+
147
+ Run before publishing a new package version:
148
+
149
+ ```bash
150
+ pnpm run sync:cdn-manifest
151
+ pnpm run lint
152
+ pnpm run build:lib
153
+ ```
154
+
155
+ QA artifacts/checklists:
156
+
157
+ - `docs/checklists/install-flow-release-checklist.md`
158
+ - `docs/checklists/install-flow-qa-report-template.md`
159
+ - `docs/checklists/install-flow-qa-report-draft.md`
160
+
161
+ ## Release Flow (GitHub + npm)
162
+
163
+ 1. Add a changeset in feature PRs that affect package behavior:
164
+ - `pnpm changeset`
165
+ 2. Merge PRs into `main`.
166
+ 3. `Release` workflow opens/updates a release PR with version/changelog changes.
167
+ 4. Merge the release PR.
168
+ 5. `Release` workflow publishes the package to npm via OIDC trusted publishing (no npm token in GitHub secrets).
169
+
170
+ ## Troubleshooting
171
+
172
+ - If `sync:cdn-manifest` fails locally due to network restrictions, run the manual workflow:
173
+ - GitHub Actions -> `Sync CDN Manifest` -> `Run workflow`
174
+ - If manifest did not change, no PR is created by the workflow.
175
+
176
+ ### Packaging notes
177
+
178
+ - React package output is in `dist-lib/`:
179
+ - `install-package.js` (ESM)
180
+ - `install-package.cjs` (CJS)
181
+ - `install-package.d.ts` (types)
182
+ - Script widget output is in `dist/`:
183
+ - `provider-widget.iife.js`
@@ -0,0 +1,47 @@
1
+ import { jsx as e, jsxs as s } from "react/jsx-runtime";
2
+ import { useCallback as o } from "react";
3
+ import { t as d, B as c } from "./install-package-CyWo-B7v.js";
4
+ import { D as m } from "./Dialog-DXOEeh8t.js";
5
+ const x = ({
6
+ open: t,
7
+ onClose: l
8
+ }) => {
9
+ const n = "is_android", a = o(() => {
10
+ d(n, "click", "close"), l();
11
+ }, [l]), i = o(
12
+ (r) => {
13
+ r || a();
14
+ },
15
+ [a]
16
+ );
17
+ return /* @__PURE__ */ e(
18
+ m,
19
+ {
20
+ "aria-labelledby": n,
21
+ className: "outline-hidden",
22
+ isDisplayingMargins: !0,
23
+ open: t,
24
+ onOpenChange: i,
25
+ children: /* @__PURE__ */ s("div", { className: "flex h-full flex-col items-center justify-between text-center", children: [
26
+ /* @__PURE__ */ s("div", { className: "m-auto", children: [
27
+ /* @__PURE__ */ e("p", { className: "text-2xl font-bold", children: "Onside is for iPhone and iPad" }),
28
+ /* @__PURE__ */ e("p", { className: "mt-3 px-10 font-sans text-xs font-normal", children: "To install Onside, please use an iPhone or iPad." })
29
+ ] }),
30
+ /* @__PURE__ */ e(
31
+ c,
32
+ {
33
+ className: "mt-2 w-full",
34
+ onClick: a,
35
+ size: "lg",
36
+ type: "button",
37
+ variant: "secondary",
38
+ children: "Close"
39
+ }
40
+ )
41
+ ] })
42
+ }
43
+ );
44
+ };
45
+ export {
46
+ x as AndroidPlatformModal
47
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("react"),t=require("./install-package-q3ncGygt.cjs"),c=require("./Dialog-D53Br-Xy.cjs"),d=({open:i,onClose:l})=>{const n="is_android",a=s.useCallback(()=>{t.trackModalEvent(n,"click","close"),l()},[l]),o=s.useCallback(r=>{r||a()},[a]);return e.jsx(c.Dialog,{"aria-labelledby":n,className:"outline-hidden",isDisplayingMargins:!0,open:i,onOpenChange:o,children:e.jsxs("div",{className:"flex h-full flex-col items-center justify-between text-center",children:[e.jsxs("div",{className:"m-auto",children:[e.jsx("p",{className:"text-2xl font-bold",children:"Onside is for iPhone and iPad"}),e.jsx("p",{className:"mt-3 px-10 font-sans text-xs font-normal",children:"To install Onside, please use an iPhone or iPad."})]}),e.jsx(t.Button,{className:"mt-2 w-full",onClick:a,size:"lg",type:"button",variant:"secondary",children:"Close"})]})})};exports.AndroidPlatformModal=d;
@@ -0,0 +1,45 @@
1
+ "use strict";const m=require("react/jsx-runtime"),W=require("react"),Oe=require("react-dom"),ee=require("./install-package-q3ncGygt.cjs");function De(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const i=De(W),ct=De(Oe);function T(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e?.(o),n===!1||!o.defaultPrevented)return t?.(o)}}function me(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ae(...e){return t=>{let n=!1;const r=e.map(o=>{const a=me(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():me(e[o],null)}}}}function M(...e){return i.useCallback(Ae(...e),e)}function ut(e,t){const n=i.createContext(t),r=a=>{const{children:c,...s}=a,d=i.useMemo(()=>s,Object.values(s));return m.jsx(n.Provider,{value:d,children:c})};r.displayName=e+"Provider";function o(a){const c=i.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${a}\` must be used within \`${e}\``)}return[r,o]}function lt(e,t=[]){let n=[];function r(a,c){const s=i.createContext(c),d=n.length;n=[...n,c];const l=v=>{const{scope:p,children:h,...b}=v,u=p?.[e]?.[d]||s,g=i.useMemo(()=>b,Object.values(b));return m.jsx(u.Provider,{value:g,children:h})};l.displayName=a+"Provider";function f(v,p){const h=p?.[e]?.[d]||s,b=i.useContext(h);if(b)return b;if(c!==void 0)return c;throw new Error(`\`${v}\` must be used within \`${a}\``)}return[l,f]}const o=()=>{const a=n.map(c=>i.createContext(c));return function(s){const d=s?.[e]||a;return i.useMemo(()=>({[`__scope${e}`]:{...s,[e]:d}}),[s,d])}};return o.scopeName=e,[r,dt(o,...t)]}function dt(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(a){const c=r.reduce((s,{useScope:d,scopeName:l})=>{const v=d(a)[`__scope${l}`];return{...s,...v}},{});return i.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}var B=globalThis?.document?i.useLayoutEffect:()=>{},ft=i[" useId ".trim().toString()]||(()=>{}),vt=0;function te(e){const[t,n]=i.useState(ft());return B(()=>{n(r=>r??String(vt++))},[e]),e||(t?`radix-${t}`:"")}var mt=i[" useInsertionEffect ".trim().toString()]||B;function pt({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,c]=ht({defaultProp:t,onChange:n}),s=e!==void 0,d=s?e:o;{const f=i.useRef(e!==void 0);i.useEffect(()=>{const v=f.current;v!==s&&console.warn(`${r} is changing from ${v?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=s},[s,r])}const l=i.useCallback(f=>{if(s){const v=gt(f)?f(e):f;v!==e&&c.current?.(v)}else a(f)},[s,e,a,c]);return[d,l]}function ht({defaultProp:e,onChange:t}){const[n,r]=i.useState(e),o=i.useRef(n),a=i.useRef(t);return mt(()=>{a.current=t},[t]),i.useEffect(()=>{o.current!==n&&(a.current?.(n),o.current=n)},[n,o]),[n,r,a]}function gt(e){return typeof e=="function"}function Te(e){const t=yt(e),n=i.forwardRef((r,o)=>{const{children:a,...c}=r,s=i.Children.toArray(a),d=s.find(bt);if(d){const l=d.props.children,f=s.map(v=>v===d?i.Children.count(l)>1?i.Children.only(null):i.isValidElement(l)?l.props.children:null:v);return m.jsx(t,{...c,ref:o,children:i.isValidElement(l)?i.cloneElement(l,void 0,f):null})}return m.jsx(t,{...c,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}function yt(e){const t=i.forwardRef((n,r)=>{const{children:o,...a}=n;if(i.isValidElement(o)){const c=wt(o),s=Ct(a,o.props);return o.type!==i.Fragment&&(s.ref=r?Ae(r,c):c),i.cloneElement(o,s)}return i.Children.count(o)>1?i.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Et=Symbol("radix.slottable");function bt(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Et}function Ct(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...s)=>{const d=a(...s);return o(...s),d}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function wt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var St=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],D=St.reduce((e,t)=>{const n=Te(`Primitive.${t}`),r=i.forwardRef((o,a)=>{const{asChild:c,...s}=o,d=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),m.jsx(d,{...s,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function xt(e,t){e&&ct.flushSync(()=>e.dispatchEvent(t))}function U(e){const t=i.useRef(e);return i.useEffect(()=>{t.current=e}),i.useMemo(()=>(...n)=>t.current?.(...n),[])}function Rt(e,t=globalThis?.document){const n=U(e);i.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var Nt="DismissableLayer",ue="dismissableLayer.update",Pt="dismissableLayer.pointerDownOutside",Ot="dismissableLayer.focusOutside",pe,Ie=i.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Me=i.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:c,onDismiss:s,...d}=e,l=i.useContext(Ie),[f,v]=i.useState(null),p=f?.ownerDocument??globalThis?.document,[,h]=i.useState({}),b=M(t,E=>v(E)),u=Array.from(l.layers),[g]=[...l.layersWithOutsidePointerEventsDisabled].slice(-1),y=u.indexOf(g),C=f?u.indexOf(f):-1,w=l.layersWithOutsidePointerEventsDisabled.size>0,S=C>=y,x=Tt(E=>{const O=E.target,j=[...l.branches].some(J=>J.contains(O));!S||j||(o?.(E),c?.(E),E.defaultPrevented||s?.())},p),P=It(E=>{const O=E.target;[...l.branches].some(J=>J.contains(O))||(a?.(E),c?.(E),E.defaultPrevented||s?.())},p);return Rt(E=>{C===l.layers.size-1&&(r?.(E),!E.defaultPrevented&&s&&(E.preventDefault(),s()))},p),i.useEffect(()=>{if(f)return n&&(l.layersWithOutsidePointerEventsDisabled.size===0&&(pe=p.body.style.pointerEvents,p.body.style.pointerEvents="none"),l.layersWithOutsidePointerEventsDisabled.add(f)),l.layers.add(f),he(),()=>{n&&l.layersWithOutsidePointerEventsDisabled.size===1&&(p.body.style.pointerEvents=pe)}},[f,p,n,l]),i.useEffect(()=>()=>{f&&(l.layers.delete(f),l.layersWithOutsidePointerEventsDisabled.delete(f),he())},[f,l]),i.useEffect(()=>{const E=()=>h({});return document.addEventListener(ue,E),()=>document.removeEventListener(ue,E)},[]),m.jsx(D.div,{...d,ref:b,style:{pointerEvents:w?S?"auto":"none":void 0,...e.style},onFocusCapture:T(e.onFocusCapture,P.onFocusCapture),onBlurCapture:T(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:T(e.onPointerDownCapture,x.onPointerDownCapture)})});Me.displayName=Nt;var Dt="DismissableLayerBranch",At=i.forwardRef((e,t)=>{const n=i.useContext(Ie),r=i.useRef(null),o=M(t,r);return i.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),m.jsx(D.div,{...e,ref:o})});At.displayName=Dt;function Tt(e,t=globalThis?.document){const n=U(e),r=i.useRef(!1),o=i.useRef(()=>{});return i.useEffect(()=>{const a=s=>{if(s.target&&!r.current){let d=function(){ke(Pt,n,l,{discrete:!0})};const l={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=d,t.addEventListener("click",o.current,{once:!0})):d()}else t.removeEventListener("click",o.current);r.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function It(e,t=globalThis?.document){const n=U(e),r=i.useRef(!1);return i.useEffect(()=>{const o=a=>{a.target&&!r.current&&ke(Ot,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function he(){const e=new CustomEvent(ue);document.dispatchEvent(e)}function ke(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?xt(o,a):o.dispatchEvent(a)}var ne="focusScope.autoFocusOnMount",re="focusScope.autoFocusOnUnmount",ge={bubbles:!1,cancelable:!0},Mt="FocusScope",Le=i.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...c}=e,[s,d]=i.useState(null),l=U(o),f=U(a),v=i.useRef(null),p=M(t,u=>d(u)),h=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(r){let u=function(w){if(h.paused||!s)return;const S=w.target;s.contains(S)?v.current=S:A(v.current,{select:!0})},g=function(w){if(h.paused||!s)return;const S=w.relatedTarget;S!==null&&(s.contains(S)||A(v.current,{select:!0}))},y=function(w){if(document.activeElement===document.body)for(const x of w)x.removedNodes.length>0&&A(s)};document.addEventListener("focusin",u),document.addEventListener("focusout",g);const C=new MutationObserver(y);return s&&C.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",u),document.removeEventListener("focusout",g),C.disconnect()}}},[r,s,h.paused]),i.useEffect(()=>{if(s){Ee.add(h);const u=document.activeElement;if(!s.contains(u)){const y=new CustomEvent(ne,ge);s.addEventListener(ne,l),s.dispatchEvent(y),y.defaultPrevented||(kt(Wt(_e(s)),{select:!0}),document.activeElement===u&&A(s))}return()=>{s.removeEventListener(ne,l),setTimeout(()=>{const y=new CustomEvent(re,ge);s.addEventListener(re,f),s.dispatchEvent(y),y.defaultPrevented||A(u??document.body,{select:!0}),s.removeEventListener(re,f),Ee.remove(h)},0)}}},[s,l,f,h]);const b=i.useCallback(u=>{if(!n&&!r||h.paused)return;const g=u.key==="Tab"&&!u.altKey&&!u.ctrlKey&&!u.metaKey,y=document.activeElement;if(g&&y){const C=u.currentTarget,[w,S]=Lt(C);w&&S?!u.shiftKey&&y===S?(u.preventDefault(),n&&A(w,{select:!0})):u.shiftKey&&y===w&&(u.preventDefault(),n&&A(S,{select:!0})):y===C&&u.preventDefault()}},[n,r,h.paused]);return m.jsx(D.div,{tabIndex:-1,...c,ref:p,onKeyDown:b})});Le.displayName=Mt;function kt(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(A(r,{select:t}),document.activeElement!==n)return}function Lt(e){const t=_e(e),n=ye(t,e),r=ye(t.reverse(),e);return[n,r]}function _e(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ye(e,t){for(const n of e)if(!_t(n,{upTo:t}))return n}function _t(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Ft(e){return e instanceof HTMLInputElement&&"select"in e}function A(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ft(e)&&t&&e.select()}}var Ee=jt();function jt(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=be(e,t),e.unshift(t)},remove(t){e=be(e,t),e[0]?.resume()}}}function be(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Wt(e){return e.filter(t=>t.tagName!=="A")}var Bt="Portal",Fe=i.forwardRef((e,t)=>{const{container:n,...r}=e,[o,a]=i.useState(!1);B(()=>a(!0),[]);const c=n||o&&globalThis?.document?.body;return c?Oe.createPortal(m.jsx(D.div,{...r,ref:t}),c):null});Fe.displayName=Bt;function Ut(e,t){return i.useReducer((n,r)=>t[n][r]??n,e)}var q=e=>{const{present:t,children:n}=e,r=$t(t),o=typeof n=="function"?n({present:r.isPresent}):i.Children.only(n),a=M(r.ref,Vt(o));return typeof n=="function"||r.isPresent?i.cloneElement(o,{ref:a}):null};q.displayName="Presence";function $t(e){const[t,n]=i.useState(),r=i.useRef(null),o=i.useRef(e),a=i.useRef("none"),c=e?"mounted":"unmounted",[s,d]=Ut(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return i.useEffect(()=>{const l=$(r.current);a.current=s==="mounted"?l:"none"},[s]),B(()=>{const l=r.current,f=o.current;if(f!==e){const p=a.current,h=$(l);e?d("MOUNT"):h==="none"||l?.display==="none"?d("UNMOUNT"):d(f&&p!==h?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,d]),B(()=>{if(t){let l;const f=t.ownerDocument.defaultView??window,v=h=>{const u=$(r.current).includes(CSS.escape(h.animationName));if(h.target===t&&u&&(d("ANIMATION_END"),!o.current)){const g=t.style.animationFillMode;t.style.animationFillMode="forwards",l=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=g)})}},p=h=>{h.target===t&&(a.current=$(r.current))};return t.addEventListener("animationstart",p),t.addEventListener("animationcancel",v),t.addEventListener("animationend",v),()=>{f.clearTimeout(l),t.removeEventListener("animationstart",p),t.removeEventListener("animationcancel",v),t.removeEventListener("animationend",v)}}else d("ANIMATION_END")},[t,d]),{isPresent:["mounted","unmountSuspended"].includes(s),ref:i.useCallback(l=>{r.current=l?getComputedStyle(l):null,n(l)},[])}}function $(e){return e?.animationName||"none"}function Vt(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var oe=0;function Ht(){i.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ce()),document.body.insertAdjacentElement("beforeend",e[1]??Ce()),oe++,()=>{oe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),oe--}},[])}function Ce(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var N=function(){return N=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var a in n)Object.prototype.hasOwnProperty.call(n,a)&&(t[a]=n[a])}return t},N.apply(this,arguments)};function je(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function zt(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var G="right-scroll-bar-position",Y="width-before-scroll-bar",Kt="with-scroll-bars-hidden",Gt="--removed-body-scroll-bar-size";function ae(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Yt(e,t){var n=W.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Xt=typeof window<"u"?i.useLayoutEffect:i.useEffect,we=new WeakMap;function qt(e,t){var n=Yt(null,function(r){return e.forEach(function(o){return ae(o,r)})});return Xt(function(){var r=we.get(n);if(r){var o=new Set(r),a=new Set(e),c=n.current;o.forEach(function(s){a.has(s)||ae(s,null)}),a.forEach(function(s){o.has(s)||ae(s,c)})}we.set(n,e)},[e]),n}function Zt(e){return e}function Qt(e,t){t===void 0&&(t=Zt);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var c=t(a,r);return n.push(c),function(){n=n.filter(function(s){return s!==c})}},assignSyncMedium:function(a){for(r=!0;n.length;){var c=n;n=[],c.forEach(a)}n={push:function(s){return a(s)},filter:function(){return n}}},assignMedium:function(a){r=!0;var c=[];if(n.length){var s=n;n=[],s.forEach(a),c=n}var d=function(){var f=c;c=[],f.forEach(a)},l=function(){return Promise.resolve().then(d)};l(),n={push:function(f){c.push(f),l()},filter:function(f){return c=c.filter(f),n}}}};return o}function Jt(e){e===void 0&&(e={});var t=Qt(null);return t.options=N({async:!0,ssr:!1},e),t}var We=function(e){var t=e.sideCar,n=je(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return i.createElement(r,N({},n))};We.isSideCarExport=!0;function en(e,t){return e.useMedium(t),We}var Be=Jt(),ie=function(){},Z=i.forwardRef(function(e,t){var n=i.useRef(null),r=i.useState({onScrollCapture:ie,onWheelCapture:ie,onTouchMoveCapture:ie}),o=r[0],a=r[1],c=e.forwardProps,s=e.children,d=e.className,l=e.removeScrollBar,f=e.enabled,v=e.shards,p=e.sideCar,h=e.noRelative,b=e.noIsolation,u=e.inert,g=e.allowPinchZoom,y=e.as,C=y===void 0?"div":y,w=e.gapMode,S=je(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),x=p,P=qt([n,t]),E=N(N({},S),o);return i.createElement(i.Fragment,null,f&&i.createElement(x,{sideCar:Be,removeScrollBar:l,shards:v,noRelative:h,noIsolation:b,inert:u,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:w}),c?i.cloneElement(i.Children.only(s),N(N({},E),{ref:P})):i.createElement(C,N({},E,{className:d,ref:P}),s))});Z.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Z.classNames={fullWidth:Y,zeroRight:G};var tn=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function nn(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=tn();return t&&e.setAttribute("nonce",t),e}function rn(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function on(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var an=function(){var e=0,t=null;return{add:function(n){e==0&&(t=nn())&&(rn(t,n),on(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},sn=function(){var e=an();return function(t,n){i.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ue=function(){var e=sn(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},cn={left:0,top:0,right:0,gap:0},se=function(e){return parseInt(e||"",10)||0},un=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[se(n),se(r),se(o)]},ln=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return cn;var t=un(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},dn=Ue(),F="data-scroll-locked",fn=function(e,t,n,r){var o=e.left,a=e.top,c=e.right,s=e.gap;return n===void 0&&(n="margin"),`
2
+ .`.concat(Kt,` {
3
+ overflow: hidden `).concat(r,`;
4
+ padding-right: `).concat(s,"px ").concat(r,`;
5
+ }
6
+ body[`).concat(F,`] {
7
+ overflow: hidden `).concat(r,`;
8
+ overscroll-behavior: contain;
9
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
10
+ padding-left: `.concat(o,`px;
11
+ padding-top: `).concat(a,`px;
12
+ padding-right: `).concat(c,`px;
13
+ margin-left:0;
14
+ margin-top:0;
15
+ margin-right: `).concat(s,"px ").concat(r,`;
16
+ `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),`
17
+ }
18
+
19
+ .`).concat(G,` {
20
+ right: `).concat(s,"px ").concat(r,`;
21
+ }
22
+
23
+ .`).concat(Y,` {
24
+ margin-right: `).concat(s,"px ").concat(r,`;
25
+ }
26
+
27
+ .`).concat(G," .").concat(G,` {
28
+ right: 0 `).concat(r,`;
29
+ }
30
+
31
+ .`).concat(Y," .").concat(Y,` {
32
+ margin-right: 0 `).concat(r,`;
33
+ }
34
+
35
+ body[`).concat(F,`] {
36
+ `).concat(Gt,": ").concat(s,`px;
37
+ }
38
+ `)},Se=function(){var e=parseInt(document.body.getAttribute(F)||"0",10);return isFinite(e)?e:0},vn=function(){i.useEffect(function(){return document.body.setAttribute(F,(Se()+1).toString()),function(){var e=Se()-1;e<=0?document.body.removeAttribute(F):document.body.setAttribute(F,e.toString())}},[])},mn=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;vn();var a=i.useMemo(function(){return ln(o)},[o]);return i.createElement(dn,{styles:fn(a,!t,o,n?"":"!important")})},le=!1;if(typeof window<"u")try{var V=Object.defineProperty({},"passive",{get:function(){return le=!0,!0}});window.addEventListener("test",V,V),window.removeEventListener("test",V,V)}catch{le=!1}var k=le?{passive:!1}:!1,pn=function(e){return e.tagName==="TEXTAREA"},$e=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!pn(e)&&n[t]==="visible")},hn=function(e){return $e(e,"overflowY")},gn=function(e){return $e(e,"overflowX")},xe=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Ve(e,r);if(o){var a=He(e,r),c=a[1],s=a[2];if(c>s)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},yn=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},En=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Ve=function(e,t){return e==="v"?hn(t):gn(t)},He=function(e,t){return e==="v"?yn(t):En(t)},bn=function(e,t){return e==="h"&&t==="rtl"?-1:1},Cn=function(e,t,n,r,o){var a=bn(e,window.getComputedStyle(t).direction),c=a*r,s=n.target,d=t.contains(s),l=!1,f=c>0,v=0,p=0;do{if(!s)break;var h=He(e,s),b=h[0],u=h[1],g=h[2],y=u-g-a*b;(b||y)&&Ve(e,s)&&(v+=y,p+=b);var C=s.parentNode;s=C&&C.nodeType===Node.DOCUMENT_FRAGMENT_NODE?C.host:C}while(!d&&s!==document.body||d&&(t.contains(s)||t===s));return(f&&Math.abs(v)<1||!f&&Math.abs(p)<1)&&(l=!0),l},H=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Re=function(e){return[e.deltaX,e.deltaY]},Ne=function(e){return e&&"current"in e?e.current:e},wn=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Sn=function(e){return`
39
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
40
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
41
+ `)},xn=0,L=[];function Rn(e){var t=i.useRef([]),n=i.useRef([0,0]),r=i.useRef(),o=i.useState(xn++)[0],a=i.useState(Ue)[0],c=i.useRef(e);i.useEffect(function(){c.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var u=zt([e.lockRef.current],(e.shards||[]).map(Ne),!0).filter(Boolean);return u.forEach(function(g){return g.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),u.forEach(function(g){return g.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=i.useCallback(function(u,g){if("touches"in u&&u.touches.length===2||u.type==="wheel"&&u.ctrlKey)return!c.current.allowPinchZoom;var y=H(u),C=n.current,w="deltaX"in u?u.deltaX:C[0]-y[0],S="deltaY"in u?u.deltaY:C[1]-y[1],x,P=u.target,E=Math.abs(w)>Math.abs(S)?"h":"v";if("touches"in u&&E==="h"&&P.type==="range")return!1;var O=xe(E,P);if(!O)return!0;if(O?x=E:(x=E==="v"?"h":"v",O=xe(E,P)),!O)return!1;if(!r.current&&"changedTouches"in u&&(w||S)&&(r.current=x),!x)return!0;var j=r.current||x;return Cn(j,g,u,j==="h"?w:S)},[]),d=i.useCallback(function(u){var g=u;if(!(!L.length||L[L.length-1]!==a)){var y="deltaY"in g?Re(g):H(g),C=t.current.filter(function(x){return x.name===g.type&&(x.target===g.target||g.target===x.shadowParent)&&wn(x.delta,y)})[0];if(C&&C.should){g.cancelable&&g.preventDefault();return}if(!C){var w=(c.current.shards||[]).map(Ne).filter(Boolean).filter(function(x){return x.contains(g.target)}),S=w.length>0?s(g,w[0]):!c.current.noIsolation;S&&g.cancelable&&g.preventDefault()}}},[]),l=i.useCallback(function(u,g,y,C){var w={name:u,delta:g,target:y,should:C,shadowParent:Nn(y)};t.current.push(w),setTimeout(function(){t.current=t.current.filter(function(S){return S!==w})},1)},[]),f=i.useCallback(function(u){n.current=H(u),r.current=void 0},[]),v=i.useCallback(function(u){l(u.type,Re(u),u.target,s(u,e.lockRef.current))},[]),p=i.useCallback(function(u){l(u.type,H(u),u.target,s(u,e.lockRef.current))},[]);i.useEffect(function(){return L.push(a),e.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:p}),document.addEventListener("wheel",d,k),document.addEventListener("touchmove",d,k),document.addEventListener("touchstart",f,k),function(){L=L.filter(function(u){return u!==a}),document.removeEventListener("wheel",d,k),document.removeEventListener("touchmove",d,k),document.removeEventListener("touchstart",f,k)}},[]);var h=e.removeScrollBar,b=e.inert;return i.createElement(i.Fragment,null,b?i.createElement(a,{styles:Sn(o)}):null,h?i.createElement(mn,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Nn(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const Pn=en(Be,Rn);var ze=i.forwardRef(function(e,t){return i.createElement(Z,N({},e,{ref:t,sideCar:Pn}))});ze.classNames=Z.classNames;var On=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},_=new WeakMap,z=new WeakMap,K={},ce=0,Ke=function(e){return e&&(e.host||Ke(e.parentNode))},Dn=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Ke(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},An=function(e,t,n,r){var o=Dn(t,Array.isArray(e)?e:[e]);K[n]||(K[n]=new WeakMap);var a=K[n],c=[],s=new Set,d=new Set(o),l=function(v){!v||s.has(v)||(s.add(v),l(v.parentNode))};o.forEach(l);var f=function(v){!v||d.has(v)||Array.prototype.forEach.call(v.children,function(p){if(s.has(p))f(p);else try{var h=p.getAttribute(r),b=h!==null&&h!=="false",u=(_.get(p)||0)+1,g=(a.get(p)||0)+1;_.set(p,u),a.set(p,g),c.push(p),u===1&&b&&z.set(p,!0),g===1&&p.setAttribute(n,"true"),b||p.setAttribute(r,"true")}catch(y){console.error("aria-hidden: cannot operate on ",p,y)}})};return f(t),s.clear(),ce++,function(){c.forEach(function(v){var p=_.get(v)-1,h=a.get(v)-1;_.set(v,p),a.set(v,h),p||(z.has(v)||v.removeAttribute(r),z.delete(v)),h||v.removeAttribute(n)}),ce--,ce||(_=new WeakMap,_=new WeakMap,z=new WeakMap,K={})}},Tn=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=On(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live], script"))),An(r,o,n,"aria-hidden")):function(){return null}},Q="Dialog",[Ge,Qn]=lt(Q),[In,R]=Ge(Q),Ye=e=>{const{__scopeDialog:t,children:n,open:r,defaultOpen:o,onOpenChange:a,modal:c=!0}=e,s=i.useRef(null),d=i.useRef(null),[l,f]=pt({prop:r,defaultProp:o??!1,onChange:a,caller:Q});return m.jsx(In,{scope:t,triggerRef:s,contentRef:d,contentId:te(),titleId:te(),descriptionId:te(),open:l,onOpenChange:f,onOpenToggle:i.useCallback(()=>f(v=>!v),[f]),modal:c,children:n})};Ye.displayName=Q;var Xe="DialogTrigger",Mn=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=R(Xe,n),a=M(t,o.triggerRef);return m.jsx(D.button,{type:"button","aria-haspopup":"dialog","aria-expanded":o.open,"aria-controls":o.contentId,"data-state":ve(o.open),...r,ref:a,onClick:T(e.onClick,o.onOpenToggle)})});Mn.displayName=Xe;var de="DialogPortal",[kn,qe]=Ge(de,{forceMount:void 0}),Ze=e=>{const{__scopeDialog:t,forceMount:n,children:r,container:o}=e,a=R(de,t);return m.jsx(kn,{scope:t,forceMount:n,children:i.Children.map(r,c=>m.jsx(q,{present:n||a.open,children:m.jsx(Fe,{asChild:!0,container:o,children:c})}))})};Ze.displayName=de;var X="DialogOverlay",Qe=i.forwardRef((e,t)=>{const n=qe(X,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=R(X,e.__scopeDialog);return a.modal?m.jsx(q,{present:r||a.open,children:m.jsx(_n,{...o,ref:t})}):null});Qe.displayName=X;var Ln=Te("DialogOverlay.RemoveScroll"),_n=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=R(X,n);return m.jsx(ze,{as:Ln,allowPinchZoom:!0,shards:[o.contentRef],children:m.jsx(D.div,{"data-state":ve(o.open),...r,ref:t,style:{pointerEvents:"auto",...r.style}})})}),I="DialogContent",Je=i.forwardRef((e,t)=>{const n=qe(I,e.__scopeDialog),{forceMount:r=n.forceMount,...o}=e,a=R(I,e.__scopeDialog);return m.jsx(q,{present:r||a.open,children:a.modal?m.jsx(Fn,{...o,ref:t}):m.jsx(jn,{...o,ref:t})})});Je.displayName=I;var Fn=i.forwardRef((e,t)=>{const n=R(I,e.__scopeDialog),r=i.useRef(null),o=M(t,n.contentRef,r);return i.useEffect(()=>{const a=r.current;if(a)return Tn(a)},[]),m.jsx(et,{...e,ref:o,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:T(e.onCloseAutoFocus,a=>{a.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:T(e.onPointerDownOutside,a=>{const c=a.detail.originalEvent,s=c.button===0&&c.ctrlKey===!0;(c.button===2||s)&&a.preventDefault()}),onFocusOutside:T(e.onFocusOutside,a=>a.preventDefault())})}),jn=i.forwardRef((e,t)=>{const n=R(I,e.__scopeDialog),r=i.useRef(!1),o=i.useRef(!1);return m.jsx(et,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:a=>{e.onCloseAutoFocus?.(a),a.defaultPrevented||(r.current||n.triggerRef.current?.focus(),a.preventDefault()),r.current=!1,o.current=!1},onInteractOutside:a=>{e.onInteractOutside?.(a),a.defaultPrevented||(r.current=!0,a.detail.originalEvent.type==="pointerdown"&&(o.current=!0));const c=a.target;n.triggerRef.current?.contains(c)&&a.preventDefault(),a.detail.originalEvent.type==="focusin"&&o.current&&a.preventDefault()}})}),et=i.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:o,onCloseAutoFocus:a,...c}=e,s=R(I,n),d=i.useRef(null),l=M(t,d);return Ht(),m.jsxs(m.Fragment,{children:[m.jsx(Le,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:o,onUnmountAutoFocus:a,children:m.jsx(Me,{role:"dialog",id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":ve(s.open),...c,ref:l,onDismiss:()=>s.onOpenChange(!1)})}),m.jsxs(m.Fragment,{children:[m.jsx(Bn,{titleId:s.titleId}),m.jsx($n,{contentRef:d,descriptionId:s.descriptionId})]})]})}),fe="DialogTitle",tt=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=R(fe,n);return m.jsx(D.h2,{id:o.titleId,...r,ref:t})});tt.displayName=fe;var nt="DialogDescription",Wn=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=R(nt,n);return m.jsx(D.p,{id:o.descriptionId,...r,ref:t})});Wn.displayName=nt;var rt="DialogClose",ot=i.forwardRef((e,t)=>{const{__scopeDialog:n,...r}=e,o=R(rt,n);return m.jsx(D.button,{type:"button",...r,ref:t,onClick:T(e.onClick,()=>o.onOpenChange(!1))})});ot.displayName=rt;function ve(e){return e?"open":"closed"}var at="DialogTitleWarning",[Jn,it]=ut(at,{contentName:I,titleName:fe,docsSlug:"dialog"}),Bn=({titleId:e})=>{const t=it(at),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
42
+
43
+ If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
44
+
45
+ For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Un="DialogDescriptionWarning",$n=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${it(Un).contentName}}.`;return i.useEffect(()=>{const o=e.current?.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Vn=Ye,Hn=Ze,zn=Qe,Kn=Je,Gn=tt,Yn=ot;const Xn=e=>i.createElement("svg",{fill:"none",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg",...e},i.createElement("path",{d:"m4 12 8-8m-8 0 8 8",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5})),qn=e=>i.createElement("svg",{fill:"none",height:16,viewBox:"0 0 16 16",width:16,xmlns:"http://www.w3.org/2000/svg",...e},i.createElement("path",{d:"m9.7002 13-4.2929-4.29289c-.39052-.39053-.39052-1.02369 0-1.41422l4.2929-4.29289",stroke:"#1e1c1f",strokeLinecap:"round",strokeLinejoin:"round",strokeOpacity:.84,strokeWidth:1.5})),Pe="provider-widget-portal-root";function Zn(){let e=document.getElementById(Pe);return e||(e=document.createElement("div"),e.id=Pe,e.setAttribute("data-provider-widget-host",""),e.style.zIndex="2147483647",e.style.position="relative",document.body.appendChild(e)),e}const st=W.forwardRef((e,t)=>{const{"aria-labelledby":n,"aria-describedby":r,children:o,className:a,footerContent:c,headerContent:s,isDisplayingMargins:d=!0,open:l,onOpenChange:f,showCloseButton:v=!0,onBackClick:p}=e,[h,b]=W.useState(null);return W.useEffect(()=>{b(Zn())},[]),m.jsx(Vn,{open:l,onOpenChange:f,children:h&&m.jsxs(Hn,{container:h,children:[m.jsx(zn,{"aria-hidden":!0,className:ee.cn("fixed inset-0 bg-black/50 backdrop-blur-sm","!z-[2147483647] pointer-events-auto","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","duration-300")}),m.jsx(Kn,{ref:t,"aria-labelledby":n,"aria-describedby":r,"aria-modal":"true",className:ee.cn("fixed left-1/2 top-1/2 w-full max-w-lg -translate-x-1/2 -translate-y-1/2 outline-none","!z-[2147483647]","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95","data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%]","data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%]","duration-300",d&&"h-dvh max-h-[calc(100dvh-8px)] max-w-[calc(100dvw-8px)] rounded-2xl bg-white p-4",a),children:m.jsxs("div",{className:"flex h-full flex-col",children:[m.jsxs(Gn,{className:"flex flex-shrink-0 flex-row items-center justify-between",children:[m.jsxs("div",{className:"flex items-center",children:[p&&m.jsx(ee.Button,{className:"mr-auto rounded-full !bg-lightGray !p-[10px]",onClick:p,children:m.jsx(qn,{className:"size-4"})}),s]}),v&&m.jsx(Yn,{asChild:!0,children:m.jsx("button",{"aria-label":"Close modal",className:"hover:bg-gray-200 ml-auto rounded-full bg-lightGray p-[10px] outline-none",type:"button",children:m.jsx(Xn,{className:"size-4"})})})]}),m.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto",children:o}),c&&m.jsx("footer",{className:"flex flex-shrink-0 flex-col gap-2.5",children:c})]})})]})})});st.displayName="Dialog";exports.Dialog=st;