@nice2dev/ui-mobile 1.0.10
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 +41 -0
- package/dist/index.cjs +26 -0
- package/dist/index.d.ts +3430 -0
- package/dist/index.mjs +7835 -0
- package/dist/style.css +1 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @nice2dev/ui-mobile
|
|
2
|
+
|
|
3
|
+
Touch-first React components extracted from `@nice2dev/ui` (v1.0.10).
|
|
4
|
+
|
|
5
|
+
## Components
|
|
6
|
+
|
|
7
|
+
**Touch-first interactions:**
|
|
8
|
+
NiceTouchButton, NiceTouchSlider, NiceTouchKeyboard, NiceTouchMenu, NiceTouchTable,
|
|
9
|
+
NiceTouchForm, NiceTouchColorPicker, NiceTouchDrawing, NiceTouchSignaturePad
|
|
10
|
+
|
|
11
|
+
**Mobile shells:**
|
|
12
|
+
NiceMobileTabs, NiceMobileModal, NiceMobileHeader, NiceMobileDrawer,
|
|
13
|
+
NiceMobileCalendar, NiceMobilePicker
|
|
14
|
+
|
|
15
|
+
**Gestures & feedback:**
|
|
16
|
+
NiceGestures, NiceHapticsProvider, NicePinchZoom, NiceSwipeable, NiceDraggable
|
|
17
|
+
|
|
18
|
+
**Layout & data:**
|
|
19
|
+
NiceBottomSheet, NiceImageGallery, NiceInfiniteScroll, NicePullToRefresh,
|
|
20
|
+
NiceSwipeActions, NiceSwipeList
|
|
21
|
+
|
|
22
|
+
**Responsive utilities:**
|
|
23
|
+
NiceBreakpointProvider, NiceShow, NiceHide, useBreakpoint, useMediaQuery
|
|
24
|
+
|
|
25
|
+
## Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install @nice2dev/ui-mobile
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Usage
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { NiceBottomSheet, NiceTouchKeyboard } from '@nice2dev/ui-mobile';
|
|
35
|
+
import '@nice2dev/ui-mobile/style.css';
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Migration
|
|
39
|
+
|
|
40
|
+
If you previously imported these from `@nice2dev/ui`, switch to `@nice2dev/ui-mobile` —
|
|
41
|
+
they are no longer re-exported from `@nice2dev/ui` as of v1.0.10.
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";var Zt=Object.defineProperty;var en=(n,r,s)=>r in n?Zt(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s;var Ze=(n,r,s)=>en(n,typeof r!="symbol"?r+"":r,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),vt=e.createContext(null);function bt(){const n=e.useContext(vt);if(!n)throw new Error("usePullToRefresh must be used within NicePullToRefresh");return n}function Ne(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const mt=({state:n,progress:r,pullDistance:s,threshold:c})=>{const i=r*360,o=Math.min(1,r),d=()=>{switch(n){case"pulling":return t.jsxs("svg",{className:"ptr-icon ptr-icon-arrow",style:{transform:`rotate(${Math.min(i,180)}deg)`},width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("polyline",{points:"19 12 12 19 5 12"})]});case"ready":return t.jsxs("svg",{className:"ptr-icon ptr-icon-ready",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]});case"refreshing":return t.jsxs("svg",{className:"ptr-icon ptr-icon-spinner",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),t.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),t.jsx("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),t.jsx("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),t.jsx("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),t.jsx("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),t.jsx("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),t.jsx("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]});case"success":return t.jsx("svg",{className:"ptr-icon ptr-icon-success",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"20 6 9 17 4 12"})});case"error":return t.jsxs("svg",{className:"ptr-icon ptr-icon-error",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});default:return null}},u=()=>{switch(n){case"pulling":return"Pull down to refresh";case"ready":return"Release to refresh";case"refreshing":return"Refreshing...";case"success":return"Updated!";case"error":return"Failed to refresh";default:return""}};return t.jsxs("div",{className:`ptr-indicator ptr-indicator--${n}`,style:{opacity:n==="idle"?0:Math.max(.3,r),transform:`scale(${o})`},role:"status","aria-live":"polite",children:[t.jsx("div",{className:"ptr-indicator-icon",children:d()}),t.jsx("span",{className:"ptr-indicator-text",children:u()}),n==="pulling"&&t.jsx("div",{className:"ptr-progress-ring",children:t.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",children:[t.jsx("circle",{className:"ptr-progress-bg",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2"}),t.jsx("circle",{className:"ptr-progress-fill",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2",strokeDasharray:`${88*r} 88`,transform:"rotate(-90 16 16)"})]})})]})},Xe=e.forwardRef(({children:n,onRefresh:r,indicator:s,threshold:c=80,maxPull:i=150,resistance:o=.4,completionDuration:d=1e3,hapticFeedback:u=!0,disabled:b=!1,onPullStart:N,onPullProgress:y,onRefreshSuccess:j,onRefreshError:R,className:f="",style:m,ariaLabel:p="Pull to refresh"},S)=>{const[M,T]=e.useState("idle"),[w,A]=e.useState(0),Y=e.useRef(null),E=e.useRef(null),O=e.useRef(0),L=e.useRef(0),g=e.useRef(!1),D=e.useRef(!1),C=Math.min(1,w/c),B=M==="refreshing",P=e.useCallback(()=>w<=0?0:((F,V,h)=>{const v=F*(1-h);return Math.min(V,v+v*h/2)})(w,i,o),[w,i,o]),H=e.useCallback(async()=>{if(!(M==="refreshing"||b)){T("refreshing"),u&&Ne("medium");try{await r(),T("success"),u&&Ne("heavy"),j==null||j()}catch(z){T("error"),u&&Ne("light"),R==null||R(z instanceof Error?z:new Error("Refresh failed"))}setTimeout(()=>{T("idle"),A(0)},d)}},[M,b,u,r,j,R,d]),Z=e.useCallback(z=>{if(b||M==="refreshing")return;const F=E.current,V=(F==null?void 0:F.scrollTop)??0;V>0||(O.current=z.touches[0].clientY,L.current=V,D.current=!1)},[b,M]),_=e.useCallback(z=>{if(b||M==="refreshing")return;const F=E.current;if(((F==null?void 0:F.scrollTop)??0)>0&&!g.current)return;const v=z.touches[0].clientY-O.current;if(v<=0){g.current&&(g.current=!1,T("idle"),A(0));return}g.current||(g.current=!0,N==null||N(),T("pulling")),z.preventDefault(),A(v);const x=Math.min(1,v/c);y==null||y(x),v>=c?M!=="ready"&&(T("ready"),u&&!D.current&&(Ne("light"),D.current=!0)):M==="ready"&&(T("pulling"),D.current=!1)},[b,M,c,u,N,y]),W=e.useCallback(()=>{g.current&&(g.current=!1,M==="ready"?H():(T("idle"),A(0)))},[M,H]),K=e.useCallback(z=>{(z.key==="F5"||z.ctrlKey&&z.key==="r")&&(z.preventDefault(),H())},[H]),J=e.useCallback(z=>{Y.current=z,typeof S=="function"?S(z):S&&(S.current=z)},[S]),ee={state:M,progress:C,isRefreshing:B,triggerRefresh:H},$=P();return t.jsx(vt.Provider,{value:ee,children:t.jsxs("div",{ref:J,className:`nice-ptr ${f} nice-ptr--${M}`,style:m,onTouchStart:Z,onTouchMove:_,onTouchEnd:W,onKeyDown:K,tabIndex:0,role:"region","aria-label":p,"data-state":M,"data-disabled":b||void 0,children:[t.jsx("div",{className:"nice-ptr-indicator-wrapper",style:{height:$,opacity:M==="idle"?0:1},children:s?t.jsx(s,{state:M,progress:C,pullDistance:w,threshold:c}):t.jsx(mt,{state:M,progress:C,pullDistance:w,threshold:c})}),t.jsx("div",{ref:E,className:"nice-ptr-content",style:{transform:M==="refreshing"?`translateY(${c}px)`:`translateY(${$}px)`,transition:g.current?"none":"transform 0.3s cubic-bezier(0.23, 1, 0.32, 1)"},children:n})]})})});Xe.displayName="NicePullToRefresh";const tn=({state:n,progress:r})=>t.jsxs("div",{className:`ptr-dots ptr-dots--${n}`,children:[t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,r*3)}}),t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,(r-.33)*3)}}),t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,(r-.66)*3)}})]}),nn=({state:n,progress:r})=>t.jsx("div",{className:`ptr-line ptr-line--${n}`,children:t.jsx("div",{className:"ptr-line-fill",style:{width:`${r*100}%`}})}),rn=({state:n})=>{const r={idle:"",pulling:"👇",ready:"🔄",refreshing:"⏳",success:"✅",error:"❌"};return t.jsx("div",{className:`ptr-emoji ptr-emoji--${n}`,children:t.jsx("span",{className:"ptr-emoji-icon",children:r[n]})})},sn=({state:n,progress:r})=>t.jsx("div",{className:`ptr-ios ptr-ios--${n}`,children:t.jsx("div",{className:"ptr-ios-spinner",children:Array.from({length:12}).map((c,i)=>{const o=i/12*360,d=i/12*1,u=n==="refreshing"?void 0:Math.min(1,r*2-i*.08);return t.jsx("div",{className:"ptr-ios-bar",style:{transform:`rotate(${o}deg) translateY(-8px)`,animationDelay:`${d}s`,opacity:u}},i)})})}),cn=({state:n,progress:r})=>t.jsxs("div",{className:`ptr-material ptr-material--${n}`,children:[t.jsxs("svg",{className:"ptr-material-circle",viewBox:"0 0 36 36",width:"36",height:"36",children:[t.jsx("circle",{className:"ptr-material-bg",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3"}),t.jsx("circle",{className:"ptr-material-progress",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3",strokeDasharray:`${100*r} 100`,strokeLinecap:"round",transform:"rotate(-90 18 18)"})]}),(n==="success"||n==="error")&&t.jsx("span",{className:"ptr-material-icon",children:n==="success"?"✓":"!"})]}),xt=e.createContext(null),pt=({children:n})=>{const[r,s]=e.useState(null);return t.jsx(xt.Provider,{value:{activeItemId:r,setActiveItemId:s},children:n})};function gt(){return e.useContext(xt)}function Me(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const et=({action:n,width:r,progress:s,index:c,total:i,side:o,onTrigger:d})=>{const u=Math.min(1,s*2),b=o==="right"?(i-1-c)*.05:c*.05;return t.jsxs("button",{className:`nice-swipe-action nice-swipe-action--${o} ${n.destructive?"nice-swipe-action--destructive":""}`,style:{width:r,background:n.background||"var(--color-primary, #3b82f6)",color:n.color||"var(--bg-primary, #ffffff)",transform:`scale(${u})`,transitionDelay:`${b}s`},onClick:d,"aria-label":n.label,children:[n.icon&&t.jsx("span",{className:"nice-swipe-action-icon",children:n.icon}),t.jsx("span",{className:"nice-swipe-action-label",children:n.label})]})},yt=e.forwardRef(({children:n,leftActions:r=[],rightActions:s=[],actionWidth:c=72,threshold:i=.4,direction:o,exclusive:d=!0,onSwipeStart:u,onSwipeEnd:b,onAction:N,disabled:y=!1,className:j="",style:R,itemId:f,hapticFeedback:m=!0},p)=>{const S=gt(),[M,T]=e.useState(0),[w,A]=e.useState(null),[Y,E]=e.useState(!1),O=e.useRef(null),L=e.useRef(0),g=e.useRef(0),D=e.useRef(0),C=e.useRef(!1),B=e.useRef(null),P=e.useRef(!1),H=-(r.length*c),Z=s.length*c,_=(o==="left"||o==="both"||!o)&&r.length>0,W=(o==="right"||o==="both"||!o)&&s.length>0,K=Math.min(1,Math.abs(M)/Math.abs(H)),J=Math.min(1,M/Z),ee=e.useMemo(()=>f||`swipe-${Math.random().toString(36).substr(2,9)}`,[f]),$=e.useCallback(()=>{E(!0),T(0),A(null),setTimeout(()=>E(!1),300)},[]);e.useEffect(()=>{d&&S&&S.activeItemId!==null&&S.activeItemId!==ee&&w&&$()},[d,S,ee,w,$]);const z=e.useCallback(a=>{y||Y||(L.current=a.touches[0].clientX,g.current=a.touches[0].clientY,D.current=M,C.current=!1,B.current=null,P.current=!1)},[y,Y,M]),F=e.useCallback(a=>{if(y||Y)return;const l=a.touches[0].clientX,k=a.touches[0].clientY,I=l-L.current,G=k-g.current;if(!C.current){if(Math.abs(I)<Math.abs(G))return;C.current=!0,B.current=I<0?"left":"right",u==null||u(B.current),d&&S&&S.setActiveItemId(ee)}let X=D.current+I;if(!_&&X<0&&(X=Math.max(X,-30)*.3),!W&&X>0&&(X=Math.min(X,30)*.3),_&&X<H){const ne=H-X;X=H-ne*.3}if(W&&X>Z){const ne=X-Z;X=Z+ne*.3}const q=B.current==="left"?Math.abs(H)*i:Z*i,se=B.current==="left"?Math.abs(X):X;se>=q&&!P.current?(P.current=!0,m&&Me("light")):se<q&&P.current&&(P.current=!1),T(X),a.preventDefault()},[y,Y,_,W,H,Z,i,m,d,S,ee,u]),V=e.useCallback(()=>{if(!C.current)return;C.current=!1,E(!0);const a=Math.abs(H)*i,l=Z*i;let k=0,I=null;B.current==="left"&&_?Math.abs(M)>=a&&(k=H,I="left",m&&Me("medium")):B.current==="right"&&W&&M>=l&&(k=Z,I="right",m&&Me("medium")),(w==="left"&&M>0||w==="right"&&M<0)&&(k=0,I=null),T(k),A(I),b==null||b(I),setTimeout(()=>E(!1),300)},[M,H,Z,i,_,W,w,m,b]),h=e.useCallback((a,l)=>{a.onClick(),N==null||N(a,l),m&&Me("heavy"),$()},[N,m,$]),v=e.useCallback(a=>{a.key==="Escape"&&w&&$()},[w,$]),x=e.useCallback(a=>{O.current=a,typeof p=="function"?p(a):p&&(p.current=a)},[p]);return t.jsxs("div",{ref:x,className:`nice-swipe-container ${j} ${w?`nice-swipe-container--open-${w}`:""}`,style:R,onKeyDown:v,tabIndex:0,role:"listitem","aria-label":w?`Swipe actions ${w} visible`:"Swipe for actions","data-disabled":y||void 0,children:[s.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--left",style:{width:Z},children:s.map((a,l)=>t.jsx(et,{action:a,width:c,progress:J,index:l,total:s.length,side:"right",onTrigger:()=>h(a,"right")},a.id))}),t.jsx("div",{className:"nice-swipe-content",style:{transform:`translateX(${M}px)`,transition:Y?"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none"},onTouchStart:z,onTouchMove:F,onTouchEnd:V,children:n}),r.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--right",style:{width:Math.abs(H)},children:r.map((a,l)=>t.jsx(et,{action:a,width:c,progress:K,index:l,total:r.length,side:"left",onTrigger:()=>h(a,"left")},a.id))})]})});yt.displayName="NiceSwipeActions";const an=({children:n,className:r="",style:s})=>t.jsx(pt,{children:t.jsx("div",{className:`nice-swipe-list ${r}`,style:s,role:"list",children:n})}),ln={delete:n=>({id:"delete",label:"Delete",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"3 6 5 6 21 6"}),t.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),background:"var(--color-error, #ef4444)",destructive:!0,onClick:n}),edit:n=>({id:"edit",label:"Edit",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),t.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),background:"var(--color-primary, #3b82f6)",onClick:n}),archive:n=>({id:"archive",label:"Archive",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"21 8 21 21 3 21 3 8"}),t.jsx("rect",{x:"1",y:"3",width:"22",height:"5"}),t.jsx("line",{x1:"10",y1:"12",x2:"14",y2:"12"})]}),background:"var(--text-muted, #6b7280)",onClick:n}),star:n=>({id:"star",label:"Star",icon:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),background:"var(--color-warning, #eab308)",onClick:n}),share:n=>({id:"share",label:"Share",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"18",cy:"5",r:"3"}),t.jsx("circle",{cx:"6",cy:"12",r:"3"}),t.jsx("circle",{cx:"18",cy:"19",r:"3"}),t.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),t.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),background:"var(--color-success, #22c55e)",onClick:n}),pin:n=>({id:"pin",label:"Pin",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"22"}),t.jsx("path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"})]}),background:"var(--color-accent, #8b5cf6)",onClick:n}),mute:n=>({id:"mute",label:"Mute",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),t.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),t.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),background:"var(--text-muted, #64748b)",onClick:n}),reply:n=>({id:"reply",label:"Reply",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"9 17 4 12 9 7"}),t.jsx("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"})]}),background:"var(--color-info, #0ea5e9)",onClick:n})};function tt(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function on(n,r,s){return n==="full"?r*.95:n==="content"?Math.min(s,r*.9):r*n/100}const wt=e.forwardRef(({children:n,open:r,onClose:s,onSnapChange:c,snapPoints:i=[50,100],initialSnap:o=0,header:d,footer:u,showHandle:b=!0,showBackdrop:N=!0,closeOnBackdrop:y=!0,closeOnEscape:j=!0,dismissible:R=!0,velocityThreshold:f=.5,hapticFeedback:m=!0,handleColor:p,borderRadius:S=16,zIndex:M=1e3,className:T="",style:w,ariaLabel:A="Bottom sheet"},Y)=>{const[E,O]=e.useState(o),[L,g]=e.useState(0),[D,C]=e.useState(!1),[B,P]=e.useState(typeof window<"u"?window.innerHeight:800),[H,Z]=e.useState(400),_=e.useRef(null),W=e.useRef(null),K=e.useRef(0),J=e.useRef(0),ee=e.useRef(0),$=e.useRef(0),z=e.useRef(0),F=e.useRef(-1),V=i.map(q=>on(q,B,H)),h=V[E]??V[0];e.useImperativeHandle(Y,()=>({snapTo:q=>{q>=0&&q<i.length&&(O(q),g(0),c==null||c(q,V[q]))},close:()=>s(),getCurrentSnap:()=>E})),e.useEffect(()=>{const q=()=>{P(window.innerHeight)};return window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]),e.useEffect(()=>{if(W.current&&r){const q=W.current.scrollHeight;Z(q+60)}},[r,n]),e.useEffect(()=>{if(!r||!j)return;const q=se=>{se.key==="Escape"&&s()};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[r,j,s]),e.useEffect(()=>{if(r){const q=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=q}}},[r]);const v=e.useCallback(q=>{const se=B-h+q,ne=B-se;for(let ie=0;ie<V.length;ie++){const ae=V[ie];if(Math.abs(ne-ae)<20&&F.current!==ie){F.current=ie,m&&tt("light");break}}},[B,h,V,m]),x=e.useCallback((q,se)=>{if(se>f*2&&R&&q<V[0]*.5)return-1;if(se<-f)return V.length-1;if(se>f)return R&&q<V[0]*.7?-1:0;let ne=0,ie=Math.abs(q-V[0]);for(let ae=1;ae<V.length;ae++){const re=Math.abs(q-V[ae]);re<ie&&(ie=re,ne=ae)}return R&&q<V[0]*.5?-1:ne},[V,f,R]),a=e.useCallback(q=>{K.current=q.touches[0].clientY,J.current=L,ee.current=q.touches[0].clientY,$.current=Date.now(),z.current=0,F.current=-1,C(!0)},[L]),l=e.useCallback(q=>{if(!D)return;const se=q.touches[0].clientY,ne=se-K.current,ie=Date.now(),ae=ie-$.current;ae>0&&(z.current=(se-ee.current)/ae),ee.current=se,$.current=ie;let re=J.current+ne;const oe=h+50;if(re>oe){const Q=re-oe;re=oe+Q*.2}const U=-(B*.95-h);if(re<U){const Q=U-re;re=U-Q*.2}g(re),v(re),q.preventDefault()},[D,h,B,v]),k=e.useCallback(()=>{if(!D)return;C(!1);const q=h-L,se=x(q,z.current);if(se===-1)g(h+100),setTimeout(()=>{s(),g(0),O(o)},300);else{const ne=V[se];g(0),O(se),se!==E&&(c==null||c(se,ne),m&&tt("medium"))}},[D,h,L,x,E,V,s,c,o,m]),I=e.useCallback(()=>{y&&s()},[y,s]);if(!r)return null;const G=Math.max(0,h-L),X=Math.min(.5,G/B*.8);return t.jsxs("div",{className:`nice-bottom-sheet-container ${T}`,style:{zIndex:M},children:[N&&t.jsx("div",{className:"nice-bottom-sheet-backdrop",style:{opacity:X},onClick:I,"aria-hidden":"true"}),t.jsxs("div",{ref:_,className:`nice-bottom-sheet ${D?"nice-bottom-sheet--dragging":""}`,style:{...w,height:G,borderTopLeftRadius:S,borderTopRightRadius:S,transition:D?"none":"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},role:"dialog","aria-modal":"true","aria-label":A,children:[b&&t.jsx("div",{className:"nice-bottom-sheet-handle",onTouchStart:a,onTouchMove:l,onTouchEnd:k,children:t.jsx("div",{className:"nice-bottom-sheet-handle-bar",style:p?{backgroundColor:p}:void 0})}),d&&t.jsx("div",{className:"nice-bottom-sheet-header",children:d}),t.jsx("div",{ref:W,className:"nice-bottom-sheet-content",onTouchStart:a,onTouchMove:l,onTouchEnd:k,children:n}),u&&t.jsx("div",{className:"nice-bottom-sheet-footer",children:u})]})]})});wt.displayName="NiceBottomSheet";function un(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function nt(n,r){return Math.hypot(r.x-n.x,r.y-n.y)}function rt(n,r){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}const kt=e.forwardRef(({items:n,selectedIndex:r=0,onIndexChange:s,onClose:c,showClose:i=!0,showCounter:o=!0,showCaption:d=!0,showThumbnails:u=!1,enablePinchZoom:b=!0,enableDoubleTapZoom:N=!0,enableSwipe:y=!0,enableKeyboard:j=!0,minZoom:R=1,maxZoom:f=4,doubleTapZoom:m=2.5,swipeThreshold:p=50,loop:S=!0,hapticFeedback:M=!0,backgroundColor:T="rgba(0, 0, 0, 0.95)",zIndex:w=2e3,className:A="",style:Y},E)=>{const[O,L]=e.useState(r),[g,D]=e.useState(1),[C,B]=e.useState(0),[P,H]=e.useState(0),[Z,_]=e.useState(!1),[W,K]=e.useState({}),J=e.useRef(null),ee=e.useRef(null),$=e.useRef([]),z=e.useRef(0),F=e.useRef(1),V=e.useRef({x:0,y:0}),h=e.useRef(0),v=e.useRef({x:0,y:0}),x=e.useRef(!1),a=e.useRef(!1),l=e.useRef(null),k=n[O],I=e.useCallback(U=>{let Q=U;S?Q=(U%n.length+n.length)%n.length:Q=Math.max(0,Math.min(n.length-1,U)),Q!==O&&(_(!0),L(Q),D(1),B(0),H(0),s==null||s(Q,n[Q]),M&&un("light"),setTimeout(()=>_(!1),300))},[O,n,S,s,M]),G=e.useCallback(()=>I(O+1),[I,O]),X=e.useCallback(()=>I(O-1),[I,O]),q=e.useCallback((U,Q,te)=>{const ce=Math.max(R,Math.min(f,U));D(ce),ce<=1&&(B(0),H(0))},[R,f]),se=e.useCallback(()=>q(g*1.5),[g,q]),ne=e.useCallback(()=>q(g/1.5),[g,q]),ie=e.useCallback(()=>{D(1),B(0),H(0)},[]);e.useImperativeHandle(E,()=>({goTo:I,goNext:G,goPrev:X,zoomIn:se,zoomOut:ne,resetZoom:ie,close:()=>c==null?void 0:c()})),e.useEffect(()=>{if(!j)return;const U=Q=>{switch(Q.key){case"ArrowLeft":X();break;case"ArrowRight":G();break;case"ArrowUp":se();break;case"ArrowDown":ne();break;case"Escape":c==null||c();break;case"0":case"Home":ie();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[j,G,X,se,ne,ie,c]);const ae=e.useCallback(U=>{const Q=Array.from(U.touches).map(te=>({x:te.clientX,y:te.clientY,id:te.identifier}));if($.current=Q,v.current={x:Q[0].x,y:Q[0].y},a.current=!1,l.current=null,Q.length===2&&b)x.current=!0,z.current=nt(Q[0],Q[1]),F.current=g,V.current={x:C,y:P};else if(Q.length===1){const te=Date.now();te-h.current<300&&N?(g>1.1?ie():q(m,Q[0].x,Q[0].y),h.current=0):h.current=te,V.current={x:C,y:P}}},[g,C,P,b,N,m,ie,q]),re=e.useCallback(U=>{const Q=Array.from(U.touches).map(te=>({x:te.clientX,y:te.clientY,id:te.identifier}));if(Q.length===2&&x.current&&b){const ce=nt(Q[0],Q[1])/z.current,ue=F.current*ce;q(ue);const de=rt(Q[0],Q[1]),fe=rt($.current[0],$.current[1]||$.current[0]),he=de.x-fe.x,Ae=de.y-fe.y;B(V.current.x+he),H(V.current.y+Ae),U.preventDefault()}else if(Q.length===1){const te=Q[0].x-v.current.x,ce=Q[0].y-v.current.y;if(l.current||(Math.abs(te)>10||Math.abs(ce)>10)&&(l.current=Math.abs(te)>Math.abs(ce)?"horizontal":"vertical",a.current=!0),g>1.1){const ue=V.current.x+te,de=V.current.y+ce;B(ue),H(de)}U.preventDefault()}},[g,b,q]),oe=e.useCallback(U=>{if(x.current){x.current=!1;return}const Q=U.changedTouches[0],te=Q.clientX-v.current.x;Q.clientY-v.current.y,y&&g<=1.1&&l.current==="horizontal"&&(te>p?X():te<-p&&G()),g<=1.1&&(B(0),H(0)),a.current=!1,l.current=null},[g,y,p,G,X]);return e.useEffect(()=>{n.forEach((U,Q)=>{const te=new Image;te.onload=()=>{K(ce=>({...ce,[Q]:!0}))},te.src=U.src})},[n]),n.length===0?null:t.jsxs("div",{ref:J,className:`nice-image-gallery ${A}`,style:{...Y,backgroundColor:T,zIndex:w},role:"dialog","aria-modal":"true","aria-label":"Image gallery",children:[t.jsxs("div",{className:"nice-image-gallery-header",children:[o&&t.jsxs("span",{className:"nice-image-gallery-counter",children:[O+1," / ",n.length]}),t.jsxs("div",{className:"nice-image-gallery-actions",children:[t.jsx("button",{className:"nice-image-gallery-btn",onClick:ne,disabled:g<=R,"aria-label":"Zoom out",children:"−"}),t.jsx("button",{className:"nice-image-gallery-btn",onClick:se,disabled:g>=f,"aria-label":"Zoom in",children:"+"}),i&&t.jsx("button",{className:"nice-image-gallery-btn nice-image-gallery-close",onClick:c,"aria-label":"Close",children:"×"})]})]}),t.jsxs("div",{className:"nice-image-gallery-viewport",onTouchStart:ae,onTouchMove:re,onTouchEnd:oe,children:[t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--prev",onClick:X,disabled:!S&&O===0,"aria-label":"Previous image",children:"‹"}),t.jsxs("div",{className:"nice-image-gallery-image-container",children:[k.placeholder&&!W[O]&&t.jsx("div",{className:"nice-image-gallery-placeholder",style:{backgroundColor:k.placeholder}}),t.jsx("img",{ref:ee,src:k.src,alt:k.alt||k.title||"",className:`nice-image-gallery-image ${Z?"nice-image-gallery-image--animating":""}`,style:{transform:`scale(${g}) translate(${C/g}px, ${P/g}px)`,transition:x.current||a.current?"none":"transform 0.2s ease-out"},draggable:!1})]}),t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--next",onClick:G,disabled:!S&&O===n.length-1,"aria-label":"Next image",children:"›"})]}),d&&k.title&&t.jsxs("div",{className:"nice-image-gallery-caption",children:[t.jsx("h3",{children:k.title}),k.description&&t.jsx("p",{children:k.description})]}),u&&n.length>1&&t.jsx("div",{className:"nice-image-gallery-thumbnails",children:n.map((U,Q)=>t.jsx("button",{className:`nice-image-gallery-thumb ${Q===O?"nice-image-gallery-thumb--active":""}`,onClick:()=>I(Q),"aria-label":`Go to image ${Q+1}`,children:t.jsx("img",{src:U.thumbnail||U.src,alt:U.alt||"",loading:"lazy"})},Q))}),!u&&n.length>1&&n.length<=10&&t.jsx("div",{className:"nice-image-gallery-dots",children:n.map((U,Q)=>t.jsx("button",{className:`nice-image-gallery-dot ${Q===O?"nice-image-gallery-dot--active":""}`,onClick:()=>I(Q),"aria-label":`Go to image ${Q+1}`},Q))})]})});kt.displayName="NiceImageGallery";const jt=e.createContext(null);function dn(){const n=e.useContext(jt);if(!n)throw new Error("useInfiniteScroll must be used within NiceInfiniteScroll");return n}const st=()=>t.jsxs("div",{className:"nice-infinite-loading",children:[t.jsx("div",{className:"nice-infinite-spinner",children:t.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[t.jsx("circle",{className:"nice-infinite-spinner-track",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"3"}),t.jsx("circle",{className:"nice-infinite-spinner-fill",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"3",strokeDasharray:"60",strokeLinecap:"round"})]})}),t.jsx("span",{className:"nice-infinite-loading-text",children:"Loading..."})]}),fn=()=>t.jsxs("div",{className:"nice-infinite-end",children:[t.jsx("span",{className:"nice-infinite-end-line"}),t.jsx("span",{className:"nice-infinite-end-text",children:"You've reached the end"}),t.jsx("span",{className:"nice-infinite-end-line"})]}),hn=({message:n,onRetry:r})=>t.jsxs("div",{className:"nice-infinite-error",role:"alert",children:[t.jsxs("svg",{className:"nice-infinite-error-icon",viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),t.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),t.jsx("span",{className:"nice-infinite-error-text",children:n}),r&&t.jsx("button",{className:"nice-infinite-error-retry",onClick:r,"aria-label":"Retry loading",children:"Retry"})]}),vn=()=>t.jsxs("div",{className:"nice-infinite-empty",children:[t.jsx("svg",{className:"nice-infinite-empty-icon",viewBox:"0 0 24 24",width:"48",height:"48",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:t.jsx("path",{d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),t.jsx("p",{className:"nice-infinite-empty-text",children:"No items to display"})]}),bn=({visible:n,onClick:r})=>t.jsx("button",{className:`nice-infinite-scroll-top ${n?"nice-infinite-scroll-top--visible":""}`,onClick:r,"aria-label":"Scroll to top",children:t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"18 15 12 9 6 15"})})});function mn({items:n,renderItem:r,onLoadMore:s,hasMore:c,isLoading:i=!1,error:o=null,threshold:d=200,loadingIndicator:u,endIndicator:b,errorIndicator:N,onRetry:y,pullToRefresh:j=!1,onRefresh:R,direction:f="vertical",reverse:m=!1,initialScrollPosition:p="top",keyboardNav:S=!0,keyExtractor:M,emptyContent:T,header:w,footer:A,gap:Y=0,className:E="",style:O,ariaLabel:L="Scrollable list"},g){const[D,C]=e.useState("idle"),[B,P]=e.useState(!1),[H,Z]=e.useState(!1),_=e.useRef(null),W=e.useRef(null),K=e.useRef(!1),J=e.useRef(null);e.useEffect(()=>{o?C("error"):i?C("loading"):!c&&n.length>0?C("end"):C("idle")},[o,i,c,n.length]);const ee=e.useCallback((a,l)=>M?M(a,l):`item-${l}`,[M]),$=e.useCallback(async()=>{if(!(K.current||!c||o)){K.current=!0;try{await s()}finally{K.current=!1}}},[c,o,s]),z=e.useCallback(()=>{var a;(a=_.current)==null||a.scrollTo({top:0,behavior:"smooth"})},[]),F=e.useCallback(()=>{_.current&&_.current.scrollTo({top:_.current.scrollHeight,behavior:"smooth"})},[]);e.useEffect(()=>{if(!W.current)return;const a=l=>{const[k]=l;k.isIntersecting&&c&&!i&&!o&&$()};return J.current=new IntersectionObserver(a,{root:_.current,rootMargin:`${d}px`,threshold:.1}),J.current.observe(W.current),()=>{var l;(l=J.current)==null||l.disconnect()}},[c,i,o,d,$]),e.useEffect(()=>{const a=_.current;if(!a)return;const l=()=>{const k=f==="vertical"?a.scrollTop:a.scrollLeft;P(k>500)};return a.addEventListener("scroll",l,{passive:!0}),()=>a.removeEventListener("scroll",l)},[f]),e.useEffect(()=>{p==="bottom"&&_.current&&(_.current.scrollTop=_.current.scrollHeight)},[p]);const V=e.useCallback(a=>{S&&(a.key==="Home"?(a.preventDefault(),z()):a.key==="End"&&(a.preventDefault(),F()))},[S,z,F]);e.useCallback(async()=>{if(!(!R||H)){Z(!0);try{await R()}finally{Z(!1)}}},[R,H]);const h=e.useCallback(a=>{_.current=a,typeof g=="function"?g(a):g&&(g.current=a)},[g]),v=e.useMemo(()=>({status:D,loadMore:$,hasMore:c,itemCount:n.length,scrollToTop:z,scrollToBottom:F}),[D,$,c,n.length,z,F]),x=e.useMemo(()=>(m?[...n].reverse():n).map((l,k)=>t.jsx("div",{className:"nice-infinite-item","data-index":k,children:r(l,k)},ee(l,k))),[n,m,ee,r]);return n.length===0&&!i&&!o?t.jsx("div",{ref:h,className:`nice-infinite-container nice-infinite-container--empty ${E}`,style:O,role:"region","aria-label":L,children:T||t.jsx(vn,{})}):t.jsx(jt.Provider,{value:v,children:t.jsxs("div",{ref:h,className:`nice-infinite-container nice-infinite-container--${f} ${m?"nice-infinite-container--reverse":""} ${E}`,style:O,onKeyDown:V,tabIndex:0,role:"feed","aria-label":L,"aria-busy":i,children:[w&&t.jsx("div",{className:"nice-infinite-header",children:w}),j&&H&&t.jsx("div",{className:"nice-infinite-pull",children:u||t.jsx(st,{})}),t.jsx("div",{className:"nice-infinite-items",style:{gap:Y},children:x}),t.jsx("div",{ref:W,className:"nice-infinite-sentinel","aria-hidden":"true"}),D==="loading"&&(u||t.jsx(st,{})),D==="error"&&o&&(N||t.jsx(hn,{message:o,onRetry:y})),D==="end"&&(b||t.jsx(fn,{})),A&&t.jsx("div",{className:"nice-infinite-footer",children:A}),t.jsx(bn,{visible:B,onClick:z})]})})}const xn=e.forwardRef(mn);function pn(n){const{fetchPage:r,initialCursor:s,refetchOnFocus:c=!1}=n,[i,o]=e.useState([]),[d,u]=e.useState(s),[b,N]=e.useState(!1),[y,j]=e.useState(null),[R,f]=e.useState(!0),[m,p]=e.useState(!1),S=e.useCallback(async()=>{if(!(b||!R)){N(!0),j(null);try{const w=await r(d);o(A=>[...A,...w.items]),u(w.nextCursor),f(w.hasMore),p(!0)}catch(w){j(w instanceof Error?w.message:"Failed to load data")}finally{N(!1)}}},[r,d,b,R]),M=e.useCallback(async()=>{o([]),u(s),f(!0),j(null),N(!0);try{const w=await r(s);o(w.items),u(w.nextCursor),f(w.hasMore)}catch(w){j(w instanceof Error?w.message:"Failed to refresh data")}finally{N(!1)}},[r,s]),T=e.useCallback(()=>{o([]),u(s),f(!0),j(null),p(!1)},[s]);return e.useEffect(()=>{!m&&!b&&S()},[m,b,S]),e.useEffect(()=>{if(!c)return;const w=()=>{m&&M()};return window.addEventListener("focus",w),()=>window.removeEventListener("focus",w)},[c,m,M]),{items:i,isLoading:b,error:y,hasMore:R,loadMore:S,refresh:M,reset:T}}function gn(n){const{itemCount:r,itemHeight:s,overscan:c=5,containerRef:i}=n,[o,d]=e.useState(0),[u,b]=e.useState(0),N=e.useCallback(f=>typeof s=="function"?s(f):s,[s]),y=e.useMemo(()=>{let f=0;for(let m=0;m<r;m++)f+=N(m);return f},[r,N]),j=e.useMemo(()=>{const f=[];let m=0,p=-1,S=-1;for(let M=0;M<r;M++){const T=N(M),w=m+T;w>=o&&p===-1&&(p=M),m<=o+u&&(S=M),m=w}p=Math.max(0,p-c),S=Math.min(r-1,S+c),m=0;for(let M=0;M<r;M++){const T=N(M);M>=p&&M<=S&&f.push({index:M,start:m,size:T,end:m+T}),m+=T}return f},[r,N,o,u,c]);e.useEffect(()=>{const f=i.current;if(!f)return;b(f.clientHeight);const m=()=>{d(f.scrollTop)},p=()=>{b(f.clientHeight)};return f.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",p),()=>{f.removeEventListener("scroll",m),window.removeEventListener("resize",p)}},[i]);const R=e.useCallback(f=>{const m=i.current;if(!m)return;let p=0;for(let S=0;S<f&&S<r;S++)p+=N(S);m.scrollTo({top:p,behavior:"smooth"})},[i,r,N]);return{virtualItems:j,totalSize:y,scrollToIndex:R}}const Nt=e.createContext(null);function yn(){const n=e.useContext(Nt);if(!n)throw new Error("useMobileDrawer must be used within NiceMobileDrawer");return n}const Mt=({item:n,depth:r=0,onSelect:s,activeId:c})=>{const[i,o]=e.useState(!1),d=n.children&&n.children.length>0,u=c===n.id;if(n.divider)return t.jsx("div",{className:"nice-drawer-divider"});if(n.section)return t.jsx("div",{className:"nice-drawer-section",children:t.jsx("span",{className:"nice-drawer-section-label",children:n.section})});const b=()=>{n.disabled||(d?o(!i):(s(n),n.onClick&&n.onClick()))};return t.jsxs("div",{className:"nice-drawer-nav-item-wrapper",children:[t.jsxs("button",{className:`nice-drawer-nav-item nice-drawer-nav-item--depth-${r} ${u?"nice-drawer-nav-item--active":""} ${n.disabled?"nice-drawer-nav-item--disabled":""}`,onClick:b,disabled:n.disabled,"aria-expanded":d?i:void 0,"aria-current":u?"page":void 0,style:{paddingLeft:`${16+r*16}px`},children:[n.icon&&t.jsx("span",{className:"nice-drawer-nav-icon",children:n.icon}),t.jsx("span",{className:"nice-drawer-nav-label",children:n.label}),n.badge!==void 0&&t.jsx("span",{className:"nice-drawer-nav-badge",style:{background:n.badgeColor},children:n.badge}),d&&t.jsx("span",{className:`nice-drawer-nav-chevron ${i?"nice-drawer-nav-chevron--expanded":""}`,children:t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),d&&i&&t.jsx("div",{className:"nice-drawer-nav-children",children:n.children.map(N=>t.jsx(Mt,{item:N,depth:r+1,onSelect:s,activeId:c},N.id))})]})},Tt=e.forwardRef(({open:n,onClose:r,position:s="left",variant:c="overlay",size:i,children:o,navItems:d,header:u,footer:b,swipeToOpen:N=!0,swipeToClose:y=!0,edgeSwipeWidth:j=20,velocityThreshold:R=.3,showOverlay:f=!0,closeOnOverlayClick:m=!0,closeOnEscape:p=!0,disableBodyScroll:S=!0,overlayColor:M,zIndex:T=1e3,onNavSelect:w,activeNavId:A,className:Y="",style:E,ariaLabel:O="Navigation drawer"},L)=>{const[g,D]=e.useState(0),[C,B]=e.useState(!1),[P,H]=e.useState(A),Z=e.useRef(null),_=e.useRef({x:0,y:0}),W=e.useRef(0),K=e.useRef({x:0,y:0}),J=s==="left"||s==="right",$=i??(J?280:400);e.useEffect(()=>{A!==void 0&&H(A)},[A]),e.useEffect(()=>{if(S&&n){const l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}}},[n,S]),e.useEffect(()=>{if(!p||!n)return;const l=k=>{k.key==="Escape"&&r()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[p,n,r]),e.useEffect(()=>{if(!n||!Z.current)return;const l=Z.current,k=l.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),I=k[0],G=k[k.length-1],X=q=>{q.key==="Tab"&&(q.shiftKey&&document.activeElement===I?(q.preventDefault(),G==null||G.focus()):!q.shiftKey&&document.activeElement===G&&(q.preventDefault(),I==null||I.focus()))};return l.addEventListener("keydown",X),I==null||I.focus(),()=>l.removeEventListener("keydown",X)},[n]);const z=e.useCallback(()=>{let l=0;const k=g;if(!n)switch(s){case"left":l=-100;break;case"right":l=100;break;case"top":l=-100;break;case"bottom":l=100;break}return J?`translateX(calc(${l}% + ${k}px))`:`translateY(calc(${l}% + ${k}px))`},[n,s,g,J]),F=e.useCallback(l=>{if(!y&&n)return;const k=l.touches[0];_.current={x:k.clientX,y:k.clientY},K.current={x:k.clientX,y:k.clientY},W.current=Date.now()},[y,n]),V=e.useCallback(l=>{if(!y||!n)return;const k=l.touches[0],I=k.clientX-_.current.x,G=k.clientY-_.current.y;let X=!1,q=0;switch(s){case"left":X=I<0,q=Math.min(0,I);break;case"right":X=I>0,q=Math.max(0,I);break;case"top":X=G<0,q=Math.min(0,G);break;case"bottom":X=G>0,q=Math.max(0,G);break}X&&Math.abs(J?I:G)>10&&(B(!0),D(q),K.current={x:k.clientX,y:k.clientY},l.preventDefault())},[y,n,s,J]),h=e.useCallback(()=>{if(!C)return;const l=Date.now()-W.current,k=Math.abs(g),I=typeof $=="number"?$:280,G=k/l;(k>I*.3||G>R)&&r(),B(!1),D(0)},[C,g,$,R,J,r]);e.useEffect(()=>{if(!N||n)return;let l=0,k=0,I=!1;const G=q=>{const se=q.touches[0];l=se.clientX,k=se.clientY;const ne=window.innerWidth,ie=window.innerHeight;switch(s){case"left":I=l<j;break;case"right":I=l>ne-j;break;case"top":I=k<j;break;case"bottom":I=k>ie-j;break}},X=q=>{if(!I)return;const se=q.touches[0],ne=se.clientX-l,ie=se.clientY-k,ae=50;let re=!1;switch(s){case"left":re=ne>ae;break;case"right":re=ne<-ae;break;case"top":re=ie>ae;break;case"bottom":re=ie<-ae;break}re&&q.preventDefault()};return document.addEventListener("touchstart",G,{passive:!0}),document.addEventListener("touchmove",X,{passive:!1}),()=>{document.removeEventListener("touchstart",G),document.removeEventListener("touchmove",X)}},[N,n,s,j]);const v=e.useCallback(l=>{H(l.id),w==null||w(l),l.href&&r()},[w,r]),x=e.useCallback(l=>{Z.current=l,typeof L=="function"?L(l):L&&(L.current=l)},[L]),a=e.useMemo(()=>({isOpen:n,position:s,close:r,activeNavId:P,setActiveNavId:H}),[n,s,r,P]);return t.jsxs(Nt.Provider,{value:a,children:[f&&c!=="persistent"&&t.jsx("div",{className:`nice-drawer-overlay ${n?"nice-drawer-overlay--visible":""}`,style:{zIndex:T-1,background:M,opacity:C?1-Math.abs(g)/(typeof $=="number"?$:280):void 0},onClick:m?r:void 0,"aria-hidden":"true"}),t.jsxs("div",{ref:x,className:`nice-drawer nice-drawer--${s} nice-drawer--${c} ${n?"nice-drawer--open":""} ${C?"nice-drawer--dragging":""} ${Y}`,style:{...E,[J?"width":"height"]:$,zIndex:T,transform:z()},onTouchStart:F,onTouchMove:V,onTouchEnd:h,role:"dialog","aria-modal":c!=="persistent","aria-label":O,"aria-hidden":!n,children:[u&&t.jsxs("div",{className:"nice-drawer-header",children:[u,t.jsx("button",{className:"nice-drawer-close",onClick:r,"aria-label":"Close drawer",children:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),t.jsx("div",{className:"nice-drawer-content",children:d?t.jsx("nav",{className:"nice-drawer-nav","aria-label":"Main navigation",children:d.map(l=>t.jsx(Mt,{item:l,onSelect:v,activeId:P},l.id))}):o}),b&&t.jsx("div",{className:"nice-drawer-footer",children:b})]})]})});Tt.displayName="NiceMobileDrawer";function wn(n={}){const{defaultOpen:r=!1,onOpenChange:s}=n,[c,i]=e.useState(r),o=e.useCallback(()=>{i(!0),s==null||s(!0)},[s]),d=e.useCallback(()=>{i(!1),s==null||s(!1)},[s]),u=e.useCallback(()=>{i(N=>{const y=!N;return s==null||s(y),y})},[s]),b=e.useCallback(N=>{i(N),s==null||s(N)},[s]);return{isOpen:c,open:o,close:d,toggle:u,setOpen:b}}const kn={home:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),settings:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),user:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),search:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),inbox:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),t.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]}),heart:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),folder:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),help:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),t.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),logout:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),t.jsx("polyline",{points:"16 17 21 12 16 7"}),t.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})},Rt=e.createContext(null);function jn(){const n=e.useContext(Rt);if(!n)throw new Error("useMobileModal must be used within a NiceMobileModal");return n}function Nn(n={}){const{defaultOpen:r=!1,open:s,onOpenChange:c,preventDismiss:i=!1}=n,[o,d]=e.useState(r),u=s!==void 0,b=u?s:o,N=e.useCallback((f,m)=>{!f&&i&&m!=="close"||(u||d(f),c==null||c(f,m))},[u,c,i]),y=e.useCallback(()=>N(!0),[N]),j=e.useCallback(f=>N(!1,f),[N]),R=e.useCallback(()=>N(!b),[N,b]);return{open:b,openModal:y,closeModal:j,toggle:R,setOpen:f=>N(f)}}const Mn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});function Tn(n,r,s){return n==="content"?Math.min(s,r):n==="full"?r:n<=1?r*n:Math.min(n,r)}function Rn(n,r,s){return Math.min(Math.max(n,r),s)}const _e=e.forwardRef(function({open:r,onClose:s,title:c,children:i,footer:o,snapPoints:d=["content"],defaultSnapPoint:u=0,showHandle:b=!0,showClose:N=!0,showOverlay:y=!0,dismissOnDrag:j=!0,dismissOnOverlay:R=!0,dismissOnEscape:f=!0,preventDismiss:m=!1,onSnapChange:p,className:S="",overlayClassName:M="",headerClassName:T="",contentClassName:w="",footerClassName:A="",lockScroll:Y=!0,borderRadius:E=16,zIndex:O,style:L,...g},D){const B=`${e.useId()}-title`,P=e.useRef(null),H=e.useRef(null),Z=e.useRef(0),_=e.useRef(0),W=e.useRef(!1),[K,J]=e.useState(u),[ee,$]=e.useState(0),[z,F]=e.useState(400),[V,h]=e.useState(typeof window<"u"?window.innerHeight:800),[v,x]=e.useState(!1),a=d.map(U=>Tn(U,V,z));e.useEffect(()=>{if(typeof window>"u")return;const U=()=>{h(window.innerHeight)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),e.useEffect(()=>{if(!H.current||!r)return;const U=new ResizeObserver(Q=>{for(const te of Q){const ce=te.contentRect.height+100;F(Math.min(ce,V*.9))}});return U.observe(H.current),()=>U.disconnect()},[r,V]),e.useEffect(()=>{if(r){const U=a[u]||a[0]||V*.5;$(U),J(u)}},[r]),e.useEffect(()=>{if(r&&!v){const U=a[K]||a[0];$(U)}},[a.join(","),K,v,r]),e.useEffect(()=>{if(!Y||!r)return;const U=document.body.style.overflow,Q=document.body.style.paddingRight,te=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",te>0&&(document.body.style.paddingRight=`${te}px`),()=>{document.body.style.overflow=U,document.body.style.paddingRight=Q}},[r,Y]),e.useEffect(()=>{if(!r||!f||m)return;const U=Q=>{Q.key==="Escape"&&(s==null||s("escape"))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[r,f,m,s]),e.useEffect(()=>{if(!r||!P.current)return;const Q=P.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),te=Q[0],ce=Q[Q.length-1],ue=de=>{de.key==="Tab"&&(de.shiftKey?document.activeElement===te&&(de.preventDefault(),ce==null||ce.focus()):document.activeElement===ce&&(de.preventDefault(),te==null||te.focus()))};return document.addEventListener("keydown",ue),requestAnimationFrame(()=>{te==null||te.focus()}),()=>document.removeEventListener("keydown",ue)},[r]);const l=e.useCallback(U=>{m&&U!=="close"||s==null||s(U)},[m,s]),k=e.useCallback(()=>{R&&l("overlay")},[R,l]),I=e.useCallback((U,Q)=>{if(Q>.5&&j&&!m)return-1;if(Q<-.5)return a.length-1;let te=0,ce=Math.abs(a[0]-U);for(let ue=1;ue<a.length;ue++){const de=Math.abs(a[ue]-U);de<ce&&(ce=de,te=ue)}return te},[a,j,m]),G=e.useCallback(U=>{W.current=!0,Z.current=U,_.current=ee,x(!0)},[ee]),X=e.useCallback(U=>{if(!W.current)return;const Q=Z.current-U,te=Rn(_.current+Q,50,V);$(te)},[V]),q=e.useCallback((U,Q)=>{if(!W.current)return;W.current=!1,x(!1);const te=I(ee,Q);if(te===-1){l("drag");return}J(te),$(a[te]),p==null||p(te,d[te])},[ee,I,l,a,d,p]),se=U=>{G(U.touches[0].clientY)},ne=U=>{X(U.touches[0].clientY)},ie=U=>{const Q=U.changedTouches[0],te=(Z.current-Q.clientY)/(U.timeStamp-(U.timeStamp-200));q(Q.clientY,te>0?-te/1e3:te/1e3)},ae=U=>{U.preventDefault(),G(U.clientY);const Q=ce=>{X(ce.clientY)},te=ce=>{const ue=(Z.current-ce.clientY)/200;q(ce.clientY,ue>0?-ue/500:ue/500),document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",te)};document.addEventListener("mousemove",Q),document.addEventListener("mouseup",te)},re=e.useCallback(U=>{U<0||U>=a.length||(J(U),$(a[U]),p==null||p(U,d[U]))},[a,d,p]),oe={isOpen:r,snapPoints:d,currentSnapIndex:K,setSnapIndex:re,close:l};return r?t.jsxs(t.Fragment,{children:[y&&t.jsx("div",{className:`nice-mobile-modal-overlay nice-mobile-modal-overlay--visible ${M}`,onClick:k,"aria-hidden":"true",style:{zIndex:O?O-1:void 0}}),t.jsx(Rt.Provider,{value:oe,children:t.jsxs("div",{ref:U=>{P.current=U,typeof D=="function"?D(U):D&&(D.current=U)},role:"dialog","aria-modal":"true","aria-labelledby":c?B:void 0,className:`nice-modal-sheet ${v?"nice-modal-sheet--dragging":""} ${S}`,style:{height:ee,borderTopLeftRadius:E,borderTopRightRadius:E,zIndex:O,...L},...g,children:[b&&t.jsx("div",{className:"nice-modal-handle-area",onTouchStart:se,onTouchMove:ne,onTouchEnd:ie,onMouseDown:ae,children:t.jsx("div",{className:"nice-modal-handle"})}),(c||N)&&t.jsxs("div",{className:`nice-modal-header ${T}`,children:[c&&t.jsx("h2",{id:B,className:"nice-modal-title",children:c}),N&&!m&&t.jsx("button",{type:"button",className:"nice-modal-close",onClick:()=>l("close"),"aria-label":"Close modal",children:t.jsx(Mn,{})})]}),t.jsx("div",{ref:H,className:`nice-modal-content ${w}`,children:i}),o&&t.jsx("div",{className:`nice-modal-footer ${A}`,children:o})]})})]}):null}),Dn=e.forwardRef(function({actions:r,cancelLabel:s="Cancel",onClose:c,...i},o){return t.jsx(_e,{ref:o,onClose:c,showHandle:!0,showClose:!1,snapPoints:["content"],...i,children:t.jsxs("div",{className:"nice-action-sheet",children:[r.map(d=>t.jsxs("button",{type:"button",className:`nice-action-sheet-item ${d.destructive?"nice-action-sheet-item--destructive":""}`,disabled:d.disabled,onClick:()=>{var u;(u=d.onClick)==null||u.call(d),c==null||c("close")},children:[d.icon&&t.jsx("span",{className:"nice-action-sheet-icon",children:d.icon}),d.label]},d.id)),t.jsx("div",{className:"nice-action-sheet-divider"}),t.jsx("button",{type:"button",className:"nice-action-sheet-item nice-action-sheet-item--cancel",onClick:()=>c==null?void 0:c("close"),children:s})]})})}),Sn=e.forwardRef(function({title:r,message:s,confirmLabel:c="Confirm",cancelLabel:i="Cancel",confirmDestructive:o=!1,onConfirm:d,onCancel:u,onClose:b,...N},y){const j=()=>{d==null||d(),b==null||b("close")},R=()=>{u==null||u(),b==null||b("close")};return t.jsx(_e,{ref:y,title:r,onClose:b,showHandle:!0,snapPoints:["content"],footer:t.jsxs("div",{className:"nice-confirm-sheet-buttons",children:[t.jsx("button",{type:"button",className:"nice-confirm-sheet-btn nice-confirm-sheet-btn--cancel",onClick:R,children:i}),t.jsx("button",{type:"button",className:`nice-confirm-sheet-btn nice-confirm-sheet-btn--confirm ${o?"nice-confirm-sheet-btn--destructive":""}`,onClick:j,children:c})]}),...N,children:t.jsx("div",{className:"nice-confirm-sheet-message",children:s})})}),Dt=e.createContext(null);function Cn(){const n=e.useContext(Dt);if(!n)throw new Error("useMobileTabs must be used within a NiceMobileTabs");return n}function Pn(n){var j;const{tabs:r,defaultTab:s,activeTab:c,onChange:i}=n,[o,d]=e.useState(s||((j=r[0])==null?void 0:j.id)||""),u=c!==void 0,b=u?c:o,N=e.useCallback(R=>{const f=r.find(m=>m.id===R);!f||f.disabled||(u||d(R),i==null||i(R))},[r,u,i]),y=e.useCallback(R=>b===R,[b]);return{activeTab:b,setActiveTab:N,tabs:r,isActive:y}}const le={home:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),homeFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})}),search:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),plus:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),heart:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),heartFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})}),user:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),userFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})}),bell:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),t.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),bellFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"})}),cart:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"9",cy:"21",r:"1"}),t.jsx("circle",{cx:"20",cy:"21",r:"1"}),t.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]}),inbox:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),t.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]}),settings:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),more:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"19",cy:"12",r:"1"}),t.jsx("circle",{cx:"5",cy:"12",r:"1"})]})},ct=({content:n,variant:r="count",color:s})=>{if(n===void 0||n===!1)return null;if(n===!0||r==="dot")return t.jsx("span",{className:"nice-tab-badge nice-tab-badge--dot",style:s?{backgroundColor:s}:void 0});const c=typeof n=="number"&&n>99?"99+":n;return t.jsx("span",{className:"nice-tab-badge nice-tab-badge--count",style:s?{backgroundColor:s}:void 0,children:c})},it=({tab:n,isActive:r,showLabel:s,animation:c,activeColor:i,inactiveColor:o,onClick:d})=>{const u=e.useRef(null);e.useEffect(()=>{if(!u.current||c==="none")return;const y=u.current;c==="scale"&&r&&(y.style.transform="scale(1.2)",setTimeout(()=>{y.style.transform="scale(1)"},150))},[r,c]);const b=r&&n.activeIcon?n.activeIcon:n.icon,N={};return r&&i?N.color=i:!r&&o&&(N.color=o),n.href?t.jsxs("a",{href:n.href,className:`nice-tab-button ${r?"nice-tab-button--active":""} ${n.disabled?"nice-tab-button--disabled":""} ${n.className||""}`,style:N,"aria-current":r?"page":void 0,onClick:y=>{var j;if(n.disabled){y.preventDefault();return}(j=n.onClick)==null||j.call(n),d()},children:[t.jsx("span",{ref:u,className:"nice-tab-icon",children:b}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(ct,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]}):t.jsxs("button",{type:"button",className:`nice-tab-button ${r?"nice-tab-button--active":""} ${n.disabled?"nice-tab-button--disabled":""} ${n.className||""}`,style:N,disabled:n.disabled,"aria-pressed":r,onClick:()=>{var y;(y=n.onClick)==null||y.call(n),d()},children:[t.jsx("span",{ref:u,className:"nice-tab-icon",children:b}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(ct,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]})},$n=e.forwardRef(function({tabs:r,activeTab:s,defaultTab:c,onChange:i,showLabels:o=!0,showAllLabels:d=!0,position:u="bottom",variant:b="default",haptic:N=!0,animation:y="scale",maxTabs:j,moreLabel:R="More",moreIcon:f=le.more,safeArea:m=!0,activeColor:p,inactiveColor:S,backgroundColor:M,hideOnScroll:T="none",lockScroll:w=!0,className:A="",style:Y,...E},O){var ee;const[L,g]=e.useState(c||((ee=r[0])==null?void 0:ee.id)||""),[D,C]=e.useState(!1),B=e.useRef(0),P=s!==void 0,H=P?s:L;e.useEffect(()=>{if(T==="none"||typeof window>"u")return;const $=()=>{const z=window.scrollY,F=z>B.current?"down":"up";F===T&&z>50?C(!0):F!==T&&C(!1),B.current=z};return window.addEventListener("scroll",$,{passive:!0}),()=>window.removeEventListener("scroll",$)},[T]);const Z=e.useCallback($=>{const z=r.find(F=>F.id===$);!z||z.disabled||(N&&"vibrate"in navigator&&navigator.vibrate(10),P||g($),i==null||i($))},[r,N,P,i]),_=j&&r.length>j?r.slice(0,j-1):r,W=j&&r.length>j?r.slice(j-1):[],K={activeTab:H,setActiveTab:Z,tabs:r},J={...Y};return M&&(J.backgroundColor=M),t.jsx(Dt.Provider,{value:K,children:t.jsxs("nav",{ref:O,className:`nice-mobile-tabs nice-mobile-tabs--${u} nice-mobile-tabs--${b} ${m?"nice-mobile-tabs--safe-area":""} ${D?"nice-mobile-tabs--hidden":""} ${A}`,style:J,role:"tablist","aria-label":"Main navigation",...E,children:[_.map($=>{const z=$.id===H,F=d||o&&z;return t.jsx(it,{tab:$,isActive:z,showLabel:F,animation:y,activeColor:p,inactiveColor:S,onClick:()=>Z($.id)},$.id)}),W.length>0&&t.jsx(it,{tab:{id:"__more__",label:R,icon:f,badge:W.some($=>$.badge)?!0:void 0},isActive:W.some($=>$.id===H),showLabel:d||o,animation:y,activeColor:p,inactiveColor:S,onClick:()=>{console.log("Open more menu",W)}})]})})}),In={basic:[{id:"home",label:"Home",icon:le.home,activeIcon:le.homeFilled},{id:"search",label:"Search",icon:le.search},{id:"notifications",label:"Alerts",icon:le.bell,activeIcon:le.bellFilled},{id:"profile",label:"Profile",icon:le.user,activeIcon:le.userFilled}],social:[{id:"feed",label:"Feed",icon:le.home,activeIcon:le.homeFilled},{id:"discover",label:"Discover",icon:le.search},{id:"create",label:"Create",icon:le.plus},{id:"activity",label:"Activity",icon:le.heart,activeIcon:le.heartFilled},{id:"profile",label:"Profile",icon:le.user,activeIcon:le.userFilled}],ecommerce:[{id:"shop",label:"Shop",icon:le.home,activeIcon:le.homeFilled},{id:"search",label:"Search",icon:le.search},{id:"cart",label:"Cart",icon:le.cart},{id:"favorites",label:"Wishlist",icon:le.heart,activeIcon:le.heartFilled},{id:"account",label:"Account",icon:le.user,activeIcon:le.userFilled}],messaging:[{id:"chats",label:"Chats",icon:le.inbox},{id:"calls",label:"Calls",icon:le.bell},{id:"contacts",label:"Contacts",icon:le.user,activeIcon:le.userFilled},{id:"settings",label:"Settings",icon:le.settings}]},St=e.createContext(null);function En(){const n=e.useContext(St);if(!n)throw new Error("useMobileHeader must be used within a NiceMobileHeader");return n}function Ln(n={}){const{collapsedHeight:r=56,expandedHeight:s=200,scrollElement:c,mode:i="scroll",threshold:o=0}=n,[d,u]=e.useState(0),[b,N]=e.useState(!0),y=e.useRef(null),j=e.useRef(0),R=e.useRef(!1),f=s-r,m=s-d*f,p=d>=1;e.useEffect(()=>{const T=c||y.current||window,w=()=>{R.current||(R.current=!0,requestAnimationFrame(()=>{const A=T===window?window.scrollY:T.scrollTop,Y=A-j.current;if(i==="scroll"||i==="exitUntilCollapsed"){const E=Math.min(1,Math.max(0,(A-o)/f));u(E)}if(i==="enterAlways"){Y>5&&A>o?N(!1):Y<-5&&N(!0);const E=Math.min(1,Math.max(0,A/f));u(E)}j.current=A,R.current=!1}))};return T.addEventListener("scroll",w,{passive:!0}),w(),()=>T.removeEventListener("scroll",w)},[c,i,o,f]);const S=e.useCallback(()=>{u(0),N(!0)},[]),M=e.useCallback(()=>{u(1)},[]);return{progress:d,height:m,isCollapsed:p,isVisible:b,scrollRef:y,expand:S,collapse:M}}const Bn=()=>t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"15 18 9 12 15 6"})}),Hn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),An=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),Yn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"12",cy:"5",r:"1"}),t.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Fn={back:t.jsx(Bn,{}),menu:t.jsx(Hn,{}),search:t.jsx(An,{}),more:t.jsx(Yn,{})},Vn=({action:n})=>t.jsxs("button",{type:"button",className:`nice-header-action ${n.disabled?"nice-header-action--disabled":""}`,onClick:n.onClick,disabled:n.disabled,"aria-label":n.label,title:n.label,children:[n.icon,n.badge!==void 0&&n.badge!==!1&&t.jsx("span",{className:`nice-header-badge ${n.badge===!0?"nice-header-badge--dot":""}`,children:n.badge!==!0&&n.badge})]}),Ie=e.forwardRef(function({title:r,largeTitle:s,subtitle:c,leftAction:i,rightActions:o=[],background:d,mode:u="scroll",variant:b="default",collapsedHeight:N=56,expandedHeight:y=s||d?140:56,parallax:j=!1,parallaxSpeed:R=.5,showShadow:f=!0,sticky:m=!0,zIndex:p=100,scrollElement:S,onCollapseChange:M,safeArea:T=!0,backgroundColor:w,textColor:A,showBorder:Y=!1,collapsedContent:E,expandedContent:O,className:L="",style:g,children:D,...C},B){const[P,H]=e.useState(0),[Z,_]=e.useState(!0),W=e.useRef(null),K=e.useRef(0),J=e.useRef(!1),ee=y-N,$=y-P*ee,z=P>=.9;e.useEffect(()=>{const l=S||window,k=()=>{J.current||(J.current=!0,requestAnimationFrame(()=>{const I=l===window?window.scrollY:l.scrollTop,G=I-K.current;if(u==="scroll"||u==="exitUntilCollapsed"){const X=Math.min(1,Math.max(0,I/ee));H(X),M&&Math.abs(X-P)>.05&&M(X>=.9,X)}if(u==="enterAlways"){G>5&&I>N?_(!1):G<-5&&_(!0);const X=Math.min(1,Math.max(0,I/ee));H(X)}K.current=I,J.current=!1}))};return l.addEventListener("scroll",k,{passive:!0}),k(),()=>l.removeEventListener("scroll",k)},[S,u,ee,N,M,P]);const F=1-P*2,V=P>.5?(P-.5)*2:0,h=1-P,v=j?`translateY(${P*ee*R}px) scale(${1+P*.1})`:void 0,x={height:u==="pin"?N:$,zIndex:p,...g};w&&(x.backgroundColor=w),A&&(x.color=A);const a={progress:P,isCollapsed:z,height:$,expandedHeight:y,collapsedHeight:N};return t.jsxs(St.Provider,{value:a,children:[t.jsxs("header",{ref:l=>{W.current=l,typeof B=="function"?B(l):B&&(B.current=l)},className:`
|
|
2
|
+
nice-mobile-header
|
|
3
|
+
nice-mobile-header--${b}
|
|
4
|
+
${m?"nice-mobile-header--sticky":""}
|
|
5
|
+
${z&&f?"nice-mobile-header--shadow":""}
|
|
6
|
+
${Y?"nice-mobile-header--border":""}
|
|
7
|
+
${T?"nice-mobile-header--safe-area":""}
|
|
8
|
+
${Z?"":"nice-mobile-header--hidden"}
|
|
9
|
+
${L}
|
|
10
|
+
`,style:x,role:"banner",...C,children:[d&&t.jsx("div",{className:"nice-header-background",style:{opacity:h,transform:v},children:d}),t.jsxs("div",{className:"nice-header-toolbar",style:{height:N},children:[i&&t.jsx("div",{className:"nice-header-left",children:i}),t.jsx("div",{className:"nice-header-center",style:{opacity:s?V:1},children:E||t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"nice-header-title",children:r}),c&&!s&&t.jsx("span",{className:"nice-header-subtitle",children:c})]})}),o.length>0&&t.jsx("div",{className:"nice-header-right",children:o.map(l=>t.jsx(Vn,{action:l},l.id))})]}),(s||O)&&t.jsx("div",{className:"nice-header-expanded",style:{opacity:F,visibility:F<=0?"hidden":"visible"},children:O||t.jsxs("div",{className:"nice-header-large-title-container",children:[t.jsx("h1",{className:"nice-header-large-title",children:s}),c&&t.jsx("p",{className:"nice-header-large-subtitle",children:c})]})}),D]}),m&&t.jsx("div",{className:"nice-header-spacer",style:{height:u==="pin"?N:y}})]})}),zn=e.forwardRef(function(r,s){return t.jsx(Ie,{ref:s,mode:"scroll",variant:"blur",collapsedHeight:44,expandedHeight:96,safeArea:!0,...r})}),Wn=e.forwardRef(function(r,s){return t.jsx(Ie,{ref:s,mode:"enterAlways",variant:"solid",collapsedHeight:56,expandedHeight:56,showShadow:!0,...r})}),On=e.forwardRef(function(r,s){return t.jsx(Ie,{ref:s,mode:"scroll",variant:"transparent",collapsedHeight:56,expandedHeight:280,parallax:!0,parallaxSpeed:.5,...r})}),Ct=e.createContext(null);function Un(){const n=e.useContext(Ct);if(!n)throw new Error("useMobilePicker must be used within a NiceMobilePicker");return n}function Xn(n){var T;const{items:r,defaultValue:s,value:c,onChange:i,itemHeight:o=40,visibleItems:d=5,loop:u=!1}=n,b=e.useRef(null),N=e.useRef(),y=e.useCallback(w=>{if(w===void 0)return 0;const A=r.findIndex(Y=>Y.value===w);return A>=0?A:0},[r]),[j,R]=e.useState(()=>y(c??s)),f=c!==void 0,m=f?y(c):j,p=(T=r[m])==null?void 0:T.value,S=e.useCallback((w,A=!0)=>{if(!b.current)return;const E=(u?(w%r.length+r.length)%r.length:Math.max(0,Math.min(w,r.length-1)))*o;b.current.scrollTo({top:E,behavior:A?"smooth":"auto"})},[r.length,o,d,u]),M=e.useCallback(w=>{const A=r[w];!A||A.disabled||(f||R(w),i==null||i(A.value,A))},[r,f,i]);return e.useEffect(()=>{const w=b.current;if(!w)return;const A=()=>{clearTimeout(N.current),N.current=setTimeout(()=>{const Y=w.scrollTop,E=Math.round(Y/o),O=Math.max(0,Math.min(E,r.length-1));S(O,!0),M(O)},100)};return w.addEventListener("scroll",A,{passive:!0}),()=>{w.removeEventListener("scroll",A),clearTimeout(N.current)}},[o,r.length,S,M]),e.useEffect(()=>{S(m,!1)},[]),{selectedValue:p,selectedIndex:m,setSelectedIndex:M,scrollToIndex:S,containerRef:b}}const Pt=e.forwardRef(function({items:r,value:s,defaultValue:c,onChange:i,itemHeight:o=40,visibleItems:d=5,loop:u=!1,renderItem:b,className:N="",style:y,...j},R){const f=e.useRef(null),m=e.useRef(),p=e.useRef(!1),S=e.useRef(0),M=e.useRef(0),T=e.useCallback(W=>{if(W===void 0)return 0;const K=r.findIndex(J=>J.value===W);return K>=0?K:0},[r]),[w,A]=e.useState(()=>T(s??c)),Y=s!==void 0,E=Y?T(s):w,O=Math.floor(d/2),L=o*d,g=O*o,D=e.useCallback((W,K=!0)=>{if(!f.current)return;const ee=Math.max(0,Math.min(W,r.length-1))*o;f.current.scrollTo({top:ee,behavior:K?"smooth":"auto"})},[r.length,o]),C=e.useCallback(W=>{const K=r[W];!K||K.disabled||(Y||A(W),i==null||i(K.value,K))},[r,Y,i]),B=e.useCallback(()=>{if(!f.current)return;const W=f.current.scrollTop,K=Math.round(W/o),J=Math.max(0,Math.min(K,r.length-1));D(J,!0),C(J)},[o,r.length,D,C]);e.useEffect(()=>{const W=f.current;if(!W)return;const K=()=>{clearTimeout(m.current),m.current=setTimeout(B,100)};return W.addEventListener("scroll",K,{passive:!0}),()=>{W.removeEventListener("scroll",K),clearTimeout(m.current)}},[B]),e.useEffect(()=>{D(E,!1)},[]);const P=W=>{var K;p.current=!0,S.current=W.touches[0].clientY,M.current=((K=f.current)==null?void 0:K.scrollTop)||0},H=W=>{if(!p.current||!f.current)return;const K=S.current-W.touches[0].clientY;f.current.scrollTop=M.current+K},Z=()=>{p.current=!1},_=W=>{D(W,!0),C(W)};return t.jsx("div",{ref:W=>{f.current=W,typeof R=="function"?R(W):R&&(R.current=W)},className:`nice-picker-column ${N}`,style:{height:L,...y},onTouchStart:P,onTouchMove:H,onTouchEnd:Z,...j,children:t.jsx("div",{className:"nice-picker-column-inner",style:{paddingTop:g,paddingBottom:g},children:r.map((W,K)=>{const J=K===E,ee=Math.abs(K-E),$=ee===0?1:Math.max(.3,1-ee*.25),z=ee===0?1:Math.max(.85,1-ee*.05);return t.jsx("div",{className:`nice-picker-item ${J?"nice-picker-item--selected":""} ${W.disabled?"nice-picker-item--disabled":""}`,style:{height:o,lineHeight:`${o}px`,opacity:$,transform:`scale(${z})`},onClick:()=>!W.disabled&&_(K),children:b?b(W,J):W.label},String(W.value))})})})}),qe=e.forwardRef(function({columns:r,value:s,defaultValue:c,onChange:i,itemHeight:o=40,visibleItems:d=5,loop:u=!1,showLabels:b=!1,renderItem:N,showIndicator:y=!0,indicatorClassName:j="",className:R="",style:f,...m},p){const[S,M]=e.useState(c??{}),T=s!==void 0,w=T?s:S,A=e.useCallback((L,g)=>{const D={...w,[L]:g};T||M(D),i==null||i(D,L)},[w,T,i]),Y=o*d,E=Math.floor(d/2)*o,O={visibleItems:d,itemHeight:o,isScrolling:!1};return t.jsx(Ct.Provider,{value:O,children:t.jsxs("div",{ref:p,className:`nice-mobile-picker ${R}`,style:{height:b?Y+24:Y,...f},...m,children:[b&&t.jsx("div",{className:"nice-picker-labels",children:r.map(L=>t.jsx("div",{className:"nice-picker-label",style:{width:L.width},children:L.label},L.id))}),t.jsxs("div",{className:"nice-picker-body",children:[y&&t.jsx("div",{className:`nice-picker-indicator ${j}`,style:{top:E,height:o}}),t.jsx("div",{className:"nice-picker-columns",children:r.map(L=>t.jsx(Pt,{items:L.items,value:w[L.id],onChange:g=>A(L.id,g),itemHeight:o,visibleItems:d,loop:u,renderItem:N?(g,D)=>N(g,L.id,D):void 0,style:{width:L.width,flex:L.width?"none":1}},L.id))}),t.jsx("div",{className:"nice-picker-gradient nice-picker-gradient--top"}),t.jsx("div",{className:"nice-picker-gradient nice-picker-gradient--bottom"})]})]})})});function we(n,r,s=1,c=2){const i=[];for(let o=n;o<=r;o+=s)i.push({value:o,label:String(o).padStart(c,"0")});return i}const _n=e.forwardRef(function({value:r,defaultValue:s={hour:12,minute:0},onChange:c,use24Hour:i=!1,minuteStep:o=1,...d},u){const b=e.useMemo(()=>we(i?0:1,i?23:12,1,2),[i]),N=e.useMemo(()=>we(0,59,o,2),[o]),y=[{value:"AM",label:"AM"},{value:"PM",label:"PM"}],j=[{id:"hour",items:b,width:60},{id:"minute",items:N,width:60}];i||j.push({id:"period",items:y,width:60});const R=e.useCallback(m=>{const p=m.hour,S=m.minute,M=m.period;let T=p;i||(M==="PM"&&p!==12?T=p+12:M==="AM"&&p===12&&(T=0)),c==null||c({hour:T,minute:S})},[i,c]),f=e.useMemo(()=>{if(!r)return s;if(i)return r;const m=r.hour%12||12,p=r.hour>=12?"PM":"AM";return{hour:m,minute:r.minute,period:p}},[r,s,i]);return t.jsx(qe,{ref:u,columns:j,value:f,onChange:R,...d})}),qn=["January","February","March","April","May","June","July","August","September","October","November","December"],Gn=e.forwardRef(function({value:r,defaultValue:s=new Date,onChange:c,minYear:i=new Date().getFullYear()-100,maxYear:o=new Date().getFullYear()+10,...d},u){const b=e.useMemo(()=>we(1,31,1,2),[]),N=e.useMemo(()=>qn.map((m,p)=>({value:p,label:m})),[]),y=e.useMemo(()=>we(i,o,1,4),[i,o]),j=[{id:"day",items:b,width:60},{id:"month",items:N,flex:1},{id:"year",items:y,width:80}],R=e.useCallback(m=>{const p=m.day,S=m.month,M=m.year,T=new Date(M,S+1,0).getDate(),w=Math.min(p,T);c==null||c(new Date(M,S,w))},[c]),f=e.useMemo(()=>{const m=r??s;return{day:m.getDate(),month:m.getMonth(),year:m.getFullYear()}},[r,s]);return t.jsx(qe,{ref:u,columns:j,value:f,onChange:R,...d})}),$t=e.createContext(null);function Kn(){const n=e.useContext($t);if(!n)throw new Error("useMobileCalendar must be used within a NiceMobileCalendar");return n}const Jn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],It=["January","February","March","April","May","June","July","August","September","October","November","December"],Qn=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ve(n,r){return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()&&n.getDate()===r.getDate()}function Zn(n,r,s){if(!r||!s)return!1;const c=n.getTime();return c>=r.getTime()&&c<=s.getTime()}function er(n){const r=new Date(Date.UTC(n.getFullYear(),n.getMonth(),n.getDate())),s=r.getUTCDay()||7;r.setUTCDate(r.getUTCDate()+4-s);const c=new Date(Date.UTC(r.getUTCFullYear(),0,1));return Math.ceil(((r.getTime()-c.getTime())/864e5+1)/7)}function Se(n,r){const s=new Date(n);return s.setMonth(s.getMonth()+r),s}function at(n,r){const s=new Date(n);return s.setFullYear(s.getFullYear()+r),s}function Et(n={}){const{defaultDate:r=new Date,selectedDate:s,selectedDates:c,selectedRange:i,selectionMode:o="single",minDate:d,maxDate:u,disabledDates:b=[],events:N=[],weekStartDay:y=0,onChange:j}=n,[R,f]=e.useState(r),[m,p]=e.useState("day"),[S,M]=e.useState(null),[T,w]=e.useState([]),[A,Y]=e.useState({start:null,end:null}),E=s??S,O=c??T,L=i??A,g=e.useCallback($=>d&&$<d||u&&$>u?!0:b.some(z=>ve(z,$)),[d,u,b]),D=e.useCallback($=>o==="single"&&E?ve($,E):o==="multiple"?O.some(z=>ve(z,$)):!!(o==="range"&&(L.start&&ve($,L.start)||L.end&&ve($,L.end))),[o,E,O,L]),C=e.useCallback($=>{if(!g($)){if(o==="single")M($),j==null||j($);else if(o==="multiple"){const F=T.some(V=>ve(V,$))?T.filter(V=>!ve(V,$)):[...T,$];w(F),j==null||j(F)}else if(o==="range")if(!A.start||A.start&&A.end){const z={start:$,end:null};Y(z),j==null||j(z)}else{const z=$<A.start?{start:$,end:A.start}:{start:A.start,end:$};Y(z),j==null||j(z)}}},[o,T,A,g,j]),B=e.useCallback($=>f($),[]),P=e.useCallback(()=>f($=>Se($,-1)),[]),H=e.useCallback(()=>f($=>Se($,1)),[]),Z=e.useCallback(()=>f($=>at($,-1)),[]),_=e.useCallback(()=>f($=>at($,1)),[]),W=e.useCallback(()=>f(new Date),[]),K=e.useCallback(()=>{const $=R.getFullYear(),z=R.getMonth(),F=new Date,h=(new Date($,z,1).getDay()-y+7)%7,v=42,x=[];for(let a=0;a<v;a++){const l=new Date($,z,1-h+a),k=l.getMonth()===z,I=l.getDate(),G=N.filter(X=>ve(X.date,l));x.push({date:l,dayOfMonth:I,isCurrentMonth:k,isToday:ve(l,F),isSelected:D(l),isInRange:Zn(l,L.start,L.end),isRangeStart:L.start?ve(l,L.start):!1,isRangeEnd:L.end?ve(l,L.end):!1,isDisabled:g(l),isWeekend:l.getDay()===0||l.getDay()===6,events:G.length>0?G:void 0})}return x},[R,y,N,D,L,g]),J=e.useCallback(()=>It.map(($,z)=>({month:z,label:$})),[]),ee=e.useCallback(()=>{const $=R.getFullYear(),z=[];for(let F=$-50;F<=$+50;F++)z.push(F);return z},[R]);return{viewDate:R,selectedDate:E,selectedDates:O,selectedRange:L,view:m,setView:p,goToDate:B,goToPrevMonth:P,goToNextMonth:H,goToPrevYear:Z,goToNextYear:_,goToToday:W,selectDate:C,isDateSelected:D,isDateDisabled:g,getDaysInMonth:K,getMonths:J,getYears:ee}}const tr=()=>t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"15 18 9 12 15 6"})}),nr=()=>t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"9 18 15 12 9 6"})}),rr=({cell:n,compact:r,onClick:s,renderDay:c})=>c?t.jsx(t.Fragment,{children:c(n)}):t.jsxs("button",{type:"button",className:`
|
|
11
|
+
nice-calendar-day
|
|
12
|
+
${n.isCurrentMonth?"":"nice-calendar-day--other-month"}
|
|
13
|
+
${n.isToday?"nice-calendar-day--today":""}
|
|
14
|
+
${n.isSelected?"nice-calendar-day--selected":""}
|
|
15
|
+
${n.isInRange?"nice-calendar-day--in-range":""}
|
|
16
|
+
${n.isRangeStart?"nice-calendar-day--range-start":""}
|
|
17
|
+
${n.isRangeEnd?"nice-calendar-day--range-end":""}
|
|
18
|
+
${n.isDisabled?"nice-calendar-day--disabled":""}
|
|
19
|
+
${n.isWeekend?"nice-calendar-day--weekend":""}
|
|
20
|
+
`,disabled:n.isDisabled,onClick:s,"aria-label":n.date.toLocaleDateString(),"aria-pressed":n.isSelected,children:[t.jsx("span",{className:"nice-calendar-day-number",children:n.dayOfMonth}),n.events&&n.events.length>0&&!r&&t.jsx("span",{className:"nice-calendar-day-dots",children:n.events.slice(0,3).map((i,o)=>t.jsx("span",{className:"nice-calendar-day-dot",style:i.color?{backgroundColor:i.color}:void 0},i.id))})]}),Ge=e.forwardRef(function({defaultDate:r,viewDate:s,selectedDate:c,selectedDates:i,selectedRange:o,selectionMode:d="single",minDate:u,maxDate:b,disabledDates:N=[],disableWeekends:y=!1,events:j=[],weekStartDay:R=0,locale:f="en-US",showWeekNumbers:m=!1,showAdjacentMonths:p=!0,enableSwipe:S=!0,onChange:M,onViewChange:T,onMonthChange:w,renderDay:A,renderHeader:Y,showTodayButton:E=!0,todayLabel:O="Today",compact:L=!1,className:g="",...D},C){const B=e.useMemo(()=>N,[N,y]),P=Et({defaultDate:r,selectedDate:c,selectedDates:i,selectedRange:o,selectionMode:d,minDate:u,maxDate:b,disabledDates:B,events:j,weekStartDay:R,onChange:M}),[H,Z]=e.useState(s??r??new Date),_=e.useRef(0),W=e.useRef(0);e.useEffect(()=>{s&&Z(s)},[s]);const K=e.useCallback(()=>{const a=Se(H,-1);Z(a),P.goToDate(a),w==null||w(a),T==null||T(a,P.view)},[H,P,w,T]),J=e.useCallback(()=>{const a=Se(H,1);Z(a),P.goToDate(a),w==null||w(a),T==null||T(a,P.view)},[H,P,w,T]),ee=e.useCallback(()=>{const a=new Date;Z(a),P.goToDate(a),w==null||w(a)},[P,w]),$=e.useCallback(a=>{S&&(_.current=a.touches[0].clientX)},[S]),z=e.useCallback(a=>{S&&(W.current=a.touches[0].clientX)},[S]),F=e.useCallback(()=>{if(!S)return;const a=_.current-W.current;Math.abs(a)>50&&(a>0?J():K())},[S,J,K]),V=e.useCallback(a=>{y&&(a.getDay()===0||a.getDay()===6)||P.selectDate(a)},[P,y]),h=e.useMemo(()=>{const a=[...Jn];return[...a.slice(R),...a.slice(0,R)]},[R]),v=P.getDaysInMonth(),x={viewDate:H,selectedDate:P.selectedDate,selectedDates:P.selectedDates,selectedRange:P.selectedRange,selectionMode:d,view:P.view,selectDate:V,setView:P.setView,goToDate:P.goToDate};return t.jsx($t.Provider,{value:x,children:t.jsxs("div",{ref:C,className:`nice-mobile-calendar ${L?"nice-mobile-calendar--compact":""} ${g}`,onTouchStart:$,onTouchMove:z,onTouchEnd:F,...D,children:[Y?Y(H,P.view,{prev:K,next:J,setView:P.setView}):t.jsxs("div",{className:"nice-calendar-header",children:[t.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:K,"aria-label":"Previous month",children:t.jsx(tr,{})}),t.jsxs("button",{type:"button",className:"nice-calendar-title-btn",onClick:()=>P.setView(P.view==="day"?"month":"day"),children:[t.jsx("span",{className:"nice-calendar-month",children:It[H.getMonth()]}),t.jsx("span",{className:"nice-calendar-year",children:H.getFullYear()})]}),t.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:J,"aria-label":"Next month",children:t.jsx(nr,{})})]}),P.view==="day"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`nice-calendar-weekdays ${m?"nice-calendar-weekdays--with-numbers":""}`,children:[m&&t.jsx("div",{className:"nice-calendar-weekday nice-calendar-weekday--number",children:"W"}),h.map((a,l)=>t.jsx("div",{className:"nice-calendar-weekday",children:L?a.charAt(0):a},a))]}),t.jsx("div",{className:`nice-calendar-grid ${m?"nice-calendar-grid--with-numbers":""}`,children:v.map((a,l)=>{const k=m&&l%7===0;return t.jsxs(e.Fragment,{children:[k&&t.jsx("div",{className:"nice-calendar-week-number",children:er(a.date)}),!a.isCurrentMonth&&!p?t.jsx("div",{className:"nice-calendar-day nice-calendar-day--empty"}):t.jsx(rr,{cell:{...a,isDisabled:a.isDisabled||y&&a.isWeekend},compact:L,onClick:()=>V(a.date),renderDay:A})]},a.date.toISOString())})})]}),P.view==="month"&&t.jsx("div",{className:"nice-calendar-months",children:P.getMonths().map(({month:a,label:l})=>t.jsx("button",{type:"button",className:`nice-calendar-month-btn ${a===H.getMonth()?"nice-calendar-month-btn--selected":""}`,onClick:()=>{const k=new Date(H.getFullYear(),a,1);Z(k),P.goToDate(k),P.setView("day")},children:L?Qn[a]:l},a))}),P.view==="year"&&t.jsx("div",{className:"nice-calendar-years",children:P.getYears().map(a=>t.jsx("button",{type:"button",className:`nice-calendar-year-btn ${a===H.getFullYear()?"nice-calendar-year-btn--selected":""}`,onClick:()=>{const l=new Date(a,H.getMonth(),1);Z(l),P.goToDate(l),P.setView("month")},children:a},a))}),E&&P.view==="day"&&t.jsx("div",{className:"nice-calendar-footer",children:t.jsx("button",{type:"button",className:"nice-calendar-today-btn",onClick:ee,children:O})})]})})}),sr=e.forwardRef(function(r,s){return t.jsx(Ge,{ref:s,selectionMode:"range",...r})}),cr=e.forwardRef(function(r,s){return t.jsx(Ge,{ref:s,selectionMode:"multiple",...r})}),Lt=e.createContext(null);function ir(){const n=e.useContext(Lt);if(!n)throw new Error("useGesturesContext must be used within a NiceGestures");return n}function ge(n,r){const s=r.x-n.x,c=r.y-n.y;return Math.sqrt(s*s+c*c)}function lt(n,r){return Math.atan2(r.y-n.y,r.x-n.x)*(180/Math.PI)}function Ye(n,r){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}function Fe(n){const r=Math.abs(n.x),s=Math.abs(n.y);return r<5&&s<5?null:r>s?n.x>0?"right":"left":n.y>0?"down":"up"}function Bt(n={}){const{enablePinch:r=!0,enableRotation:s=!0,enablePan:c=!0,enableSwipe:i=!0,enableTap:o=!0,enableDoubleTap:d=!0,enableLongPress:u=!0,minScale:b=.5,maxScale:N=4,panThreshold:y=5,swipeVelocityThreshold:j=.5,swipeDistanceThreshold:R=50,longPressDuration:f=500,doubleTapDelay:m=300,onPinchStart:p,onPinch:S,onPinchEnd:M,onRotateStart:T,onRotate:w,onRotateEnd:A,onPanStart:Y,onPan:E,onPanEnd:O,onSwipe:L,onTap:g,onDoubleTap:D,onLongPress:C}=n,[B,P]=e.useState({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),H=e.useRef(new Map),Z=e.useRef(0),_=e.useRef(0),W=e.useRef(1),K=e.useRef(0),J=e.useRef({x:0,y:0}),ee=e.useRef(0),$=e.useRef({x:0,y:0}),z=e.useRef(0),F=e.useRef({x:0,y:0}),V=e.useRef(0),h=e.useRef(null),v=e.useRef(!1),x=e.useRef(!1),a=e.useRef(!1),l=e.useCallback(()=>{h.current&&(clearTimeout(h.current),h.current=null)},[]),k=e.useCallback(()=>{P({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),W.current=1,K.current=0,J.current={x:0,y:0}},[]),I=e.useCallback(ne=>{ne.currentTarget.setPointerCapture(ne.pointerId),H.current.set(ne.pointerId,{x:ne.clientX,y:ne.clientY});const ie=H.current.size;if(ie===1)z.current=Date.now(),F.current={x:ne.clientX,y:ne.clientY},$.current={x:ne.clientX,y:ne.clientY},ee.current=Date.now(),u&&(l(),h.current=setTimeout(()=>{C==null||C({position:{x:ne.clientX,y:ne.clientY},duration:f,target:ne.target})},f));else if(ie===2){l();const[ae,re]=Array.from(H.current.values());Z.current=ge(ae,re),_.current=lt(ae,re),W.current=B.scale,K.current=B.rotation,r&&!x.current&&(x.current=!0,p==null||p()),s&&!a.current&&(a.current=!0,T==null||T())}P(ae=>({...ae,isActive:!0}))},[B.scale,B.rotation,u,r,s,f,C,p,T,l]),G=e.useCallback(ne=>{if(!H.current.has(ne.pointerId))return;H.current.set(ne.pointerId,{x:ne.clientX,y:ne.clientY});const ie=H.current.size,ae=Date.now();if(ie===1){const re={x:ne.clientX,y:ne.clientY},oe={x:re.x-$.current.x,y:re.y-$.current.y},U={x:re.x-F.current.x,y:re.y-F.current.y};if(ge(F.current,re)>y&&(l(),c)){v.current||(v.current=!0,Y==null||Y());const te=ae-ee.current,ce=te>0?{x:oe.x/te*1e3,y:oe.y/te*1e3}:{x:0,y:0},ue={x:J.current.x+U.x,y:J.current.y+U.y};P(de=>({...de,translation:ue,velocity:ce,center:re})),E==null||E({translation:ue,delta:oe,velocity:ce,center:re,direction:Fe(oe)})}$.current=re,ee.current=ae}else if(ie===2){const[re,oe]=Array.from(H.current.values()),U=ge(re,oe),Q=lt(re,oe),te=Ye(re,oe);if(r){const ce=Math.max(b,Math.min(N,W.current*(U/Z.current))),ue=ce-B.scale;P(de=>({...de,scale:ce,center:te})),S==null||S({scale:ce,deltaScale:ue,center:te,distance:U,initialDistance:Z.current})}if(s){let ce=Q-_.current;ce>180&&(ce-=360),ce<-180&&(ce+=360);const ue=K.current+ce,de=ue-B.rotation;P(fe=>({...fe,rotation:ue,center:te})),w==null||w({rotation:ue,deltaRotation:de,center:te})}}},[c,r,s,b,N,y,B.scale,B.rotation,E,Y,S,w,l]),X=e.useCallback(ne=>{ne.currentTarget.releasePointerCapture(ne.pointerId),l();const ie=H.current.size,ae=Date.now();if(ie===1){const re={x:ne.clientX,y:ne.clientY},oe=ge(F.current,re),U=ae-z.current;if(oe<y)d&&ae-V.current<m?(D==null||D({position:re,target:ne.target}),V.current=0):o&&(setTimeout(()=>{V.current===ae&&(g==null||g({position:re,target:ne.target}))},m),V.current=ae);else{const Q=oe/U*1e3;if(i&&Q>j&&oe>R){const te={x:re.x-F.current.x,y:re.y-F.current.y},ce=Fe(te);ce&&(L==null||L({direction:ce,velocity:Q,distance:oe,duration:U}))}if(v.current){const te=ae-ee.current,ce={x:re.x-$.current.x,y:re.y-$.current.y},ue=te>0?{x:ce.x/te*1e3,y:ce.y/te*1e3}:{x:0,y:0};O==null||O({translation:B.translation,delta:ce,velocity:ue,center:re,direction:Fe(ce)})}}J.current=B.translation}if(ie===2){if(x.current){const[re,oe]=Array.from(H.current.values()),U=Ye(re,oe);M==null||M({scale:B.scale,deltaScale:0,center:U,distance:ge(re,oe),initialDistance:Z.current})}if(a.current){const[re,oe]=Array.from(H.current.values()),U=Ye(re,oe);A==null||A({rotation:B.rotation,deltaRotation:0,center:U})}}H.current.delete(ne.pointerId),H.current.size===0&&(v.current=!1,x.current=!1,a.current=!1,P(re=>({...re,isActive:!1})))},[o,d,i,m,y,j,R,B.scale,B.rotation,B.translation,g,D,L,O,M,A,l]),q=e.useCallback(ne=>{l(),H.current.delete(ne.pointerId),H.current.size===0&&(v.current=!1,x.current=!1,a.current=!1,P(ie=>({...ie,isActive:!1})))},[l]),se=e.useCallback(()=>({onPointerDown:I,onPointerMove:G,onPointerUp:X,onPointerCancel:q,style:{touchAction:"none"}}),[I,G,X,q]);return e.useEffect(()=>()=>{l()},[l]),{bind:se,state:B,reset:k}}const Ee=e.forwardRef(function({enablePinch:r=!0,enableRotation:s=!0,enablePan:c=!0,enableSwipe:i=!0,enableTap:o=!0,enableDoubleTap:d=!0,enableLongPress:u=!0,minScale:b=.5,maxScale:N=4,applyTransform:y=!1,initialScale:j=1,scale:R,initialRotation:f=0,rotation:m,initialTranslation:p={x:0,y:0},translation:S,onTransformChange:M,onPinchStart:T,onPinch:w,onPinchEnd:A,onRotateStart:Y,onRotate:E,onRotateEnd:O,onPanStart:L,onPan:g,onPanEnd:D,onSwipe:C,onTap:B,onDoubleTap:P,onLongPress:H,children:Z,className:_="",style:W,...K},J){const ee=Bt({enablePinch:r,enableRotation:s,enablePan:c,enableSwipe:i,enableTap:o,enableDoubleTap:d,enableLongPress:u,minScale:b,maxScale:N,onPinchStart:T,onPinch:l=>{w==null||w(l),M==null||M(ee.state)},onPinchEnd:A,onRotateStart:Y,onRotate:l=>{E==null||E(l),M==null||M(ee.state)},onRotateEnd:O,onPanStart:L,onPan:l=>{g==null||g(l),M==null||M(ee.state)},onPanEnd:D,onSwipe:C,onTap:B,onDoubleTap:P,onLongPress:H}),{bind:$,state:z}=ee,F=$(),V=R??z.scale,h=m??z.rotation,v=S??z.translation,x=y?{transform:`translate(${v.x}px, ${v.y}px) scale(${V}) rotate(${h}deg)`,transformOrigin:`${z.center.x}px ${z.center.y}px`}:{},a={state:{...z,scale:V,rotation:h,translation:v},reset:ee.reset};return t.jsx(Lt.Provider,{value:a,children:t.jsx("div",{ref:J,className:`nice-gestures ${z.isActive?"nice-gestures--active":""} ${_}`,style:{...F.style,...W,...x},onPointerDown:F.onPointerDown,onPointerMove:F.onPointerMove,onPointerUp:F.onPointerUp,onPointerCancel:F.onPointerCancel,...K,children:Z})})}),ar=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,enablePinch:!0,enableRotation:!1,enablePan:!1,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...r})}),lr=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,enablePinch:!1,enableRotation:!1,enablePan:!0,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...r})}),or=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,enablePinch:!1,enableRotation:!1,enablePan:!1,enableSwipe:!0,enableTap:!1,enableLongPress:!1,...r})}),Ke={selection:10,"impact-light":15,"impact-medium":30,"impact-heavy":50,"notification-success":[30,50,30],"notification-warning":[50,30,50,30],"notification-error":[50,50,100],"button-press":20,"toggle-on":[15,30,15],"toggle-off":[15,50],swipe:15,"pull-to-refresh":[10,20,30],keyboard:5},ur={light:.5,medium:1,heavy:1.5};function pe(){return typeof navigator<"u"&&"vibrate"in navigator}function dr(n,r){return typeof n=="number"?Math.round(n*r):n.map(s=>Math.round(s*r))}function fr(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const Ht=e.createContext(null);function hr(){const n=e.useContext(Ht);if(!n)throw new Error("useHapticsContext must be used within a NiceHapticsProvider");return n}function xe(n={}){const{enabled:r=!0,intensity:s="medium",customPatterns:c={}}=n,i=e.useRef(r),[o,d]=e.useState(r),u=e.useMemo(()=>pe(),[]),b=e.useCallback(m=>{i.current=m,d(m)},[]),N=e.useCallback(()=>ur[s],[s]),y=e.useCallback((m=50)=>{if(!u||!i.current)return!1;try{const p=dr(m,N());return navigator.vibrate(p)}catch{return!1}},[u,N]),j=e.useCallback(()=>{u&&navigator.vibrate(0)},[u]),R=e.useCallback(m=>{if(!u||!i.current)return!1;const p=Ke[m];return p?y(p):!1},[u,y]),f=e.useCallback(m=>{if(!u||!i.current)return!1;const p=c[m];return p?y(p):!1},[u,c,y]);return{isSupported:u,isEnabled:o,setEnabled:b,vibrate:y,cancel:j,trigger:R,triggerPattern:f,getIntensityMultiplier:N}}function vr({enabled:n=!0,intensity:r="medium",respectReducedMotion:s=!0,customPatterns:c={},children:i}){const o=e.useMemo(()=>s&&fr()?!1:n,[n,s]),d=xe({enabled:o,intensity:r,customPatterns:c});return e.useEffect(()=>{if(!s)return;const u=window.matchMedia("(prefers-reduced-motion: reduce)"),b=N=>{d.setEnabled(!N.matches&&n)};return u.addEventListener("change",b),()=>u.removeEventListener("change",b)},[s,n,d]),t.jsx(Ht.Provider,{value:d,children:i})}function br(n=50){if(!pe())return!1;try{return navigator.vibrate(n)}catch{return!1}}function mr(n){if(!pe())return!1;const r=Ke[n];if(!r)return!1;try{return navigator.vibrate(r)}catch{return!1}}function xr(){pe()&&navigator.vibrate(0)}function pr(n){return function(s){const c=xe();return t.jsx(n,{...s,haptics:c})}}function gr(){const n=xe();return e.useCallback(()=>{n.trigger("button-press")},[n])}function yr(){const n=xe();return e.useCallback(r=>{n.trigger(r?"toggle-on":"toggle-off")},[n])}function wr(){const n=xe();return e.useCallback(()=>{n.trigger("selection")},[n])}function kr(){const n=xe();return e.useCallback(r=>{n.trigger(`notification-${r}`)},[n])}function jr(){const n=xe();return e.useCallback((r="medium")=>{n.trigger(`impact-${r}`)},[n])}class At{constructor(){Ze(this,"pattern",[])}vibrate(r){return this.pattern.push(r),this}pause(r){return this.pattern.push(0),this.pattern.push(r),this}pulses(r,s,c){for(let i=0;i<r;i++)this.vibrate(s),i<r-1&&this.pause(c);return this}rampUp(r,s){for(let c=1;c<=r;c++){const i=Math.round(s/r*c);this.vibrate(i),c<r&&this.pause(50)}return this}rampDown(r,s){for(let c=r;c>=1;c--){const i=Math.round(s/r*c);this.vibrate(i),c>1&&this.pause(50)}return this}build(){return[...this.pattern]}execute(){return pe()?navigator.vibrate(this.pattern):!1}}function Nr(){return new At}const Le={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ce=["xs","sm","md","lg","xl","2xl"];function ze(n,r){return n>=r["2xl"]?"2xl":n>=r.xl?"xl":n>=r.lg?"lg":n>=r.md?"md":n>=r.sm?"sm":"xs"}function ot(n){return n==="xs"||n==="sm"?"mobile":n==="md"?"tablet":"desktop"}function ut(n,r){return n>=r?"landscape":"portrait"}function We(){return typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0}function be(n){return Ce.indexOf(n)}function Mr(n,r){let s=null;return(...c)=>{s&&clearTimeout(s),s=setTimeout(()=>n(...c),r)}}const Yt=e.createContext(null);function Tr(){const n=e.useContext(Yt);if(!n)throw new Error("useBreakpointContext must be used within a NiceBreakpointProvider");return n}function ke(n={}){const{breakpoints:r,debounceDelay:s=100,ssrDefaultWidth:c=1024}=n,i=e.useMemo(()=>({...Le,...r}),[r]),[o,d]=e.useState(()=>{const f=typeof window<"u"?window.innerWidth:c,m=typeof window<"u"?window.innerHeight:768,p=ze(f,i),S=ot(p),M=ut(f,m);return{width:f,height:m,breakpoint:p,deviceType:S,orientation:M,isMobile:S==="mobile",isTablet:S==="tablet",isDesktop:S==="desktop",isPortrait:M==="portrait",isLandscape:M==="landscape",isTouchDevice:We(),pixelRatio:typeof window<"u"?window.devicePixelRatio:1}});e.useEffect(()=>{if(typeof window>"u")return;const f=()=>{const p=window.innerWidth,S=window.innerHeight,M=ze(p,i),T=ot(M),w=ut(p,S);d({width:p,height:S,breakpoint:M,deviceType:T,orientation:w,isMobile:T==="mobile",isTablet:T==="tablet",isDesktop:T==="desktop",isPortrait:w==="portrait",isLandscape:w==="landscape",isTouchDevice:We(),pixelRatio:window.devicePixelRatio})},m=Mr(f,s);return f(),window.addEventListener("resize",m),window.addEventListener("orientationchange",f),()=>{window.removeEventListener("resize",m),window.removeEventListener("orientationchange",f)}},[i,s]);const u=e.useCallback(f=>o.breakpoint===f,[o.breakpoint]),b=e.useCallback(f=>{const m=be(o.breakpoint),p=be(f);return m>=p},[o.breakpoint]),N=e.useCallback(f=>{const m=be(o.breakpoint),p=be(f);return m<p},[o.breakpoint]),y=e.useCallback((f,m)=>{const p=be(o.breakpoint),S=be(f),M=be(m);return p>=S&&p<=M},[o.breakpoint]),j=e.useCallback((f,m)=>{const p=be(o.breakpoint);for(let S=p;S>=0;S--){const M=Ce[S];if(f[M]!==void 0)return f[M]}return f.base??m},[o.breakpoint]),R=e.useCallback((f,m="min")=>{const p=i[f],S=be(f),M=Ce[S+1],T=M?i[M]-1:null;return m==="min"?`(min-width: ${p}px)`:m==="max"&&T?`(max-width: ${T}px)`:m==="only"?T?`(min-width: ${p}px) and (max-width: ${T}px)`:`(min-width: ${p}px)`:`(min-width: ${p}px)`},[i]);return{...o,is:u,isAbove:b,isBelow:N,isBetween:y,getResponsive:j,mediaQuery:R}}function Ft(n){const[r,s]=e.useState(()=>typeof window>"u"?!1:window.matchMedia(n).matches);return e.useEffect(()=>{if(typeof window>"u")return;const c=window.matchMedia(n);s(c.matches);const i=o=>s(o.matches);return c.addEventListener("change",i),()=>c.removeEventListener("change",i)},[n]),r}function Rr({breakpoints:n,debounceDelay:r=100,children:s}){const c=ke({breakpoints:n,debounceDelay:r});return t.jsx(Yt.Provider,{value:c,children:s})}function Dr({on:n,above:r,below:s,device:c,orientation:i,children:o,fallback:d=null}){const u=ke();let b=!0;return n!==void 0?b=u.is(n):r!==void 0?b=u.isAbove(r):s!==void 0&&(b=u.isBelow(s)),c!==void 0&&(b=b&&u.deviceType===c),i!==void 0&&(b=b&&u.orientation===i),b?t.jsx(t.Fragment,{children:o}):t.jsx(t.Fragment,{children:d})}function Sr({on:n,above:r,below:s,device:c,orientation:i,children:o}){const d=ke();let u=!1;return n!==void 0?u=d.is(n):r!==void 0?u=d.isAbove(r):s!==void 0&&(u=d.isBelow(s)),c!==void 0&&(u=u||d.deviceType===c),i!==void 0&&(u=u||d.orientation===i),u?null:t.jsx(t.Fragment,{children:o})}function Cr(n,r="min",s=Le){const c=s[n],i=be(n),o=Ce[i+1],d=o?s[o]-1:null;return r==="min"?`@media (min-width: ${c}px)`:r==="max"&&d?`@media (max-width: ${d}px)`:r==="only"?d?`@media (min-width: ${c}px) and (max-width: ${d}px)`:`@media (min-width: ${c}px)`:`@media (min-width: ${c}px)`}function Pr(n){return n}function Vt(n=Le){return typeof window>"u"?null:ze(window.innerWidth,n)}function $r(){if(typeof window>"u")return!1;const n=Vt();return n==="xs"||n==="sm"}function Ir(){return We()}const Er={sm:"nice-touch-btn--sm",md:"nice-touch-btn--md",lg:"nice-touch-btn--lg",xl:"nice-touch-btn--xl"},Lr={primary:"nice-touch-btn--primary",secondary:"nice-touch-btn--secondary",outline:"nice-touch-btn--outline",ghost:"nice-touch-btn--ghost",danger:"nice-touch-btn--danger",success:"nice-touch-btn--success",warning:"nice-touch-btn--warning"},Br={rounded:"nice-touch-btn--rounded",pill:"nice-touch-btn--pill",square:"nice-touch-btn--square",circle:"nice-touch-btn--circle"},Je=e.forwardRef(function({variant:r="primary",size:s="md",shape:c="rounded",fullWidth:i=!1,loading:o=!1,leftIcon:d,rightIcon:u,iconOnly:b=!1,haptic:N=!0,hapticIntensity:y="light",ripple:j=!0,active:R=!1,disabled:f,className:m="",onClick:p,onPointerDown:S,children:M,...T},w){const[A,Y]=e.useState(!1),[E,O]=e.useState(null),L=e.useRef(null),g=e.useCallback(_=>{L.current=_,typeof w=="function"?w(_):w&&(w.current=_)},[w]),D=e.useCallback(()=>{if(!N||typeof navigator>"u"||!("vibrate"in navigator))return;const _={light:10,medium:20,heavy:40};try{navigator.vibrate(_[y]||10)}catch{}},[N,y]),C=e.useCallback(_=>{if(!(f||o)){if(Y(!0),j&&L.current){const W=L.current.getBoundingClientRect();O({x:_.clientX-W.left,y:_.clientY-W.top}),setTimeout(()=>O(null),600)}D(),S==null||S(_)}},[f,o,j,D,S]),B=e.useCallback(()=>{Y(!1)},[]),P=e.useCallback(()=>{Y(!1)},[]),H=e.useCallback(_=>{f||o||p==null||p(_)},[f,o,p]),Z=["nice-touch-btn",Lr[r],Er[s],Br[c],i?"nice-touch-btn--full-width":"",o?"nice-touch-btn--loading":"",b?"nice-touch-btn--icon-only":"",A?"nice-touch-btn--pressed":"",R?"nice-touch-btn--active":"",m].filter(Boolean).join(" ");return t.jsxs("button",{ref:g,type:"button",className:Z,disabled:f||o,onClick:H,onPointerDown:C,onPointerUp:B,onPointerLeave:P,onPointerCancel:P,...T,children:[j&&E&&t.jsx("span",{className:"nice-touch-btn-ripple",style:{left:E.x,top:E.y}}),o&&t.jsx("span",{className:"nice-touch-btn-spinner","aria-hidden":"true",children:t.jsx("svg",{viewBox:"0 0 24 24",className:"nice-touch-btn-spinner-svg",children:t.jsx("circle",{cx:"12",cy:"12",r:"10",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeDasharray:"32",strokeDashoffset:"32"})})}),t.jsxs("span",{className:"nice-touch-btn-content",style:{opacity:o?0:1},children:[d&&t.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--left",children:d}),!b&&M&&t.jsx("span",{className:"nice-touch-btn-text",children:M}),u&&t.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--right",children:u})]})]})}),Hr=e.forwardRef(function({icon:r,...s},c){return t.jsx(Je,{ref:c,iconOnly:!0,leftIcon:r,...s})}),Ar=e.forwardRef(function({position:r="bottom-right",mini:s=!1,className:c="",...i},o){const d=`nice-fab--${r}`;return t.jsx(Je,{ref:o,shape:"circle",size:s?"md":"xl",className:`nice-fab ${d} ${c}`,...i})});function zt(n){const{min:r,max:s,step:c,value:i,defaultValue:o=r,onChange:d,onChangeCommitted:u}=n,[b,N]=e.useState(o),y=i??b,j=Array.isArray(y),R=e.useCallback(T=>Math.min(s,Math.max(r,T)),[r,s]),f=e.useCallback(T=>{const w=Math.round((T-r)/c)*c+r;return R(w)},[r,c,R]),m=e.useMemo(()=>{const T=s-r;if(j){const[w,A]=y;return[(w-r)/T*100,(A-r)/T*100]}return(y-r)/T*100},[y,r,s,j]),p=e.useCallback(T=>{if(Array.isArray(T)){const[w,A]=T,Y=[f(w),f(A)];Y[0]>Y[1]&&([Y[0],Y[1]]=[Y[1],Y[0]]),N(Y),d==null||d(Y)}else{const w=f(T);N(w),d==null||d(w)}},[f,d]),S=e.useCallback((T,w)=>{const A=s-r,Y=T/100*A+r;if(j&&typeof w=="number"){const O=[...y];O[w]=f(Y),p(O)}else p(Y)},[s,r,j,y,f,p]),M=e.useCallback(()=>{u==null||u(y)},[y,u]);return{value:y,isRange:j,percentage:m,setValue:p,setValueByPercentage:S,commitValue:M,clamp:R,snap:f}}const Yr=e.forwardRef(function({value:r,defaultValue:s,min:c=0,max:i=100,step:o=1,orientation:d="horizontal",disabled:u=!1,marks:b=!1,markStep:N,labelDisplay:y="auto",formatLabel:j=D=>String(D),showRange:R=!1,trackColor:f,fillColor:m,thumbSize:p=44,trackHeight:S=8,haptic:M=!0,snapToMarks:T=!1,onChange:w,onChangeCommitted:A,className:Y="","aria-label":E,"aria-labelledby":O,...L},g){const D=zt({min:c,max:i,step:o,value:r,defaultValue:s,onChange:w,onChangeCommitted:A}),C=e.useRef(null),[B,P]=e.useState(!1),[H,Z]=e.useState(null),[_,W]=e.useState(y==="on"),K=e.useRef(D.value),J=e.useMemo(()=>{if(!b)return[];if(Array.isArray(b))return b;const l=[],k=N??o;for(let I=c;I<=i;I+=k)l.push({value:I});return l},[b,N,o,c,i]),ee=e.useCallback(l=>{if(!C.current)return 0;const k=C.current.getBoundingClientRect();if(d==="horizontal"){const I=l.clientX-k.left;return Math.max(0,Math.min(100,I/k.width*100))}else{const I=l.clientY-k.top;return Math.max(0,Math.min(100,100-I/k.height*100))}},[d]),$=e.useCallback(()=>{if(!(!M||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[M]),z=e.useCallback(l=>{if(!D.isRange)return 0;const[k,I]=D.percentage,G=Math.abs(l-k),X=Math.abs(l-I);return G<=X?0:1},[D.isRange,D.percentage]),F=e.useCallback((l,k)=>{if(u)return;l.preventDefault(),l.currentTarget.setPointerCapture(l.pointerId);const I=ee(l),G=k??z(I);if(P(!0),Z(G),W(y!=="off"),T&&J.length>0){const X=J.reduce((q,se)=>{const ne=(q.value-c)/(i-c)*100,ie=(se.value-c)/(i-c)*100;return Math.abs(ie-I)<Math.abs(ne-I)?se:q});D.setValue(D.isRange?G===0?[X.value,D.value[1]]:[D.value[0],X.value]:X.value)}else D.setValueByPercentage(I,G);$()},[u,ee,z,y,T,J,c,i,D,$]),V=e.useCallback(l=>{var I;if(!B||u||H===null)return;const k=ee(l);if(T&&J.length>0){const G=J.reduce((q,se)=>{const ne=(q.value-c)/(i-c)*100,ie=(se.value-c)/(i-c)*100;return Math.abs(ie-k)<Math.abs(ne-k)?se:q}),X=D.isRange?H===0?[G.value,D.value[1]]:[D.value[0],G.value]:G.value;JSON.stringify(X)!==JSON.stringify(K.current)&&(D.setValue(X),K.current=X,$())}else{D.setValueByPercentage(k,H);const G=D.isRange?D.value[H]:D.value,X=D.isRange?(I=K.current)==null?void 0:I[H]:K.current;Math.abs(G-X)>=o&&($(),K.current=D.value)}},[B,u,H,ee,T,J,c,i,D,o,$]),h=e.useCallback(l=>{B&&(l.currentTarget.releasePointerCapture(l.pointerId),P(!1),Z(null),y==="auto"&&W(!1),D.commitValue())},[B,y,D]),v=e.useCallback((l,k)=>{if(u)return;let I=D.isRange?D.value[k]:D.value;switch(l.key){case"ArrowRight":case"ArrowUp":l.preventDefault(),I=Math.min(i,I+o);break;case"ArrowLeft":case"ArrowDown":l.preventDefault(),I=Math.max(c,I-o);break;case"Home":l.preventDefault(),I=c;break;case"End":l.preventDefault(),I=i;break;case"PageUp":l.preventDefault(),I=Math.min(i,I+o*10);break;case"PageDown":l.preventDefault(),I=Math.max(c,I-o*10);break;default:return}if(D.isRange){const G=D.value;D.setValue(k===0?[I,G[1]]:[G[0],I])}else D.setValue(I);$(),D.commitValue()},[u,D,i,c,o,$]),x=e.useMemo(()=>{if(D.isRange){const[k,I]=D.percentage;return d==="horizontal"?{left:`${k}%`,width:`${I-k}%`}:{bottom:`${k}%`,height:`${I-k}%`}}const l=D.percentage;return d==="horizontal"?{left:0,width:`${l}%`}:{bottom:0,height:`${l}%`}},[D.isRange,D.percentage,d]),a=(l,k)=>{const I=D.isRange?D.value[l]:D.value,G=d==="horizontal"?{left:`${k}%`}:{bottom:`${k}%`};return t.jsx("div",{className:`nice-touch-slider-thumb ${H===l?"nice-touch-slider-thumb--active":""}`,style:{...G,width:p,height:p},role:"slider",tabIndex:u?-1:0,"aria-label":E,"aria-labelledby":O,"aria-valuenow":I,"aria-valuemin":c,"aria-valuemax":i,"aria-disabled":u,onKeyDown:X=>v(X,l),children:_&&t.jsx("span",{className:"nice-touch-slider-label",children:j(I)})},l)};return t.jsxs("div",{ref:g,className:`
|
|
21
|
+
nice-touch-slider
|
|
22
|
+
nice-touch-slider--${d}
|
|
23
|
+
${u?"nice-touch-slider--disabled":""}
|
|
24
|
+
${B?"nice-touch-slider--dragging":""}
|
|
25
|
+
${Y}
|
|
26
|
+
`,style:{"--thumb-size":`${p}px`,"--track-height":`${S}px`,...f?{"--track-color":f}:{},...m?{"--fill-color":m}:{}},...L,children:[R&&t.jsx("span",{className:"nice-touch-slider-min",children:j(c)}),t.jsxs("div",{ref:C,className:"nice-touch-slider-track-container",onPointerDown:F,onPointerMove:V,onPointerUp:h,onPointerCancel:h,children:[t.jsx("div",{className:"nice-touch-slider-track"}),t.jsx("div",{className:"nice-touch-slider-fill",style:x}),J.length>0&&t.jsx("div",{className:"nice-touch-slider-marks",children:J.map(l=>{const k=(l.value-c)/(i-c)*100,I=d==="horizontal"?{left:`${k}%`}:{bottom:`${k}%`};return t.jsxs("div",{className:"nice-touch-slider-mark",style:I,children:[t.jsx("span",{className:"nice-touch-slider-mark-dot"}),l.label&&t.jsx("span",{className:"nice-touch-slider-mark-label",children:l.label})]},l.value)})}),D.isRange?t.jsxs(t.Fragment,{children:[a(0,D.percentage[0]),a(1,D.percentage[1])]}):a(0,D.percentage)]}),R&&t.jsx("span",{className:"nice-touch-slider-max",children:j(i)})]})});function Be(n,r,s){r/=100,s/=100;const c=(1-Math.abs(2*s-1))*r,i=c*(1-Math.abs(n/60%2-1)),o=s-c/2;let d=0,u=0,b=0;return n>=0&&n<60?(d=c,u=i,b=0):n>=60&&n<120?(d=i,u=c,b=0):n>=120&&n<180?(d=0,u=c,b=i):n>=180&&n<240?(d=0,u=i,b=c):n>=240&&n<300?(d=i,u=0,b=c):(d=c,u=0,b=i),{r:Math.round((d+o)*255),g:Math.round((u+o)*255),b:Math.round((b+o)*255)}}function Wt(n,r,s){n/=255,r/=255,s/=255;const c=Math.max(n,r,s),i=Math.min(n,r,s),o=(c+i)/2;let d=0,u=0;if(c!==i){const b=c-i;switch(u=o>.5?b/(2-c-i):b/(c+i),c){case n:d=((r-s)/b+(r<s?6:0))*60;break;case r:d=((s-n)/b+2)*60;break;case s:d=((n-r)/b+4)*60;break}}return{h:Math.round(d),s:Math.round(u*100),l:Math.round(o*100)}}function Ot(n){const r=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return r?{r:parseInt(r[1],16),g:parseInt(r[2],16),b:parseInt(r[3],16)}:{r:0,g:0,b:0}}function Ut(n,r,s){return"#"+[n,r,s].map(c=>c.toString(16).padStart(2,"0")).join("")}function ye(n){const r=Ot(n);return Wt(r.r,r.g,r.b)}function Pe(n,r,s){const c=Be(n,r,s);return Ut(c.r,c.g,c.b)}function Oe(n,r){switch(r){case"hsl":return`hsl(${n.h}, ${n.s}%, ${n.l}%)`;case"rgb":{const s=Be(n.h,n.s,n.l);return`rgb(${s.r}, ${s.g}, ${s.b})`}case"hex":default:return Pe(n.h,n.s,n.l)}}const Fr=e.forwardRef(function({value:r,defaultValue:s="var(--color-accent, #6366f1)",format:c="hex",showAlpha:i=!1,showPreview:o=!0,showInput:d=!0,presetColors:u,wheelSize:b=240,haptic:N=!0,onChange:y,presetLabel:j="Presets",className:R="",...f},m){const[p,S]=e.useState(()=>ye(r||s)),[M,T]=e.useState(r||s),[w,A]=e.useState(1),Y=e.useRef(null),E=e.useRef(null),O=e.useRef(!1),L=e.useRef(!1);e.useEffect(()=>{if(r){const h=ye(r);S(h),T(r)}},[r]);const g=e.useCallback(()=>{if(!(!N||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[N]),D=e.useCallback(h=>{const v=Oe(h,c);T(c==="hex"?v:Pe(h.h,h.s,h.l)),y==null||y(v)},[c,y]);e.useEffect(()=>{const h=Y.current;if(!h)return;const v=h.getContext("2d");if(!v)return;const x=b,a=x/2,l=a-10,k=l-30;h.width=x,h.height=x;for(let I=0;I<360;I++){const G=(I-1)*Math.PI/180,X=(I+1)*Math.PI/180;v.beginPath(),v.arc(a,a,l,G,X),v.arc(a,a,k,X,G,!0),v.closePath(),v.fillStyle=`hsl(${I}, 100%, 50%)`,v.fill()}},[b]),e.useEffect(()=>{const h=E.current;if(!h)return;const v=h.getContext("2d");if(!v)return;const x=b*.5;h.width=x,h.height=x;const a=v.createImageData(x,x);for(let l=0;l<x;l++)for(let k=0;k<x;k++){const I=k/x*100,G=100-l/x*100,X=Be(p.h,I,G),q=(l*x+k)*4;a.data[q]=X.r,a.data[q+1]=X.g,a.data[q+2]=X.b,a.data[q+3]=255}v.putImageData(a,0,0)},[p.h,b]);const C=e.useCallback(h=>{const v=Y.current;if(!v)return;const x=v.getBoundingClientRect(),a=h.clientX-x.left-x.width/2,l=h.clientY-x.top-x.height/2;let k=Math.atan2(l,a)*(180/Math.PI)+90;k<0&&(k+=360);const I={...p,h:Math.round(k)};S(I),D(I),g()},[p,D,g]),B=e.useCallback(h=>{const v=E.current;if(!v)return;const x=v.getBoundingClientRect(),a=Math.max(0,Math.min(x.width,h.clientX-x.left)),l=Math.max(0,Math.min(x.height,h.clientY-x.top)),k=Math.round(a/x.width*100),I=Math.round(100-l/x.height*100),G={...p,s:k,l:I};S(G),D(G),g()},[p,D,g]),P=e.useCallback(h=>{h.currentTarget.setPointerCapture(h.pointerId),O.current=!0,C(h)},[C]),H=e.useCallback(h=>{O.current&&C(h)},[C]),Z=e.useCallback(h=>{h.currentTarget.releasePointerCapture(h.pointerId),O.current=!1},[]),_=e.useCallback(h=>{h.currentTarget.setPointerCapture(h.pointerId),L.current=!0,B(h)},[B]),W=e.useCallback(h=>{L.current&&B(h)},[B]),K=e.useCallback(h=>{h.currentTarget.releasePointerCapture(h.pointerId),L.current=!1},[]),J=e.useCallback(h=>{const v=h.target.value;if(T(v),/^#?[0-9a-f]{6}$/i.test(v)){const x=v.startsWith("#")?v:`#${v}`,a=ye(x);S(a),y==null||y(Oe(a,c))}},[c,y]),ee=e.useCallback(h=>{const v=ye(h);S(v),D(v),g()},[D,g]),$=e.useMemo(()=>{const h=b/2,v=h-25,x=(p.h-90)*Math.PI/180;return{x:h+v*Math.cos(x),y:h+v*Math.sin(x)}},[p.h,b]),z=b*.5,F=e.useMemo(()=>({x:p.s/100*z,y:(1-p.l/100)*z}),[p.s,p.l,z]),V=e.useMemo(()=>Pe(p.h,p.s,p.l),[p]);return t.jsxs("div",{ref:m,className:`nice-touch-color-picker ${R}`,...f,children:[t.jsxs("div",{className:"nice-touch-color-picker-wheel-container",style:{width:b,height:b},children:[t.jsx("canvas",{ref:Y,className:"nice-touch-color-picker-wheel",onPointerDown:P,onPointerMove:H,onPointerUp:Z,onPointerCancel:Z}),t.jsx("div",{className:"nice-touch-color-picker-hue-indicator",style:{left:$.x,top:$.y,backgroundColor:`hsl(${p.h}, 100%, 50%)`}}),t.jsxs("div",{className:"nice-touch-color-picker-sl-container",style:{width:z,height:z},children:[t.jsx("canvas",{ref:E,className:"nice-touch-color-picker-sl",onPointerDown:_,onPointerMove:W,onPointerUp:K,onPointerCancel:K}),t.jsx("div",{className:"nice-touch-color-picker-sl-indicator",style:{left:F.x,top:F.y,backgroundColor:V}})]})]}),t.jsxs("div",{className:"nice-touch-color-picker-controls",children:[o&&t.jsx("div",{className:"nice-touch-color-picker-preview",style:{backgroundColor:V}}),d&&t.jsx("input",{type:"text",className:"nice-touch-color-picker-input",value:M,onChange:J,placeholder:"#000000"})]}),i&&t.jsx("div",{className:"nice-touch-color-picker-alpha",children:t.jsx("input",{type:"range",min:"0",max:"100",value:w*100,onChange:h=>A(Number(h.target.value)/100),className:"nice-touch-color-picker-alpha-slider",style:{background:`linear-gradient(to right, transparent, ${V})`}})}),u&&u.length>0&&t.jsxs("div",{className:"nice-touch-color-picker-presets",children:[t.jsx("span",{className:"nice-touch-color-picker-presets-label",children:j}),t.jsx("div",{className:"nice-touch-color-picker-presets-grid",children:u.map((h,v)=>t.jsx("button",{type:"button",className:`nice-touch-color-picker-preset ${h.toLowerCase()===V.toLowerCase()?"nice-touch-color-picker-preset--selected":""}`,style:{backgroundColor:h},onClick:()=>ee(h),"aria-label":`Select color ${h}`},v))})]})]})}),Vr={hslToRgb:Be,rgbToHsl:Wt,hexToRgb:Ot,rgbToHex:Ut,hexToHsl:ye,hslToHex:Pe,formatColor:Oe};function zr(n,r){return Math.sqrt(Math.pow(r.x-n.x,2)+Math.pow(r.y-n.y,2))}function dt(n,r){const s=r.time-n.time||1;return zr(n,r)/s}const Xt=e.forwardRef(function({width:r="100%",height:s=200,strokeColor:c="var(--text-primary, #1f2937)",strokeWidth:i=2,minWidth:o=.5,maxWidth:d=4,velocityFilterWeight:u=.7,backgroundColor:b="var(--bg-primary, #ffffff)",showGuideline:N=!0,guidelineColor:y="var(--border-color, #e5e7eb)",disabled:j=!1,penPressure:R=!0,haptic:f=!0,placeholder:m="Sign here",onChange:p,onBegin:S,onEnd:M,className:T="",...w},A){const Y=e.useRef(null),E=e.useRef(null),[O,L]=e.useState(!0),[g,D]=e.useState(!1),C=e.useRef([]),B=e.useRef([]),P=e.useRef([]),H=e.useRef(0),Z=e.useRef(i);e.useEffect(()=>{const v=Y.current;if(!v)return;const x=v.getBoundingClientRect(),a=window.devicePixelRatio||1;v.width=x.width*a,v.height=x.height*a;const l=v.getContext("2d");l&&(l.scale(a,a),E.current=l,W())},[]);const _=e.useCallback(()=>{if(!(!f||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[f]),W=e.useCallback(()=>{const v=Y.current,x=E.current;if(!v||!x)return;const a=v.getBoundingClientRect();x.fillStyle=b,x.fillRect(0,0,a.width,a.height),N&&(x.strokeStyle=y,x.lineWidth=1,x.setLineDash([5,5]),x.beginPath(),x.moveTo(20,a.height*.7),x.lineTo(a.width-20,a.height*.7),x.stroke(),x.setLineDash([]))},[b,N,y]),K=e.useCallback(()=>{W();const v=E.current;v&&B.current.forEach(x=>{if(!(x.length<2)){v.strokeStyle=c,v.fillStyle=c,v.lineCap="round",v.lineJoin="round";for(let a=1;a<x.length;a++){const l=x[a-1],k=x[a],I=dt(l,k),G=Math.max(o,Math.min(d,d/(I+1)));v.lineWidth=G,v.beginPath(),v.moveTo(l.x,l.y),v.lineTo(k.x,k.y),v.stroke()}}})},[W,c,o,d]),J=e.useCallback(v=>Math.max(o,d/(v*10+1)),[o,d]),ee=e.useCallback(v=>{const x=E.current;x&&(x.fillStyle=c,x.beginPath(),x.arc(v.x,v.y,i/2,0,Math.PI*2),x.fill())},[c,i]),$=e.useCallback((v,x,a)=>{const l=E.current;l&&(l.strokeStyle=c,l.lineWidth=a,l.lineCap="round",l.lineJoin="round",l.beginPath(),l.moveTo(v.x,v.y),l.lineTo(x.x,x.y),l.stroke())},[c]),z=e.useCallback(v=>{const x=Y.current;if(!x)return{x:0,y:0,time:Date.now()};const a=x.getBoundingClientRect();return{x:v.clientX-a.left,y:v.clientY-a.top,pressure:R?v.pressure:void 0,time:Date.now()}},[R]),F=e.useCallback(v=>{if(j)return;v.preventDefault(),v.currentTarget.setPointerCapture(v.pointerId),D(!0);const x=z(v);C.current=[x],H.current=0,Z.current=i,P.current=[],ee(x),S==null||S(),_()},[j,z,i,ee,S,_]),V=e.useCallback(v=>{if(!g||j)return;const x=z(v),a=C.current;if(a.length===0)return;const l=a[a.length-1],k=dt(l,x),I=u*k+(1-u)*H.current,G=J(I),X=(Z.current+G)/2,q=x.pressure!==void 0?X*Math.max(.5,x.pressure):X;$(l,x,q),a.push(x),H.current=I,Z.current=G},[g,j,z,u,J,$]),h=e.useCallback(v=>{g&&(v.currentTarget.releasePointerCapture(v.pointerId),D(!1),C.current.length>0&&(B.current.push([...C.current]),C.current=[],L(!1),p==null||p(!1)),M==null||M())},[g,p,M]);return e.useImperativeHandle(A,()=>({clear:()=>{B.current=[],P.current=[],C.current=[],W(),L(!0),p==null||p(!0)},isEmpty:()=>O,toData:()=>[...B.current],fromData:v=>{B.current=v,P.current=[],L(v.length===0),K(),p==null||p(v.length===0)},toDataURL:(v="png",x=1)=>{const a=Y.current;if(!a)return"";if(v==="svg"){const k=a.getBoundingClientRect();let I="";B.current.forEach(X=>{if(X.length<2)return;let q=`M ${X[0].x} ${X[0].y}`;for(let se=1;se<X.length;se++)q+=` L ${X[se].x} ${X[se].y}`;I+=`<path d="${q}" stroke="${c}" stroke-width="${i}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`});const G=`<svg xmlns="http://www.w3.org/2000/svg" width="${k.width}" height="${k.height}" viewBox="0 0 ${k.width} ${k.height}">${I}</svg>`;return`data:image/svg+xml;base64,${btoa(G)}`}if(v==="json")return`data:application/json;base64,${btoa(JSON.stringify(B.current))}`;const l=v==="jpeg"?"image/jpeg":"image/png";return a.toDataURL(l,x)},toSVG:()=>{const v=Y.current;if(!v)return"";const x=v.getBoundingClientRect();let a="";return B.current.forEach(l=>{if(l.length<2)return;let k=`M ${l[0].x} ${l[0].y}`;for(let I=1;I<l.length;I++)k+=` L ${l[I].x} ${l[I].y}`;a+=`<path d="${k}" stroke="${c}" stroke-width="${i}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`}),`<svg xmlns="http://www.w3.org/2000/svg" width="${x.width}" height="${x.height}" viewBox="0 0 ${x.width} ${x.height}">${a}</svg>`},toBlob:(v="png",x=1)=>new Promise(a=>{const l=Y.current;if(!l){a(null);return}const k=v==="jpeg"?"image/jpeg":"image/png";l.toBlob(a,k,x)}),undo:()=>{if(B.current.length===0)return;const v=B.current.pop();v&&P.current.push(v);const x=B.current.length===0;L(x),K(),p==null||p(x)},redo:()=>{if(P.current.length===0)return;const v=P.current.pop();v&&B.current.push(v),L(!1),K(),p==null||p(!1)}}),[O,W,K,c,i,p]),t.jsxs("div",{className:`nice-signature-pad ${j?"nice-signature-pad--disabled":""} ${T}`,...w,children:[t.jsx("canvas",{ref:Y,className:"nice-signature-pad-canvas",style:{width:r,height:s,backgroundColor:b,touchAction:"none"},onPointerDown:F,onPointerMove:V,onPointerUp:h,onPointerCancel:h,onPointerLeave:h}),O&&m&&t.jsx("div",{className:"nice-signature-pad-placeholder",children:m})]})}),Wr=e.forwardRef(function({width:r="100%",height:s=300,backgroundColor:c="var(--bg-primary, #ffffff)",strokeColor:i="var(--text-primary, #1f2937)",strokeWidth:o=4,tool:d="pen",lineCap:u="round",opacity:b=1,penPressure:N=!0,haptic:y=!0,maxHistory:j=50,disabled:R=!1,onChange:f,onToolChange:m,className:p="",...S},M){const T=e.useRef(null),w=e.useRef(null),[A,Y]=e.useState(!1),[E,O]=e.useState(d),L=e.useRef([]),g=e.useRef(-1),D=e.useRef(null),C=e.useRef(null),B=e.useRef(null);e.useEffect(()=>{O(d)},[d]),e.useEffect(()=>{const h=T.current;if(!h)return;const v=h.getBoundingClientRect(),x=window.devicePixelRatio||1;h.width=v.width*x,h.height=v.height*x;const a=h.getContext("2d",{willReadFrequently:!0});a&&(a.scale(x,x),w.current=a,a.fillStyle=c,a.fillRect(0,0,v.width,v.height),P())},[c]);const P=e.useCallback(()=>{const h=T.current,v=w.current;if(!h||!v)return;const x=h.getBoundingClientRect(),a=v.getImageData(0,0,x.width,x.height);g.current<L.current.length-1&&(L.current=L.current.slice(0,g.current+1)),L.current.push({type:"stroke",imageData:a}),L.current.length>j&&L.current.shift(),g.current=L.current.length-1},[j]),H=e.useCallback(h=>{const v=w.current;if(!v||h<0||h>=L.current.length)return;const x=L.current[h];v.putImageData(x.imageData,0,0)},[]),Z=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[y]),_=e.useCallback(h=>{const v=T.current;if(!v)return{x:0,y:0};const x=v.getBoundingClientRect();return{x:h.clientX-x.left,y:h.clientY-x.top,pressure:N?h.pressure:void 0}},[N]),W=e.useCallback(()=>{const h=w.current;h&&(h.lineCap=u,h.lineJoin="round",h.globalAlpha=b,E==="eraser"?(h.globalCompositeOperation="destination-out",h.strokeStyle="rgba(0,0,0,1)",h.lineWidth=o*2):E==="brush"?(h.globalCompositeOperation="source-over",h.strokeStyle=i,h.lineWidth=o):E==="marker"?(h.globalCompositeOperation="multiply",h.strokeStyle=i,h.lineWidth=o*1.5,h.globalAlpha=.5):(h.globalCompositeOperation="source-over",h.strokeStyle=i,h.lineWidth=o))},[E,i,o,u,b]),K=e.useCallback((h,v)=>{const x=w.current;x&&(W(),v.pressure!==void 0&&E!=="eraser"&&(x.lineWidth=o*Math.max(.3,v.pressure)),x.beginPath(),x.moveTo(h.x,h.y),x.lineTo(v.x,v.y),x.stroke())},[W,o,E]),J=e.useCallback((h,v)=>{const x=w.current;if(!x||!B.current)return;x.putImageData(B.current,0,0),W();const a=v.x-h.x,l=v.y-h.y;if(x.beginPath(),E==="line")x.moveTo(h.x,h.y),x.lineTo(v.x,v.y),x.stroke();else if(E==="rectangle")x.strokeRect(h.x,h.y,a,l);else if(E==="circle"){const k=Math.sqrt(a*a+l*l);x.arc(h.x,h.y,k,0,Math.PI*2),x.stroke()}},[W,E]),ee=e.useCallback((h,v,x)=>{const a=T.current,l=w.current;if(!a||!l)return;const k=a.getBoundingClientRect(),I=l.getImageData(0,0,k.width,k.height),G=I.data,X=document.createElement("div");X.style.color=x,document.body.appendChild(X);const q=getComputedStyle(X).color;document.body.removeChild(X);const se=q.match(/\d+/g);if(!se)return;const[ne,ie,ae]=se.map(Number),re=(Math.floor(v)*k.width+Math.floor(h))*4,oe=G[re],U=G[re+1],Q=G[re+2],te=G[re+3];if(oe===ne&&U===ie&&Q===ae)return;const ce=[[Math.floor(h),Math.floor(v)]],ue=new Set;for(;ce.length>0;){const[de,fe]=ce.pop(),he=(fe*k.width+de)*4;if(de<0||de>=k.width||fe<0||fe>=k.height||ue.has(he))continue;const Ae=G[he],Kt=G[he+1],Jt=G[he+2],Qt=G[he+3],je=30;Math.abs(Ae-oe)>je||Math.abs(Kt-U)>je||Math.abs(Jt-Q)>je||Math.abs(Qt-te)>je||(ue.add(he),G[he]=ne,G[he+1]=ie,G[he+2]=ae,G[he+3]=255,ce.push([de+1,fe],[de-1,fe],[de,fe+1],[de,fe-1]))}l.putImageData(I,0,0)},[]),$=e.useCallback(h=>{if(R)return;h.preventDefault(),h.currentTarget.setPointerCapture(h.pointerId);const v=_(h);if(E==="fill"){ee(v.x,v.y,i),P(),f==null||f(),Z();return}if(Y(!0),D.current=v,C.current=v,E==="line"||E==="rectangle"||E==="circle"){const x=T.current,a=w.current;if(x&&a){const l=x.getBoundingClientRect();B.current=a.getImageData(0,0,l.width,l.height)}}else{const x=w.current;x&&(W(),x.beginPath(),x.arc(v.x,v.y,o/2,0,Math.PI*2),x.fill())}Z()},[R,_,E,ee,i,P,f,Z,W,o]),z=e.useCallback(h=>{if(!A||R)return;const v=_(h);E==="line"||E==="rectangle"||E==="circle"?D.current&&J(D.current,v):C.current&&K(C.current,v),C.current=v},[A,R,_,E,J,K]),F=e.useCallback(h=>{A&&(h.currentTarget.releasePointerCapture(h.pointerId),Y(!1),(E==="line"||E==="rectangle"||E==="circle")&&D.current&&C.current&&J(D.current,C.current),B.current=null,D.current=null,C.current=null,P(),f==null||f())},[A,E,J,P,f]);e.useImperativeHandle(M,()=>({clear:()=>{const h=T.current,v=w.current;if(!h||!v)return;const x=h.getBoundingClientRect();v.fillStyle=c,v.globalCompositeOperation="source-over",v.fillRect(0,0,x.width,x.height),P(),f==null||f()},undo:()=>{g.current>0&&(g.current--,H(g.current),f==null||f())},redo:()=>{g.current<L.current.length-1&&(g.current++,H(g.current),f==null||f())},canUndo:()=>g.current>0,canRedo:()=>g.current<L.current.length-1,toDataURL:(h="png",v=1)=>{const x=T.current;if(!x)return"";const a=h==="jpeg"?"image/jpeg":"image/png";return x.toDataURL(a,v)},toBlob:(h="png",v=1)=>new Promise(x=>{const a=T.current;if(!a){x(null);return}const l=h==="jpeg"?"image/jpeg":"image/png";a.toBlob(x,l,v)}),fromDataURL:async h=>{const v=T.current,x=w.current;if(!(!v||!x))return new Promise(a=>{const l=new Image;l.onload=()=>{const k=v.getBoundingClientRect();x.drawImage(l,0,0,k.width,k.height),P(),a()},l.src=h})},fill:h=>{const v=T.current,x=w.current;if(!v||!x)return;const a=v.getBoundingClientRect();x.fillStyle=h,x.globalCompositeOperation="source-over",x.fillRect(0,0,a.width,a.height),P(),f==null||f()},getTool:()=>E,setTool:h=>{O(h),m==null||m(h)}}),[c,P,H,E,m,f]);const V=()=>{switch(E){case"eraser":return"cell";case"fill":return"crosshair";default:return"crosshair"}};return t.jsx("div",{className:`nice-touch-drawing ${R?"nice-touch-drawing--disabled":""} ${p}`,...S,children:t.jsx("canvas",{ref:T,className:"nice-touch-drawing-canvas",style:{width:r,height:s,cursor:V(),touchAction:"none"},onPointerDown:$,onPointerMove:z,onPointerUp:F,onPointerCancel:F,onPointerLeave:F})})}),Or=["var(--text-primary, #1f2937)","var(--color-error, #ef4444)","#f97316","var(--color-warning, #eab308)","var(--color-success, #22c55e)","var(--color-primary, #3b82f6)","var(--color-accent, #8b5cf6)","var(--color-accent-pink, #ec4899)","var(--bg-primary, #ffffff)","var(--text-primary, #000000)"],Ur={pen:"✏️",brush:"🖌️",marker:"🖍️",eraser:"🧹",fill:"🪣",line:"📏",rectangle:"⬜",circle:"⭕"},Xr=e.forwardRef(function({tool:r,onToolChange:s,color:c,onColorChange:i,strokeWidth:o,onStrokeWidthChange:d,onUndo:u,onRedo:b,onClear:N,canUndo:y=!0,canRedo:j=!0,colors:R=Or,className:f="",...m},p){const S=["pen","brush","marker","eraser","fill","line","rectangle","circle"];return t.jsxs("div",{ref:p,className:`nice-drawing-toolbar ${f}`,...m,children:[t.jsx("div",{className:"nice-drawing-toolbar-section",children:S.map(M=>t.jsx("button",{type:"button",className:`nice-drawing-tool-btn ${r===M?"active":""}`,onClick:()=>s(M),title:M,children:Ur[M]},M))}),t.jsx("div",{className:"nice-drawing-toolbar-divider"}),t.jsx("div",{className:"nice-drawing-toolbar-section nice-drawing-colors",children:R.map((M,T)=>t.jsx("button",{type:"button",className:`nice-drawing-color-btn ${c===M?"active":""}`,style:{backgroundColor:M,borderColor:M==="var(--bg-primary, #ffffff)"?"var(--border-color, #e5e7eb)":M},onClick:()=>i(M),title:M},T))}),t.jsx("div",{className:"nice-drawing-toolbar-divider"}),t.jsx("div",{className:"nice-drawing-toolbar-section",children:t.jsxs("label",{className:"nice-drawing-stroke-label",children:[t.jsxs("span",{children:[o,"px"]}),t.jsx("input",{type:"range",min:1,max:50,value:o,onChange:M=>d(Number(M.target.value)),className:"nice-drawing-stroke-slider"})]})}),t.jsx("div",{className:"nice-drawing-toolbar-divider"}),t.jsxs("div",{className:"nice-drawing-toolbar-section nice-drawing-actions",children:[u&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:u,disabled:!y,title:"Undo",children:"↩️"}),b&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:b,disabled:!j,title:"Redo",children:"↪️"}),N&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn danger",onClick:N,title:"Clear",children:"🗑️"})]})]})}),$e={en:{code:"en",name:"English",nativeName:"English",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},pl:{code:"pl",name:"Polish",nativeName:"Polski",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{a:["ą"],c:["ć"],e:["ę"],l:["ł"],n:["ń"],o:["ó"],s:["ś"],z:["ź","ż"]}},de:{code:"de",name:"German",nativeName:"Deutsch",rows:[["q","w","e","r","t","z","u","i","o","p","ü"],["a","s","d","f","g","h","j","k","l","ö","ä"],["y","x","c","v","b","n","m","ß"]],accents:{a:["ä"],o:["ö"],u:["ü"],s:["ß"]}},fr:{code:"fr",name:"French",nativeName:"Français",rows:[["a","z","e","r","t","y","u","i","o","p"],["q","s","d","f","g","h","j","k","l","m"],["w","x","c","v","b","n"]],accents:{a:["à","â","æ"],e:["é","è","ê","ë"],i:["î","ï"],o:["ô","œ"],u:["ù","û","ü"],c:["ç"]}},es:{code:"es",name:"Spanish",nativeName:"Español",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l","ñ"],["z","x","c","v","b","n","m"]],accents:{a:["á"],e:["é"],i:["í"],o:["ó"],u:["ú","ü"],n:["ñ"]}},it:{code:"it",name:"Italian",nativeName:"Italiano",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{a:["à"],e:["è","é"],i:["ì"],o:["ò"],u:["ù"]}},pt:{code:"pt",name:"Portuguese",nativeName:"Português",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l","ç"],["z","x","c","v","b","n","m"]],accents:{a:["á","ã","â","à"],e:["é","ê"],i:["í"],o:["ó","õ","ô"],u:["ú"],c:["ç"]}},ru:{code:"ru",name:"Russian",nativeName:"Русский",rows:[["й","ц","у","к","е","н","г","ш","щ","з","х","ъ"],["ф","ы","в","а","п","р","о","л","д","ж","э"],["я","ч","с","м","и","т","ь","б","ю"]]},uk:{code:"uk",name:"Ukrainian",nativeName:"Українська",rows:[["й","ц","у","к","е","н","г","ш","щ","з","х","ї"],["ф","і","в","а","п","р","о","л","д","ж","є"],["я","ч","с","м","и","т","ь","б","ю","ґ"]]},cs:{code:"cs",name:"Czech",nativeName:"Čeština",rows:[["q","w","e","r","t","z","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["y","x","c","v","b","n","m"]],accents:{a:["á"],c:["č"],d:["ď"],e:["é","ě"],i:["í"],n:["ň"],o:["ó"],r:["ř"],s:["š"],t:["ť"],u:["ú","ů"],y:["ý"],z:["ž"]}},tr:{code:"tr",name:"Turkish",nativeName:"Türkçe",rows:[["q","w","e","r","t","y","u","ı","o","p","ğ","ü"],["a","s","d","f","g","h","j","k","l","ş","i"],["z","x","c","v","b","n","m","ö","ç"]]},nl:{code:"nl",name:"Dutch",nativeName:"Nederlands",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{e:["é","ë"],i:["ï"],o:["ö"],u:["ü"]}},sv:{code:"sv",name:"Swedish",nativeName:"Svenska",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","ö","ä"],["z","x","c","v","b","n","m"]]},no:{code:"no",name:"Norwegian",nativeName:"Norsk",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","ø","æ"],["z","x","c","v","b","n","m"]]},da:{code:"da",name:"Danish",nativeName:"Dansk",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","æ","ø"],["z","x","c","v","b","n","m"]]},fi:{code:"fi",name:"Finnish",nativeName:"Suomi",rows:[["q","w","e","r","t","y","u","i","o","p","å"],["a","s","d","f","g","h","j","k","l","ö","ä"],["z","x","c","v","b","n","m"]]},ro:{code:"ro",name:"Romanian",nativeName:"Română",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]],accents:{a:["ă","â"],i:["î"],s:["ș"],t:["ț"]}},hr:{code:"hr",name:"Croatian",nativeName:"Hrvatski",rows:[["q","w","e","r","t","z","u","i","o","p","š","đ"],["a","s","d","f","g","h","j","k","l","č","ć"],["y","x","c","v","b","n","m","ž"]]},el:{code:"el",name:"Greek",nativeName:"Ελληνικά",rows:[["ς","ε","ρ","τ","υ","θ","ι","ο","π"],["α","σ","δ","φ","γ","η","ξ","κ","λ"],["ζ","χ","ψ","ω","β","ν","μ"]],accents:{α:["ά"],ε:["έ"],η:["ή"],ι:["ί","ϊ"],ο:["ό"],υ:["ύ","ϋ"],ω:["ώ"]}},hu:{code:"hu",name:"Hungarian",nativeName:"Magyar",rows:[["q","w","e","r","t","z","u","i","o","p","ő","ú"],["a","s","d","f","g","h","j","k","l","é","á"],["y","x","c","v","b","n","m","ö","ü","ó"]],accents:{a:["á"],e:["é"],i:["í"],o:["ó","ö","ő"],u:["ú","ü","ű"]}},sk:{code:"sk",name:"Slovak",nativeName:"Slovenčina",rows:[["q","w","e","r","t","z","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["y","x","c","v","b","n","m"]],accents:{a:["á","ä"],c:["č"],d:["ď"],e:["é"],i:["í"],l:["ĺ","ľ"],n:["ň"],o:["ó","ô"],r:["ŕ"],s:["š"],t:["ť"],u:["ú"],y:["ý"],z:["ž"]}},bg:{code:"bg",name:"Bulgarian",nativeName:"Български",rows:[["я","в","е","р","т","ъ","у","и","о","п","ш","щ"],["а","с","д","ф","г","х","й","к","л"],["з","ь","ц","ж","б","н","м","ч","ю"]]},sr:{code:"sr",name:"Serbian",nativeName:"Српски",rows:[["љ","њ","е","р","т","з","у","и","о","п","ш","ђ"],["а","с","д","ф","г","х","ј","к","л","ч","ћ"],["ж","џ","ц","в","б","н","м"]]},ja:{code:"ja",name:"Japanese (Romaji)",nativeName:"日本語",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},ko:{code:"ko",name:"Korean (Romaji)",nativeName:"한국어",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},zh:{code:"zh",name:"Chinese (Pinyin)",nativeName:"中文",rows:[["q","w","e","r","t","y","u","i","o","p"],["a","s","d","f","g","h","j","k","l"],["z","x","c","v","b","n","m"]]},ar:{code:"ar",name:"Arabic",nativeName:"العربية",rows:[["ض","ص","ث","ق","ف","غ","ع","ه","خ","ح","ج","د"],["ش","س","ي","ب","ل","ا","ت","ن","م","ك","ط"],["ئ","ء","ؤ","ر","لا","ى","ة","و","ز","ظ"]]},he:{code:"he",name:"Hebrew",nativeName:"עברית",rows:[["/","'","ק","ר","א","ט","ו","ן","ם","פ"],["ש","ד","ג","כ","ע","י","ח","ל","ך","ף"],["ז","ס","ב","ה","נ","מ","צ","ת","ץ"]]}},me={value:"Backspace",label:"⌫",type:"backspace",width:1.5},Te={value:"Enter",label:"⏎",type:"enter",width:1.5},Re={value:" ",label:"Space",type:"space",width:5},De={value:"Shift",label:"⇧",type:"shift",width:1.5},_r={value:"CapsLock",label:"⇪",type:"caps",width:1.75},qr={value:"Tab",label:"⇥",type:"tab",width:1.5},Ve=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"0"},{value:"-"},{value:"="}],Gr=[{value:"!"},{value:"@"},{value:"#"},{value:"$"},{value:"%"},{value:"^"},{value:"&"},{value:"*"},{value:"("},{value:")"}],Kr=[{value:"-"},{value:"_"},{value:"="},{value:"+"},{value:"["},{value:"]"},{value:"{"},{value:"}"},me],Jr=[{value:"Esc",label:"Esc",type:"fn",width:1},{value:"F1",label:"F1",type:"fn"},{value:"F2",label:"F2",type:"fn"},{value:"F3",label:"F3",type:"fn"},{value:"F4",label:"F4",type:"fn"},{value:"F5",label:"F5",type:"fn"},{value:"F6",label:"F6",type:"fn"},{value:"F7",label:"F7",type:"fn"},{value:"F8",label:"F8",type:"fn"},{value:"F9",label:"F9",type:"fn"},{value:"F10",label:"F10",type:"fn"},{value:"F11",label:"F11",type:"fn"},{value:"F12",label:"F12",type:"fn"}],Ue=[[{value:"1"},{value:"2"},{value:"3"}],[{value:"4"},{value:"5"},{value:"6"}],[{value:"7"},{value:"8"},{value:"9"}],[{value:".",width:1},{value:"0"},me]],Qr=[[{value:"7"},{value:"8"},{value:"9"},{value:"/",type:"special"}],[{value:"4"},{value:"5"},{value:"6"},{value:"*",type:"special"}],[{value:"1"},{value:"2"},{value:"3"},{value:"-",type:"special"}],[{value:"0",width:2},{value:"."},{value:"+",type:"special"}],[{value:"C",label:"C",type:"fn"},me,{value:"=",type:"enter",width:2}]],Zr=[[{value:"1",label:"1"},{value:"2",label:"2 ABC"},{value:"3",label:"3 DEF"}],[{value:"4",label:"4 GHI"},{value:"5",label:"5 JKL"},{value:"6",label:"6 MNO"}],[{value:"7",label:"7 PQRS"},{value:"8",label:"8 TUV"},{value:"9",label:"9 WXYZ"}],[{value:"*",label:"*"},{value:"0",label:"0 +"},{value:"#",label:"#"}],[{value:"Call",label:"📞",type:"enter",width:1.5},me]],es=[[{value:"1"},{value:"2"},{value:"3"}],[{value:"4"},{value:"5"},{value:"6"}],[{value:"7"},{value:"8"},{value:"9"}],[{value:"Clear",label:"C",type:"fn"},{value:"0"},me]];function ts(n,r,s,c,i){const o=$e[n]||$e.en,[d,u,b]=o.rows;if(r==="minimal")return Ue;if(s){const j=[Ve.slice(0,10),Gr,Kr],R=[{value:"ABC",label:"ABC",type:"fn",width:1.5}];return c&&R.push({value:"Lang",label:"🌐",type:"lang",width:1}),R.push({value:",",width:1}),R.push({...Re,width:c?3.5:4}),R.push({value:".",width:1}),R.push({...Te,...i?{label:i}:{}}),j.push(R),j}if(r==="compact"){const j=[d.map(f=>({value:f})),u.map(f=>({value:f})),[De,...b.map(f=>({value:f})),me]],R=[{value:"123",label:"123",type:"fn",width:1.5}];return c&&R.push({value:"Lang",label:"🌐",type:"lang",width:1}),R.push({value:",",width:1}),R.push({...Re,width:c?3.5:4}),R.push({value:".",width:1}),R.push({...Te,...i?{label:i}:{}}),j.push(R),j}if(r==="standard"){const j=[Ve.slice(0,10),d.map(f=>({value:f})),u.map(f=>({value:f})),[De,...b.map(f=>({value:f})),me]],R=[{value:"#+=",label:"#+=",type:"fn",width:1.5}];return c&&R.push({value:"Lang",label:"🌐",type:"lang",width:1}),R.push({value:",",width:1}),R.push({...Re,width:c?3:4}),R.push({value:".",width:1}),R.push({...Te,...i?{label:i}:{}}),j.push(R),j}const N=[Jr,[...Ve,me],[qr,...d.map(j=>({value:j}))],[_r,...u.map(j=>({value:j})),{...Te,width:1.75,...i?{label:i}:{}}],[{...De,width:2.25},...b.map(j=>({value:j})),{...De,width:2.25}]],y=[{value:"#+=",label:"#+=",type:"fn",width:1.5}];if(c&&y.push({value:"Lang",label:"🌐",type:"lang",width:1}),y.push({...Re,width:c?6:7}),y.push({value:",",width:1}),y.push({value:".",width:1}),N.push(y),o.accents){const j=[];for(const[,R]of Object.entries(o.accents))for(const f of R)j.find(m=>m.value===f)||j.push({value:f});j.length>0&&N.push(j)}return N}const He=e.forwardRef(function({layout:r="qwerty",customLayout:s,mode:c="standard",languages:i,activeLanguage:o,onLanguageChange:d,value:u="",maxLength:b,theme:N="system",haptic:y=!0,sound:j=!1,onKeyPress:R,onChange:f,onSubmit:m,disabled:p=!1,showPreview:S=!1,previewPlaceholder:M="Type here...",masked:T=!1,showLanguageSwitcher:w,enterLabel:A,className:Y="",...E},O){const L=e.useMemo(()=>i&&i.length>0?i:["en"],[i]),[g,D]=e.useState(L[0]),C=o??g,[B,P]=e.useState(!1),[H,Z]=e.useState(!1),[_,W]=e.useState(!1),K=w??L.length>1,J=e.useMemo(()=>r==="custom"&&s?s.rows:r!=="qwerty"?{numeric:Ue,numpad:Qr,phone:Zr,pin:es}[r]||Ue:ts(C,c,_,K,A),[r,s,C,c,_,K,A]),ee=e.useCallback(()=>{const a=L.indexOf(C),l=L[(a+1)%L.length];D(l),d==null||d(l)},[L,C,d]),$=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[y]),z=e.useCallback(()=>{if(j)try{const a=new(window.AudioContext||window.webkitAudioContext),l=a.createOscillator(),k=a.createGain();l.connect(k),k.connect(a.destination),l.frequency.value=1e3,l.type="sine",k.gain.value=.1,l.start(),l.stop(a.currentTime+.05)}catch{}},[j]),F=e.useCallback(a=>{if(p)return;$(),z();let l=u;switch(a.type){case"backspace":l=u.slice(0,-1);break;case"enter":m==null||m(u);return;case"shift":P(k=>!k);return;case"caps":Z(k=>!k);return;case"tab":l=u+" ";break;case"lang":ee();return;case"fn":if(a.value==="123"||a.value==="ABC"||a.value==="#+="||a.value==="#+=")W(k=>!k);else if(a.value==="Clear"||a.value==="C")l="";else{R==null||R(a.value);return}return;case"space":l=u+" ";break;default:{let k=a.value;(B||H)&&k.length===1&&(k=k.toUpperCase()),l=u+k,B&&!H&&P(!1)}}b&&l.length>b||(R==null||R(a.value),f==null||f(l))},[p,u,b,B,H,$,z,R,f,m,ee]),V=e.useMemo(()=>T?"•".repeat(u.length):u,[u,T]),h=B||H,v=N==="system"?"":`nice-touch-keyboard--${N}`,x=$e[C];return t.jsxs("div",{ref:O,className:["nice-touch-keyboard",`nice-touch-keyboard--${c}`,v,p?"nice-touch-keyboard--disabled":"",Y].filter(Boolean).join(" "),"data-layout":r,"data-language":C,dir:C==="ar"||C==="he"?"rtl":void 0,...E,children:[K&&L.length>1&&t.jsx("div",{className:"nice-touch-keyboard-langbar",children:L.map(a=>{const l=$e[a];return t.jsx("button",{type:"button",className:`nice-touch-keyboard-langbar__btn ${a===C?"active":""}`,onClick:()=>{D(a),d==null||d(a)},disabled:p,children:(l==null?void 0:l.nativeName)??a.toUpperCase()},a)})}),S&&t.jsxs("div",{className:"nice-touch-keyboard-preview",children:[V||t.jsx("span",{className:"nice-touch-keyboard-placeholder",children:M}),t.jsx("span",{className:"nice-touch-keyboard-cursor"})]}),t.jsx("div",{className:"nice-touch-keyboard-keys",children:J.map((a,l)=>t.jsx("div",{className:"nice-touch-keyboard-row",children:a.map((k,I)=>{var se;const G=k.type==="shift"&&B||k.type==="caps"&&H||k.type==="lang"||k.value==="123"&&_||k.value==="ABC"&&!_||k.value==="#+="&&_;let X=k.label||k.value;h&&!k.type&&X.length===1&&(X=X.toUpperCase());const q=!k.type&&k.value.length===1&&((se=x==null?void 0:x.accents)==null?void 0:se[k.value.toLowerCase()]);return t.jsx("button",{type:"button",className:["nice-touch-keyboard-key",`nice-touch-keyboard-key--${k.type||"char"}`,G?"active":"",q?"nice-touch-keyboard-key--has-accent":""].filter(Boolean).join(" "),style:{flex:k.width||1},onClick:()=>F(k),disabled:p,"aria-label":k.type==="backspace"?"Backspace":k.type==="enter"?"Enter":void 0,children:k.icon||X},I)})},l))}),t.jsxs("div",{className:"nice-touch-keyboard-status",children:[H&&t.jsx("span",{className:"nice-touch-keyboard-status__item",children:"CAPS"}),x&&t.jsx("span",{className:"nice-touch-keyboard-status__item",children:x.nativeName})]})]})}),ns=e.forwardRef(function(r,s){return t.jsx(He,{ref:s,layout:"pin",masked:!0,maxLength:r.maxLength||6,...r})}),rs=e.forwardRef(function(r,s){return t.jsx(He,{ref:s,layout:"numpad",...r})}),ss=e.forwardRef(function(r,s){return t.jsx(He,{ref:s,layout:"phone",...r})}),_t=e.createContext(null);function cs(n,r=500){const s=e.useRef(),c=e.useRef(null),i=e.useCallback(u=>{c.current={x:u.clientX,y:u.clientY},s.current=setTimeout(()=>{n(u)},r)},[n,r]),o=e.useCallback(u=>{if(!c.current)return;const b=Math.abs(u.clientX-c.current.x),N=Math.abs(u.clientY-c.current.y);(b>10||N>10)&&d()},[]),d=e.useCallback(()=>{s.current&&(clearTimeout(s.current),s.current=void 0),c.current=null},[]);return e.useEffect(()=>()=>{s.current&&clearTimeout(s.current)},[]),{onPointerDown:i,onPointerMove:o,onPointerUp:d,onPointerCancel:d,onPointerLeave:d}}const ft=({item:n,onSelect:r})=>{const s=e.useContext(_t),c=e.useRef(null),[i,o]=e.useState(null),d=e.useCallback(()=>{var y;if(!n.disabled)if(n.children&&n.children.length>0){if(c.current){const j=c.current.getBoundingClientRect();s==null||s.openSubmenu(n.id,{x:j.right,y:j.top})}}else(y=n.onClick)==null||y.call(n),r(n)},[n,r,s]),u=e.useCallback(()=>{if(n.children&&n.children.length>0&&c.current){const y=c.current.getBoundingClientRect();s==null||s.openSubmenu(n.id,{x:y.right,y:y.top})}},[n,s]),b=n.children&&n.children.length>0,N=(s==null?void 0:s.activeSubmenu)===n.id;return t.jsxs(t.Fragment,{children:[t.jsxs("button",{ref:c,type:"button",className:`nice-touch-menu-item ${n.disabled?"disabled":""} ${n.danger?"danger":""} ${N?"active":""}`,onClick:d,onPointerEnter:u,disabled:n.disabled,role:"menuitem","aria-haspopup":b?"menu":void 0,"aria-expanded":b?N:void 0,children:[n.icon&&t.jsx("span",{className:"nice-touch-menu-item-icon",children:n.icon}),t.jsx("span",{className:"nice-touch-menu-item-label",children:n.label}),n.shortcut&&t.jsx("span",{className:"nice-touch-menu-item-shortcut",children:n.shortcut}),b&&t.jsx("span",{className:"nice-touch-menu-item-arrow",children:"›"})]}),n.divider&&t.jsx("div",{className:"nice-touch-menu-divider",role:"separator"})]})},qt=e.forwardRef(function({items:r,open:s,position:c,onClose:i,haptic:o=!0,className:d="",...u},b){var A;const N=e.useRef(null),[y,j]=e.useState(null),[R,f]=e.useState(null),[m,p]=e.useState(c);e.useEffect(()=>{if(!s||!N.current)return;const E=N.current.getBoundingClientRect(),O={width:window.innerWidth,height:window.innerHeight};let L=c.x,g=c.y;L+E.width>O.width-8&&(L=O.width-E.width-8),L<8&&(L=8),g+E.height>O.height-8&&(g=O.height-E.height-8),g<8&&(g=8),p({x:L,y:g})},[s,c]),e.useEffect(()=>{if(!s)return;const Y=O=>{N.current&&!N.current.contains(O.target)&&i()},E=O=>{O.key==="Escape"&&i()};return document.addEventListener("mousedown",Y),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",Y),document.removeEventListener("keydown",E)}},[s,i]);const S=e.useCallback(()=>{if(!(!o||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[o]),M=e.useCallback(Y=>{S(),i()},[S,i]),T={close:i,openSubmenu:(Y,E)=>{j(Y),f(E)},closeSubmenu:()=>{j(null),f(null)},activeSubmenu:y};if(!s)return null;const w=y?(A=r.find(Y=>Y.id===y))==null?void 0:A.children:null;return t.jsx(_t.Provider,{value:T,children:t.jsxs("div",{ref:N,className:`nice-touch-menu-popover ${d}`,style:{left:m.x,top:m.y},role:"menu",...u,children:[r.map(Y=>t.jsx(ft,{item:Y,onSelect:M},Y.id)),w&&R&&t.jsx("div",{className:"nice-touch-menu-popover nice-touch-menu-submenu",style:{left:R.x-m.x,top:R.y-m.y},role:"menu",children:w.map(Y=>t.jsx(ft,{item:Y,onSelect:M},Y.id))})]})})}),is=e.forwardRef(function({items:r,trigger:s,longPress:c=!0,longPressDelay:i=500,enableContextMenu:o=!1,enableClick:d=!1,haptic:u=!0,disabled:b=!1,onOpen:N,onClose:y,className:j="",...R},f){const[m,p]=e.useState(!1),[S,M]=e.useState({x:0,y:0}),T=e.useRef(null),w=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(20)}catch{}},[u]),A=e.useCallback((g,D)=>{b||(w(),M({x:g,y:D}),p(!0),N==null||N())},[b,w,N]),Y=e.useCallback(()=>{p(!1),y==null||y()},[y]),E=cs(g=>{g.preventDefault(),A(g.clientX,g.clientY)},i),O=e.useCallback(g=>{if(!(!d||b)&&(g.preventDefault(),g.stopPropagation(),T.current)){const D=T.current.getBoundingClientRect();A(D.left,D.bottom+4)}},[d,b,A]),L=e.useCallback(g=>{!o||b||(g.preventDefault(),A(g.clientX,g.clientY))},[o,b,A]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:g=>{T.current=g,typeof f=="function"?f(g):f&&(f.current=g)},className:`nice-touch-menu-trigger ${b?"disabled":""} ${j}`,onClick:O,onContextMenu:L,...c&&!b?E:{},...R,children:s}),t.jsx(qt,{items:r,open:m,position:S,onClose:Y,haptic:u})]})}),as=e.forwardRef(function({items:r,open:s,onClose:c,title:i,cancelLabel:o="Cancel",haptic:d=!0,className:u="",...b},N){const y=e.useCallback(()=>{if(!(!d||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[d]),j=e.useCallback(m=>{var p;m.disabled||(y(),(p=m.onClick)==null||p.call(m),c())},[y,c]),R=e.useCallback(()=>{y(),c()},[y,c]),f=e.useCallback(m=>{m.target===m.currentTarget&&c()},[c]);return e.useEffect(()=>{if(!s)return;const m=p=>{p.key==="Escape"&&c()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[s,c]),s?t.jsx("div",{className:`nice-action-sheet-backdrop ${s?"open":""}`,onClick:f,children:t.jsxs("div",{ref:N,className:`nice-action-sheet ${u}`,role:"dialog","aria-modal":"true",...b,children:[t.jsxs("div",{className:"nice-action-sheet-content",children:[i&&t.jsx("div",{className:"nice-action-sheet-title",children:i}),r.map(m=>t.jsxs("button",{type:"button",className:`nice-action-sheet-item ${m.disabled?"disabled":""} ${m.danger?"danger":""}`,onClick:()=>j(m),disabled:m.disabled,children:[m.icon&&t.jsx("span",{className:"nice-action-sheet-item-icon",children:m.icon}),t.jsx("span",{className:"nice-action-sheet-item-label",children:m.label})]},m.id))]}),t.jsx("button",{type:"button",className:"nice-action-sheet-cancel",onClick:R,children:o})]})}):null});function ls({row:n,rowIndex:r,rowKey:s,columns:c,swipeActionsLeft:i=[],swipeActionsRight:o=[],selectable:d,selected:u,onSelect:b,onClick:N,haptic:y,swipeThreshold:j=80}){const[R,f]=e.useState(0),[m,p]=e.useState(!1),S=e.useRef(0),M=e.useRef(0),T=e.useRef(null),w=i.length>0,A=o.length>0,Y=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[y]),E=e.useCallback(C=>{!w&&!A||(S.current=C.touches[0].clientX,M.current=C.touches[0].clientX,p(!0))},[w,A]),O=e.useCallback(C=>{if(!m)return;M.current=C.touches[0].clientX;const B=M.current-S.current;let P=B;const H=w?j*i.length:0,Z=A?j*o.length:0;P>H&&(P=H),P<-Z&&(P=-Z),!w&&P>0&&(P=B*.2),!A&&P<0&&(P=B*.2),f(P)},[m,w,A,j,i.length,o.length]),L=e.useCallback(()=>{if(!m)return;p(!1);const C=j*.5;R>C&&w?(f(j*i.length),Y()):R<-C&&A?(f(-j*o.length),Y()):f(0)},[m,R,j,w,A,i.length,o.length,Y]),g=e.useCallback(C=>{Y(),C.onAction(n,r),f(0)},[n,r,Y]),D=e.useCallback(()=>{Math.abs(R)>10||(d&&b?b():N&&N())},[R,d,b,N]);return e.useEffect(()=>{if(R===0)return;const C=B=>{T.current&&!T.current.contains(B.target)&&f(0)};return document.addEventListener("click",C),()=>document.removeEventListener("click",C)},[R]),t.jsxs("tr",{ref:T,className:`nice-touch-table-row ${u?"selected":""} ${m?"swiping":""}`,onTouchStart:E,onTouchMove:O,onTouchEnd:L,onTouchCancel:L,onClick:D,"data-row-key":s,children:[w&&t.jsx("div",{className:"nice-touch-table-actions nice-touch-table-actions--left",style:{width:j*i.length},children:i.map(C=>t.jsxs("button",{type:"button",className:"nice-touch-table-action",style:{backgroundColor:C.color||"var(--color-primary, #3b82f6)",color:C.textColor||"var(--bg-primary, #ffffff)",width:j},onClick:()=>g(C),children:[C.icon&&t.jsx("span",{className:"action-icon",children:C.icon}),t.jsx("span",{className:"action-label",children:C.label})]},C.id))}),t.jsxs("div",{className:"nice-touch-table-row-content",style:{transform:`translateX(${R}px)`,transition:m?"none":"transform 0.2s ease-out"},children:[d&&t.jsx("td",{className:"nice-touch-table-cell nice-touch-table-cell--checkbox",children:t.jsx("input",{type:"checkbox",checked:u,onChange:()=>b==null?void 0:b(),onClick:C=>C.stopPropagation()})}),c.map(C=>{const B=typeof C.accessor=="function"?C.accessor(n):n[C.accessor],P=C.cell?C.cell(B,n,r):B;return t.jsx("td",{className:`nice-touch-table-cell ${C.sticky?"sticky":""}`,style:{width:C.width,minWidth:C.minWidth,textAlign:C.align},children:P},C.id)})]}),A&&t.jsx("div",{className:"nice-touch-table-actions nice-touch-table-actions--right",style:{width:j*o.length},children:o.map(C=>t.jsxs("button",{type:"button",className:"nice-touch-table-action",style:{backgroundColor:C.color||"var(--color-error, #ef4444)",color:C.textColor||"var(--bg-primary, #ffffff)",width:j},onClick:()=>g(C),children:[C.icon&&t.jsx("span",{className:"action-icon",children:C.icon}),t.jsx("span",{className:"action-label",children:C.label})]},C.id))})]})}const os=e.forwardRef(function({data:r,columns:s,rowKey:c,swipeActionsLeft:i,swipeActionsRight:o,selectable:d=!1,selectedKeys:u=[],onSelect:b,onRowClick:N,sortState:y,onSort:j,emptyContent:R="No data",loading:f=!1,haptic:m=!0,swipeThreshold:p=80,className:S="",...M},T){const w=e.useCallback(g=>typeof c=="function"?c(g):String(g[c]),[c]),A=e.useCallback(g=>{if(!g.sortable||!j)return;const D=(y==null?void 0:y.columnId)===g.id&&y.direction==="asc"?"desc":"asc";j({columnId:g.id,direction:D})},[y,j]),Y=e.useCallback(()=>{b&&(u.length===r.length?b([]):b(r.map(g=>w(g))))},[r,u,b,w]),E=e.useCallback(g=>{if(!b)return;const D=u.includes(g)?u.filter(C=>C!==g):[...u,g];b(D)},[u,b]),O=r.length>0&&u.length===r.length,L=u.length>0&&u.length<r.length;return t.jsxs("div",{ref:T,className:`nice-touch-table-container ${f?"loading":""} ${S}`,...M,children:[t.jsx("div",{className:"nice-touch-table-scroll",children:t.jsxs("table",{className:"nice-touch-table",children:[t.jsx("thead",{className:"nice-touch-table-head",children:t.jsxs("tr",{children:[d&&t.jsx("th",{className:"nice-touch-table-header nice-touch-table-header--checkbox",children:t.jsx("input",{type:"checkbox",checked:O,ref:g=>{g&&(g.indeterminate=L)},onChange:Y})}),s.map(g=>t.jsx("th",{className:`nice-touch-table-header ${g.sticky?"sticky":""} ${g.sortable?"sortable":""}`,style:{width:g.width,minWidth:g.minWidth,textAlign:g.align},onClick:()=>A(g),children:t.jsxs("span",{className:"header-content",children:[g.header,g.sortable&&t.jsx("span",{className:"sort-indicator",children:(y==null?void 0:y.columnId)===g.id&&(y.direction==="asc"?"↑":"↓")})]})},g.id))]})}),t.jsx("tbody",{className:"nice-touch-table-body",children:r.length===0?t.jsx("tr",{className:"nice-touch-table-empty",children:t.jsx("td",{colSpan:s.length+(d?1:0),children:R})}):r.map((g,D)=>{const C=w(g);return t.jsx(ls,{row:g,rowIndex:D,rowKey:C,columns:s,swipeActionsLeft:i,swipeActionsRight:o,selectable:d,selected:u.includes(C),onSelect:()=>E(C),onClick:()=>N==null?void 0:N(g,D),haptic:m,swipeThreshold:p},C)})})]})}),f&&t.jsx("div",{className:"nice-touch-table-loading",children:t.jsx("div",{className:"nice-touch-table-spinner"})})]})}),Gt=e.createContext(null);function Qe(){const n=e.useContext(Gt);if(!n)throw new Error("useTouchForm must be used within NiceTouchForm");return n}function ht(n,r){for(const s of r){const c=String(n??"");switch(s.type){case"required":if(!n||typeof n=="string"&&!n.trim())return s.message;break;case"email":if(n&&!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(c))return s.message;break;case"minLength":if(n&&c.length<s.value)return s.message;break;case"maxLength":if(n&&c.length>s.value)return s.message;break;case"pattern":if(n&&!new RegExp(s.value).test(c))return s.message;break;case"custom":if(s.validator&&!s.validator(n))return s.message;break}}return null}const us=e.forwardRef(function({initialValues:r={},validation:s={},onSubmit:c,onChange:i,onError:o,enableNavigation:d=!0,haptic:u=!0,autoFocus:b=!1,validateOnBlur:N=!0,validateOnChange:y=!1,disabled:j=!1,children:R,className:f="",...m},p){const[S,M]=e.useState(r),[T,w]=e.useState([]),[A,Y]=e.useState(new Set),[E,O]=e.useState(!1),L=e.useRef(new Map),g=e.useRef([]),D=e.useRef(null),C=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[u]),B=e.useCallback((F,V)=>{const h=s[F];return h?ht(V,h):null},[s]),P=e.useCallback(()=>{const F=[];for(const[V,h]of Object.entries(s)){const v=ht(S[V],h);v&&F.push({field:V,message:v})}return F},[S,s]),H=e.useCallback((F,V)=>{if(M(h=>{const v={...h,[F]:V};return i==null||i(v),v}),y){const h=B(F,V);w(v=>{const x=v.filter(a=>a.field!==F);return h?[...x,{field:F,message:h}]:x})}},[i,y,B]),Z=e.useCallback(F=>{if(Y(V=>new Set([...V,F])),N){const V=B(F,S[F]);w(h=>{const v=h.filter(x=>x.field!==F);return V?[...v,{field:F,message:V}]:v})}},[N,B,S]),_=e.useCallback(F=>{var h;const V=L.current.get(F);V&&((h=V.focus)==null||h.call(V),D.current=F)},[]),W=e.useCallback(()=>{if(!d)return;const F=g.current,V=D.current;if(!V){F.length>0&&_(F[0]);return}const h=F.indexOf(V);h<F.length-1&&(_(F[h+1]),C())},[d,_,C]),K=e.useCallback(()=>{if(!d)return;const F=g.current,V=D.current;if(!V)return;const h=F.indexOf(V);h>0&&(_(F[h-1]),C())},[d,_,C]),J=e.useCallback((F,V)=>{L.current.set(F,V),V&&!g.current.includes(F)&&g.current.push(F)},[]),ee=e.useCallback(F=>{L.current.delete(F),g.current=g.current.filter(V=>V!==F)},[]),$=e.useCallback(async F=>{if(F.preventDefault(),j||E)return;const V=P();if(V.length>0){w(V),o==null||o(V),C();const h=V[0];h&&_(h.field);return}O(!0);try{await(c==null?void 0:c(S)),C()}catch(h){console.error("Form submission error:",h)}finally{O(!1)}},[j,E,P,o,c,S,C,_]);e.useEffect(()=>{b&&g.current.length>0&&setTimeout(()=>_(g.current[0]),100)},[b,_]);const z=e.useMemo(()=>({values:S,errors:T,touched:A,setFieldValue:H,setFieldTouched:Z,focusField:_,focusNext:W,focusPrev:K,registerField:J,unregisterField:ee}),[S,T,A,H,Z,_,W,K,J,ee]);return t.jsx(Gt.Provider,{value:z,children:t.jsx("form",{ref:p,className:`nice-touch-form ${j?"disabled":""} ${E?"submitting":""} ${f}`,onSubmit:$,noValidate:!0,...m,children:R})})}),ds=e.forwardRef(function({name:r,label:s,type:c="text",placeholder:i,helperText:o,disabled:d=!1,readOnly:u=!1,autoComplete:b,inputMode:N,iconLeft:y,iconRight:j,maxLength:R,onChange:f,required:m,className:p="",...S},M){const T=Qe(),w=e.useRef(null),[A,Y]=e.useState(!1),E=T.values[r]??"",O=T.errors.find(H=>H.field===r),g=T.touched.has(r)&&O;e.useEffect(()=>(T.registerField(r,w.current),()=>T.unregisterField(r)),[r,T]);const D=e.useCallback(H=>{const Z=H.target.value;T.setFieldValue(r,Z),f==null||f(Z)},[r,T,f]),C=e.useCallback(()=>{Y(!0)},[]),B=e.useCallback(()=>{Y(!1),T.setFieldTouched(r)},[r,T]),P=e.useCallback(H=>{H.key==="Enter"&&(H.preventDefault(),T.focusNext())},[T]);return t.jsxs("div",{ref:M,className:`nice-touch-field ${A?"focused":""} ${g?"error":""} ${d?"disabled":""} ${p}`,...S,children:[s&&t.jsxs("label",{className:"nice-touch-field-label",htmlFor:`field-${r}`,children:[s,m&&t.jsx("span",{className:"required-indicator",children:"*"})]}),t.jsxs("div",{className:"nice-touch-field-input-wrapper",children:[y&&t.jsx("span",{className:"nice-touch-field-icon left",children:y}),t.jsx("input",{ref:w,id:`field-${r}`,name:r,type:c,value:E,placeholder:i,disabled:d,readOnly:u,autoComplete:b,inputMode:N,maxLength:R,onChange:D,onFocus:C,onBlur:B,onKeyDown:P,className:"nice-touch-field-input","aria-invalid":g?"true":void 0,"aria-describedby":g?`${r}-error`:o?`${r}-helper`:void 0}),j&&t.jsx("span",{className:"nice-touch-field-icon right",children:j})]}),g&&t.jsx("div",{id:`${r}-error`,className:"nice-touch-field-error",role:"alert",children:O.message}),!g&&o&&t.jsx("div",{id:`${r}-helper`,className:"nice-touch-field-helper",children:o})]})}),fs=e.forwardRef(function({loading:r=!1,disabled:s=!1,fullWidth:c=!0,children:i,className:o="",...d},u){return t.jsx("button",{ref:u,type:"submit",className:`nice-touch-submit ${c?"full-width":""} ${r?"loading":""} ${o}`,disabled:s||r,...d,children:r?t.jsx("span",{className:"nice-touch-submit-spinner"}):i})}),hs=e.forwardRef(function({doneText:r="Done",showDone:s=!0,onDone:c,className:i="",...o},d){const u=Qe(),b=e.useCallback(()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),c==null||c()},[c]);return t.jsxs("div",{ref:d,className:`nice-touch-navbar ${i}`,...o,children:[t.jsxs("div",{className:"nice-touch-navbar-arrows",children:[t.jsx("button",{type:"button",onClick:u.focusPrev,"aria-label":"Previous field",children:"‹"}),t.jsx("button",{type:"button",onClick:u.focusNext,"aria-label":"Next field",children:"›"})]}),s&&t.jsx("button",{type:"button",className:"nice-touch-navbar-done",onClick:b,children:r})]})});exports.DEFAULT_BREAKPOINTS=Le;exports.DotsIndicator=tn;exports.DrawerIcons=kn;exports.EmojiIndicator=rn;exports.HAPTIC_PATTERNS=Ke;exports.HapticPatternBuilder=At;exports.HeaderIcons=Fn;exports.HeroHeader=On;exports.IOSHeader=zn;exports.IOSIndicator=sn;exports.LineIndicator=nn;exports.MaterialHeader=Wn;exports.MaterialIndicator=cn;exports.NiceBottomSheet=wt;exports.NiceBreakpointProvider=Rr;exports.NiceCalculatorKeyboard=rs;exports.NiceConfirmSheet=Sn;exports.NiceDateRangePicker=sr;exports.NiceDrawingToolbar=Xr;exports.NiceFAB=Ar;exports.NiceGestures=Ee;exports.NiceHapticsProvider=vr;exports.NiceHide=Sr;exports.NiceImageGallery=kt;exports.NiceInfiniteScroll=xn;exports.NiceMobileActionSheet=Dn;exports.NiceMobileCalendar=Ge;exports.NiceMobileDatePicker=Gn;exports.NiceMobileDraggable=lr;exports.NiceMobileDrawer=Tt;exports.NiceMobileHeader=Ie;exports.NiceMobileModal=_e;exports.NiceMobilePicker=qe;exports.NiceMobilePullToRefresh=Xe;exports.NiceMobileTabs=$n;exports.NiceMobileTimePicker=_n;exports.NiceMultiDatePicker=cr;exports.NicePINKeyboard=ns;exports.NicePhoneKeyboard=ss;exports.NicePickerColumn=Pt;exports.NicePinchZoom=ar;exports.NicePullToRefresh=Xe;exports.NiceShow=Dr;exports.NiceSignaturePad=Xt;exports.NiceSwipeActions=yt;exports.NiceSwipeList=an;exports.NiceSwipeable=or;exports.NiceTouchActionSheet=as;exports.NiceTouchButton=Je;exports.NiceTouchColorPicker=Fr;exports.NiceTouchDrawing=Wr;exports.NiceTouchField=ds;exports.NiceTouchForm=us;exports.NiceTouchIconButton=Hr;exports.NiceTouchKeyboard=He;exports.NiceTouchMenu=is;exports.NiceTouchMenuPopover=qt;exports.NiceTouchNavBar=hs;exports.NiceTouchSignaturePad=Xt;exports.NiceTouchSlider=Yr;exports.NiceTouchSubmit=fs;exports.NiceTouchTable=os;exports.PullToRefreshDefaultIndicator=mt;exports.SwipeActionPresets=ln;exports.SwipeGroupProvider=pt;exports.TabIcons=le;exports.TabPresets=In;exports.cancelVibration=xr;exports.colorUtils=Vr;exports.createHapticPattern=Nr;exports.createMediaQuery=Cr;exports.generateNumberItems=we;exports.getCurrentBreakpoint=Vt;exports.hapticFeedback=mr;exports.isMobileDevice=$r;exports.isTouch=Ir;exports.isVibrationSupported=pe;exports.responsive=Pr;exports.useBreakpoint=ke;exports.useBreakpointContext=Tr;exports.useButtonHaptic=gr;exports.useCalendar=Et;exports.useCollapsingHeader=Ln;exports.useDrawer=wn;exports.useGestures=Bt;exports.useGesturesContext=ir;exports.useHaptics=xe;exports.useHapticsContext=hr;exports.useImpactHaptic=jr;exports.useInfiniteData=pn;exports.useInfiniteScroll=dn;exports.useMediaQuery=Ft;exports.useMobileBreakpoint=ke;exports.useMobileCalendar=Kn;exports.useMobileDrawer=yn;exports.useMobileHeader=En;exports.useMobileMediaQuery=Ft;exports.useMobileModal=jn;exports.useMobilePicker=Un;exports.useMobilePullToRefresh=bt;exports.useMobileTabs=Cn;exports.useModal=Nn;exports.useNotificationHaptic=kr;exports.usePullToRefresh=bt;exports.useSelectionHaptic=wr;exports.useSwipeGroup=gt;exports.useTabs=Pn;exports.useToggleHaptic=yr;exports.useTouchForm=Qe;exports.useTouchSlider=zt;exports.useVirtualList=gn;exports.useWheelPicker=Xn;exports.vibrate=br;exports.withHaptics=pr;
|