@nice2dev/ui-mobile 1.1.7 → 1.1.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/dist/index.cjs CHANGED
@@ -1,13 +1,13 @@
1
- "use strict";var en=Object.defineProperty;var tn=(n,r,s)=>r in n?en(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s;var et=(n,r,s)=>tn(n,typeof r!="symbol"?r+"":r,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),bt=e.createContext(null);function mt(){const n=e.useContext(bt);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 xt=({state:n,progress:r,pullDistance:s,threshold:c})=>{const a=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(a,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)"})]})})]})},_e=e.forwardRef(({children:n,onRefresh:r,indicator:s,threshold:c=80,maxPull:a=150,resistance:o=.4,completionDuration:d=1e3,hapticFeedback:u=!0,disabled:m=!1,onPullStart:N,onPullProgress:y,onRefreshSuccess:j,onRefreshError:R,className:f="",style:b,ariaLabel:p="Pull to refresh"},C)=>{const[D,M]=e.useState("idle"),[w,H]=e.useState(0),A=e.useRef(null),E=e.useRef(null),W=e.useRef(0),L=e.useRef(0),g=e.useRef(!1),T=e.useRef(!1),S=Math.min(1,w/c),Y=D==="refreshing",P=e.useCallback(()=>w<=0?0:((F,X,v)=>{const h=F*(1-v);return Math.min(X,h+h*v/2)})(w,a,o),[w,a,o]),B=e.useCallback(async()=>{if(!(D==="refreshing"||m)){M("refreshing"),u&&Ne("medium");try{await r(),M("success"),u&&Ne("heavy"),j==null||j()}catch(V){M("error"),u&&Ne("light"),R==null||R(V instanceof Error?V:new Error("Refresh failed"))}setTimeout(()=>{M("idle"),H(0)},d)}},[D,m,u,r,j,R,d]),Q=e.useCallback(V=>{if(m||D==="refreshing")return;const F=E.current,X=(F==null?void 0:F.scrollTop)??0;X>0||(W.current=V.touches[0].clientY,L.current=X,T.current=!1)},[m,D]),U=e.useCallback(V=>{if(m||D==="refreshing")return;const F=E.current;if(((F==null?void 0:F.scrollTop)??0)>0&&!g.current)return;const h=V.touches[0].clientY-W.current;if(h<=0){g.current&&(g.current=!1,M("idle"),H(0));return}g.current||(g.current=!0,N==null||N(),M("pulling")),V.preventDefault(),H(h);const x=Math.min(1,h/c);y==null||y(x),h>=c?D!=="ready"&&(M("ready"),u&&!T.current&&(Ne("light"),T.current=!0)):D==="ready"&&(M("pulling"),T.current=!1)},[m,D,c,u,N,y]),O=e.useCallback(()=>{g.current&&(g.current=!1,D==="ready"?B():(M("idle"),H(0)))},[D,B]),K=e.useCallback(V=>{(V.key==="F5"||V.ctrlKey&&V.key==="r")&&(V.preventDefault(),B())},[B]),Z=e.useCallback(V=>{A.current=V,typeof C=="function"?C(V):C&&(C.current=V)},[C]),ee={state:D,progress:S,isRefreshing:Y,triggerRefresh:B},I=P();return t.jsx(bt.Provider,{value:ee,children:t.jsxs("div",{ref:Z,className:`nice-ptr ${f} nice-ptr--${D}`,style:b,onTouchStart:Q,onTouchMove:U,onTouchEnd:O,onKeyDown:K,tabIndex:0,role:"region","aria-label":p,"data-state":D,"data-disabled":m||void 0,children:[t.jsx("div",{className:"nice-ptr-indicator-wrapper",style:{height:I,opacity:D==="idle"?0:1},children:s?t.jsx(s,{state:D,progress:S,pullDistance:w,threshold:c}):t.jsx(xt,{state:D,progress:S,pullDistance:w,threshold:c})}),t.jsx("div",{ref:E,className:"nice-ptr-content",style:{transform:D==="refreshing"?`translateY(${c}px)`:`translateY(${I}px)`,transition:g.current?"none":"transform 0.3s cubic-bezier(0.23, 1, 0.32, 1)"},children:n})]})})});_e.displayName="NicePullToRefresh";const nn=({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)}})]}),rn=({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}%`}})}),sn=({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]})})},cn=({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,a)=>{const o=a/12*360,d=a/12*1,u=n==="refreshing"?void 0:Math.min(1,r*2-a*.08);return t.jsx("div",{className:"ptr-ios-bar",style:{transform:`rotate(${o}deg) translateY(-8px)`,animationDelay:`${d}s`,opacity:u}},a)})})}),an=({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"?"✓":"!"})]}),pt=e.createContext(null),gt=({children:n})=>{const[r,s]=e.useState(null);return t.jsx(pt.Provider,{value:{activeItemId:r,setActiveItemId:s},children:n})};function yt(){return e.useContext(pt)}function Me(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const tt=({action:n,width:r,progress:s,index:c,total:a,side:o,onTrigger:d})=>{const u=Math.min(1,s*2),m=o==="right"?(a-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(--nice-color-primary, #3b82f6)",color:n.color||"var(--nice-bg-primary, #ffffff)",transform:`scale(${u})`,transitionDelay:`${m}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})]})},wt=e.forwardRef(({children:n,leftActions:r=[],rightActions:s=[],actionWidth:c=72,threshold:a=.4,direction:o,exclusive:d=!0,onSwipeStart:u,onSwipeEnd:m,onAction:N,disabled:y=!1,className:j="",style:R,itemId:f,hapticFeedback:b=!0},p)=>{const C=yt(),[D,M]=e.useState(0),[w,H]=e.useState(null),[A,E]=e.useState(!1),W=e.useRef(null),L=e.useRef(0),g=e.useRef(0),T=e.useRef(0),S=e.useRef(!1),Y=e.useRef(null),P=e.useRef(!1),B=-(r.length*c),Q=s.length*c,U=(o==="left"||o==="both"||!o)&&r.length>0,O=(o==="right"||o==="both"||!o)&&s.length>0,K=Math.min(1,Math.abs(D)/Math.abs(B)),Z=Math.min(1,D/Q),ee=e.useMemo(()=>f||`swipe-${Math.random().toString(36).substr(2,9)}`,[f]),I=e.useCallback(()=>{E(!0),M(0),H(null),setTimeout(()=>E(!1),300)},[]);e.useEffect(()=>{d&&C&&C.activeItemId!==null&&C.activeItemId!==ee&&w&&I()},[d,C,ee,w,I]);const V=e.useCallback(i=>{y||A||(L.current=i.touches[0].clientX,g.current=i.touches[0].clientY,T.current=D,S.current=!1,Y.current=null,P.current=!1)},[y,A,D]),F=e.useCallback(i=>{if(y||A)return;const l=i.touches[0].clientX,k=i.touches[0].clientY,$=l-L.current,q=k-g.current;if(!S.current){if(Math.abs($)<Math.abs(q))return;S.current=!0,Y.current=$<0?"left":"right",u==null||u(Y.current),d&&C&&C.setActiveItemId(ee)}let _=T.current+$;if(!U&&_<0&&(_=Math.max(_,-30)*.3),!O&&_>0&&(_=Math.min(_,30)*.3),U&&_<B){const se=B-_;_=B-se*.3}if(O&&_>Q){const se=_-Q;_=Q+se*.3}const re=Y.current==="left"?Math.abs(B)*a:Q*a,ie=Y.current==="left"?Math.abs(_):_;ie>=re&&!P.current?(P.current=!0,b&&Me("light")):ie<re&&P.current&&(P.current=!1),M(_),i.preventDefault()},[y,A,U,O,B,Q,a,b,d,C,ee,u]),X=e.useCallback(()=>{if(!S.current)return;S.current=!1,E(!0);const i=Math.abs(B)*a,l=Q*a;let k=0,$=null;Y.current==="left"&&U?Math.abs(D)>=i&&(k=B,$="left",b&&Me("medium")):Y.current==="right"&&O&&D>=l&&(k=Q,$="right",b&&Me("medium")),(w==="left"&&D>0||w==="right"&&D<0)&&(k=0,$=null),M(k),H($),m==null||m($),setTimeout(()=>E(!1),300)},[D,B,Q,a,U,O,w,b,m]),v=e.useCallback((i,l)=>{i.onClick(),N==null||N(i,l),b&&Me("heavy"),I()},[N,b,I]),h=e.useCallback(i=>{i.key==="Escape"&&w&&I()},[w,I]),x=e.useCallback(i=>{W.current=i,typeof p=="function"?p(i):p&&(p.current=i)},[p]);return t.jsxs("div",{ref:x,className:`nice-swipe-container ${j} ${w?`nice-swipe-container--open-${w}`:""}`,style:R,onKeyDown:h,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:Q},children:s.map((i,l)=>t.jsx(tt,{action:i,width:c,progress:Z,index:l,total:s.length,side:"right",onTrigger:()=>v(i,"right")},i.id))}),t.jsx("div",{className:"nice-swipe-content",style:{transform:`translateX(${D}px)`,transition:A?"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none"},onTouchStart:V,onTouchMove:F,onTouchEnd:X,children:n}),r.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--right",style:{width:Math.abs(B)},children:r.map((i,l)=>t.jsx(tt,{action:i,width:c,progress:K,index:l,total:r.length,side:"left",onTrigger:()=>v(i,"left")},i.id))})]})});wt.displayName="NiceSwipeActions";const ln=({children:n,className:r="",style:s})=>t.jsx(gt,{children:t.jsx("div",{className:`nice-swipe-list ${r}`,style:s,role:"list",children:n})}),on={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(--nice-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(--nice-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(--nice-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(--nice-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(--nice-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(--nice-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(--nice-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(--nice-color-info, #0ea5e9)",onClick:n})};function nt(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function un(n,r,s){return n==="full"?r*.95:n==="content"?Math.min(s,r*.9):r*n/100}const kt=e.forwardRef(({children:n,open:r,onClose:s,onSnapChange:c,snapPoints:a=[50,100],initialSnap:o=0,header:d,footer:u,showHandle:m=!0,showBackdrop:N=!0,closeOnBackdrop:y=!0,closeOnEscape:j=!0,dismissible:R=!0,velocityThreshold:f=.5,hapticFeedback:b=!0,handleColor:p,borderRadius:C=16,zIndex:D=1e3,className:M="",style:w,ariaLabel:H="Bottom sheet",size:A="md",disabled:E=!1,loading:W=!1,error:L},g)=>{const[T,S]=e.useState(o),[Y,P]=e.useState(0),[B,Q]=e.useState(!1),[U,O]=e.useState(typeof window<"u"?window.innerHeight:800),[K,Z]=e.useState(400),ee=e.useRef(null),I=e.useRef(null),V=e.useRef(0),F=e.useRef(0),X=e.useRef(0),v=e.useRef(0),h=e.useRef(0),x=e.useRef(-1),i=a.map(ne=>un(ne,U,K)),l=i[T]??i[0];e.useImperativeHandle(g,()=>({snapTo:ne=>{ne>=0&&ne<a.length&&(S(ne),P(0),c==null||c(ne,i[ne]))},close:()=>s(),getCurrentSnap:()=>T})),e.useEffect(()=>{const ne=()=>{O(window.innerHeight)};return window.addEventListener("resize",ne),()=>window.removeEventListener("resize",ne)},[]),e.useEffect(()=>{if(I.current&&r){const ne=I.current.scrollHeight;Z(ne+60)}},[r,n]),e.useEffect(()=>{if(!r||!j)return;const ne=te=>{te.key==="Escape"&&s()};return document.addEventListener("keydown",ne),()=>document.removeEventListener("keydown",ne)},[r,j,s]),e.useEffect(()=>{if(r){const ne=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=ne}}},[r]);const k=e.useCallback(ne=>{const te=U-l+ne,ae=U-te;for(let z=0;z<i.length;z++){const G=i[z];if(Math.abs(ae-G)<20&&x.current!==z){x.current=z,b&&nt("light");break}}},[U,l,i,b]),$=e.useCallback((ne,te)=>{if(te>f*2&&R&&ne<i[0]*.5)return-1;if(te<-f)return i.length-1;if(te>f)return R&&ne<i[0]*.7?-1:0;let ae=0,z=Math.abs(ne-i[0]);for(let G=1;G<i.length;G++){const J=Math.abs(ne-i[G]);J<z&&(z=J,ae=G)}return R&&ne<i[0]*.5?-1:ae},[i,f,R]),q=e.useCallback(ne=>{V.current=ne.touches[0].clientY,F.current=Y,X.current=ne.touches[0].clientY,v.current=Date.now(),h.current=0,x.current=-1,Q(!0)},[Y]),_=e.useCallback(ne=>{if(!B)return;const te=ne.touches[0].clientY,ae=te-V.current,z=Date.now(),G=z-v.current;G>0&&(h.current=(te-X.current)/G),X.current=te,v.current=z;let J=F.current+ae;const ce=l+50;if(J>ce){const ue=J-ce;J=ce+ue*.2}const le=-(U*.95-l);if(J<le){const ue=le-J;J=le-ue*.2}P(J),k(J),ne.preventDefault()},[B,l,U,k]),re=e.useCallback(()=>{if(!B)return;Q(!1);const ne=l-Y,te=$(ne,h.current);if(te===-1)P(l+100),setTimeout(()=>{s(),P(0),S(o)},300);else{const ae=i[te];P(0),S(te),te!==T&&(c==null||c(te,ae),b&&nt("medium"))}},[B,l,Y,$,T,i,s,c,o,b]),ie=e.useCallback(ne=>{y&&ne.target===ne.currentTarget&&s()},[y,s]);if(!r)return null;const se=Math.max(0,l-Y),oe=Math.min(.5,se/U*.8);return t.jsxs("div",{className:`nice-bottom-sheet-container ${M}`,style:{zIndex:D},children:[N&&t.jsx("div",{className:"nice-bottom-sheet-backdrop",style:{opacity:oe},onMouseDown:ie,"aria-hidden":"true"}),t.jsxs("div",{ref:ee,className:`nice-bottom-sheet nice-bottom-sheet--${A} ${B?"nice-bottom-sheet--dragging":""} ${E?"nice-bottom-sheet--disabled":""} ${W?"nice-bottom-sheet--loading":""} ${L?"nice-bottom-sheet--error":""}`,style:{...w,height:se,borderTopLeftRadius:C,borderTopRightRadius:C,transition:B?"none":"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},role:"dialog","aria-modal":"true","aria-label":H,"aria-disabled":E||void 0,"aria-busy":W||void 0,children:[L&&t.jsx("div",{className:"nice-bottom-sheet-error",role:"alert",children:L}),W&&t.jsx("span",{className:"nice-bottom-sheet-spinner","aria-hidden":"true",children:t.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),m&&t.jsx("div",{className:"nice-bottom-sheet-handle",onTouchStart:q,onTouchMove:_,onTouchEnd:re,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:I,className:"nice-bottom-sheet-content",onTouchStart:q,onTouchMove:_,onTouchEnd:re,children:n}),u&&t.jsx("div",{className:"nice-bottom-sheet-footer",children:u})]})]})});kt.displayName="NiceBottomSheet";function dn(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function rt(n,r){return Math.hypot(r.x-n.x,r.y-n.y)}function st(n,r){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}const jt=e.forwardRef(({items:n,selectedIndex:r=0,onIndexChange:s,onClose:c,showClose:a=!0,showCounter:o=!0,showCaption:d=!0,showThumbnails:u=!1,enablePinchZoom:m=!0,enableDoubleTapZoom:N=!0,enableSwipe:y=!0,enableKeyboard:j=!0,minZoom:R=1,maxZoom:f=4,doubleTapZoom:b=2.5,swipeThreshold:p=50,loop:C=!0,hapticFeedback:D=!0,backgroundColor:M="var(--nice-overlay-95, rgba(0, 0, 0, 0.95))",zIndex:w=2e3,className:H="",style:A},E)=>{const[W,L]=e.useState(r),[g,T]=e.useState(1),[S,Y]=e.useState(0),[P,B]=e.useState(0),[Q,U]=e.useState(!1),[O,K]=e.useState({}),Z=e.useRef(null),ee=e.useRef(null),I=e.useRef([]),V=e.useRef(0),F=e.useRef(1),X=e.useRef({x:0,y:0}),v=e.useRef(0),h=e.useRef({x:0,y:0}),x=e.useRef(!1),i=e.useRef(!1),l=e.useRef(null),k=n[W],$=e.useCallback(z=>{let G=z;C?G=(z%n.length+n.length)%n.length:G=Math.max(0,Math.min(n.length-1,z)),G!==W&&(U(!0),L(G),T(1),Y(0),B(0),s==null||s(G,n[G]),D&&dn("light"),setTimeout(()=>U(!1),300))},[W,n,C,s,D]),q=e.useCallback(()=>$(W+1),[$,W]),_=e.useCallback(()=>$(W-1),[$,W]),re=e.useCallback((z,G,J)=>{const ce=Math.max(R,Math.min(f,z));T(ce),ce<=1&&(Y(0),B(0))},[R,f]),ie=e.useCallback(()=>re(g*1.5),[g,re]),se=e.useCallback(()=>re(g/1.5),[g,re]),oe=e.useCallback(()=>{T(1),Y(0),B(0)},[]);e.useImperativeHandle(E,()=>({goTo:$,goNext:q,goPrev:_,zoomIn:ie,zoomOut:se,resetZoom:oe,close:()=>c==null?void 0:c()})),e.useEffect(()=>{if(!j)return;const z=G=>{switch(G.key){case"ArrowLeft":_();break;case"ArrowRight":q();break;case"ArrowUp":ie();break;case"ArrowDown":se();break;case"Escape":c==null||c();break;case"0":case"Home":oe();break}};return window.addEventListener("keydown",z),()=>window.removeEventListener("keydown",z)},[j,q,_,ie,se,oe,c]);const ne=e.useCallback(z=>{const G=Array.from(z.touches).map(J=>({x:J.clientX,y:J.clientY,id:J.identifier}));if(I.current=G,h.current={x:G[0].x,y:G[0].y},i.current=!1,l.current=null,G.length===2&&m)x.current=!0,V.current=rt(G[0],G[1]),F.current=g,X.current={x:S,y:P};else if(G.length===1){const J=Date.now();J-v.current<300&&N?(g>1.1?oe():re(b,G[0].x,G[0].y),v.current=0):v.current=J,X.current={x:S,y:P}}},[g,S,P,m,N,b,oe,re]),te=e.useCallback(z=>{const G=Array.from(z.touches).map(J=>({x:J.clientX,y:J.clientY,id:J.identifier}));if(G.length===2&&x.current&&m){const ce=rt(G[0],G[1])/V.current,le=F.current*ce;re(le);const ue=st(G[0],G[1]),fe=st(I.current[0],I.current[1]||I.current[0]),he=ue.x-fe.x,Ae=ue.y-fe.y;Y(X.current.x+he),B(X.current.y+Ae),z.preventDefault()}else if(G.length===1){const J=G[0].x-h.current.x,ce=G[0].y-h.current.y;if(l.current||(Math.abs(J)>10||Math.abs(ce)>10)&&(l.current=Math.abs(J)>Math.abs(ce)?"horizontal":"vertical",i.current=!0),g>1.1){const le=X.current.x+J,ue=X.current.y+ce;Y(le),B(ue)}z.preventDefault()}},[g,m,re]),ae=e.useCallback(z=>{if(x.current){x.current=!1;return}const G=z.changedTouches[0],J=G.clientX-h.current.x;G.clientY-h.current.y,y&&g<=1.1&&l.current==="horizontal"&&(J>p?_():J<-p&&q()),g<=1.1&&(Y(0),B(0)),i.current=!1,l.current=null},[g,y,p,q,_]);return e.useEffect(()=>{n.forEach((z,G)=>{const J=new Image;J.onload=()=>{K(ce=>({...ce,[G]:!0}))},J.src=z.src})},[n]),n.length===0?null:t.jsxs("div",{ref:Z,className:`nice-image-gallery ${H}`,style:{...A,backgroundColor:M,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:[W+1," / ",n.length]}),t.jsxs("div",{className:"nice-image-gallery-actions",children:[t.jsx("button",{className:"nice-image-gallery-btn",onClick:se,disabled:g<=R,"aria-label":"Zoom out",children:"−"}),t.jsx("button",{className:"nice-image-gallery-btn",onClick:ie,disabled:g>=f,"aria-label":"Zoom in",children:"+"}),a&&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:ne,onTouchMove:te,onTouchEnd:ae,children:[t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--prev",onClick:_,disabled:!C&&W===0,"aria-label":"Previous image",children:"‹"}),t.jsxs("div",{className:"nice-image-gallery-image-container",children:[k.placeholder&&!O[W]&&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 ${Q?"nice-image-gallery-image--animating":""}`,style:{transform:`scale(${g}) translate(${S/g}px, ${P/g}px)`,transition:x.current||i.current?"none":"transform 0.2s ease-out"},draggable:!1})]}),t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--next",onClick:q,disabled:!C&&W===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((z,G)=>t.jsx("button",{className:`nice-image-gallery-thumb ${G===W?"nice-image-gallery-thumb--active":""}`,onClick:()=>$(G),"aria-label":`Go to image ${G+1}`,children:t.jsx("img",{src:z.thumbnail||z.src,alt:z.alt||"",loading:"lazy"})},G))}),!u&&n.length>1&&n.length<=10&&t.jsx("div",{className:"nice-image-gallery-dots",children:n.map((z,G)=>t.jsx("button",{className:`nice-image-gallery-dot ${G===W?"nice-image-gallery-dot--active":""}`,onClick:()=>$(G),"aria-label":`Go to image ${G+1}`},G))})]})});jt.displayName="NiceImageGallery";const Nt=e.createContext(null);function fn(){const n=e.useContext(Nt);if(!n)throw new Error("useInfiniteScroll must be used within NiceInfiniteScroll");return n}const ct=()=>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..."})]}),hn=()=>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"})]}),vn=({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"})]}),bn=()=>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"})]}),mn=({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 xn({items:n,renderItem:r,onLoadMore:s,hasMore:c,isLoading:a=!1,error:o=null,threshold:d=200,loadingIndicator:u,endIndicator:m,errorIndicator:N,onRetry:y,pullToRefresh:j=!1,onRefresh:R,direction:f="vertical",reverse:b=!1,initialScrollPosition:p="top",keyboardNav:C=!0,keyExtractor:D,emptyContent:M,header:w,footer:H,gap:A=0,className:E="",style:W,ariaLabel:L="Scrollable list"},g){const[T,S]=e.useState("idle"),[Y,P]=e.useState(!1),[B,Q]=e.useState(!1),U=e.useRef(null),O=e.useRef(null),K=e.useRef(!1),Z=e.useRef(null);e.useEffect(()=>{o?S("error"):a?S("loading"):!c&&n.length>0?S("end"):S("idle")},[o,a,c,n.length]);const ee=e.useCallback((i,l)=>D?D(i,l):`item-${l}`,[D]),I=e.useCallback(async()=>{if(!(K.current||!c||o)){K.current=!0;try{await s()}finally{K.current=!1}}},[c,o,s]),V=e.useCallback(()=>{var i;(i=U.current)==null||i.scrollTo({top:0,behavior:"smooth"})},[]),F=e.useCallback(()=>{U.current&&U.current.scrollTo({top:U.current.scrollHeight,behavior:"smooth"})},[]);e.useEffect(()=>{if(!O.current)return;const i=l=>{const[k]=l;k.isIntersecting&&c&&!a&&!o&&I()};return Z.current=new IntersectionObserver(i,{root:U.current,rootMargin:`${d}px`,threshold:.1}),Z.current.observe(O.current),()=>{var l;(l=Z.current)==null||l.disconnect()}},[c,a,o,d,I]),e.useEffect(()=>{const i=U.current;if(!i)return;const l=()=>{const k=f==="vertical"?i.scrollTop:i.scrollLeft;P(k>500)};return i.addEventListener("scroll",l,{passive:!0}),()=>i.removeEventListener("scroll",l)},[f]),e.useEffect(()=>{p==="bottom"&&U.current&&(U.current.scrollTop=U.current.scrollHeight)},[p]);const X=e.useCallback(i=>{C&&(i.key==="Home"?(i.preventDefault(),V()):i.key==="End"&&(i.preventDefault(),F()))},[C,V,F]);e.useCallback(async()=>{if(!(!R||B)){Q(!0);try{await R()}finally{Q(!1)}}},[R,B]);const v=e.useCallback(i=>{U.current=i,typeof g=="function"?g(i):g&&(g.current=i)},[g]),h=e.useMemo(()=>({status:T,loadMore:I,hasMore:c,itemCount:n.length,scrollToTop:V,scrollToBottom:F}),[T,I,c,n.length,V,F]),x=e.useMemo(()=>(b?[...n].reverse():n).map((l,k)=>t.jsx("div",{className:"nice-infinite-item","data-index":k,children:r(l,k)},ee(l,k))),[n,b,ee,r]);return n.length===0&&!a&&!o?t.jsx("div",{ref:v,className:`nice-infinite-container nice-infinite-container--empty ${E}`,style:W,role:"region","aria-label":L,children:M||t.jsx(bn,{})}):t.jsx(Nt.Provider,{value:h,children:t.jsxs("div",{ref:v,className:`nice-infinite-container nice-infinite-container--${f} ${b?"nice-infinite-container--reverse":""} ${E}`,style:W,onKeyDown:X,tabIndex:0,role:"feed","aria-label":L,"aria-busy":a,children:[w&&t.jsx("div",{className:"nice-infinite-header",children:w}),j&&B&&t.jsx("div",{className:"nice-infinite-pull",children:u||t.jsx(ct,{})}),t.jsx("div",{className:"nice-infinite-items",style:{gap:A},children:x}),t.jsx("div",{ref:O,className:"nice-infinite-sentinel","aria-hidden":"true"}),T==="loading"&&(u||t.jsx(ct,{})),T==="error"&&o&&(N||t.jsx(vn,{message:o,onRetry:y})),T==="end"&&(m||t.jsx(hn,{})),H&&t.jsx("div",{className:"nice-infinite-footer",children:H}),t.jsx(mn,{visible:Y,onClick:V})]})})}const pn=e.forwardRef(xn);function gn(n){const{fetchPage:r,initialCursor:s,refetchOnFocus:c=!1}=n,[a,o]=e.useState([]),[d,u]=e.useState(s),[m,N]=e.useState(!1),[y,j]=e.useState(null),[R,f]=e.useState(!0),[b,p]=e.useState(!1),C=e.useCallback(async()=>{if(!(m||!R)){N(!0),j(null);try{const w=await r(d);o(H=>[...H,...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,m,R]),D=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]),M=e.useCallback(()=>{o([]),u(s),f(!0),j(null),p(!1)},[s]);return e.useEffect(()=>{!b&&!m&&C()},[b,m,C]),e.useEffect(()=>{if(!c)return;const w=()=>{b&&D()};return window.addEventListener("focus",w),()=>window.removeEventListener("focus",w)},[c,b,D]),{items:a,isLoading:m,error:y,hasMore:R,loadMore:C,refresh:D,reset:M}}function yn(n){const{itemCount:r,itemHeight:s,overscan:c=5,containerRef:a}=n,[o,d]=e.useState(0),[u,m]=e.useState(0),N=e.useCallback(f=>typeof s=="function"?s(f):s,[s]),y=e.useMemo(()=>{let f=0;for(let b=0;b<r;b++)f+=N(b);return f},[r,N]),j=e.useMemo(()=>{const f=[];let b=0,p=-1,C=-1;for(let D=0;D<r;D++){const M=N(D),w=b+M;w>=o&&p===-1&&(p=D),b<=o+u&&(C=D),b=w}p=Math.max(0,p-c),C=Math.min(r-1,C+c),b=0;for(let D=0;D<r;D++){const M=N(D);D>=p&&D<=C&&f.push({index:D,start:b,size:M,end:b+M}),b+=M}return f},[r,N,o,u,c]);e.useEffect(()=>{const f=a.current;if(!f)return;m(f.clientHeight);const b=()=>{d(f.scrollTop)},p=()=>{m(f.clientHeight)};return f.addEventListener("scroll",b,{passive:!0}),window.addEventListener("resize",p),()=>{f.removeEventListener("scroll",b),window.removeEventListener("resize",p)}},[a]);const R=e.useCallback(f=>{const b=a.current;if(!b)return;let p=0;for(let C=0;C<f&&C<r;C++)p+=N(C);b.scrollTo({top:p,behavior:"smooth"})},[a,r,N]);return{virtualItems:j,totalSize:y,scrollToIndex:R}}const Mt=e.createContext(null);function wn(){const n=e.useContext(Mt);if(!n)throw new Error("useMobileDrawer must be used within NiceMobileDrawer");return n}const Tt=({item:n,depth:r=0,onSelect:s,activeId:c})=>{const[a,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 m=()=>{n.disabled||(d?o(!a):(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:m,disabled:n.disabled,"aria-expanded":d?a: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 ${a?"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&&a&&t.jsx("div",{className:"nice-drawer-nav-children",children:n.children.map(N=>t.jsx(Tt,{item:N,depth:r+1,onSelect:s,activeId:c},N.id))})]})},Rt=e.forwardRef(({open:n,onClose:r,position:s="left",variant:c="overlay",size:a,children:o,navItems:d,header:u,footer:m,swipeToOpen:N=!0,swipeToClose:y=!0,edgeSwipeWidth:j=20,velocityThreshold:R=.3,showOverlay:f=!0,closeOnOverlayClick:b=!0,closeOnEscape:p=!0,disableBodyScroll:C=!0,overlayColor:D,zIndex:M=1e3,onNavSelect:w,activeNavId:H,className:A="",style:E,ariaLabel:W="Navigation drawer"},L)=>{const[g,T]=e.useState(0),[S,Y]=e.useState(!1),[P,B]=e.useState(H),Q=e.useRef(null),U=e.useRef({x:0,y:0}),O=e.useRef(0),K=e.useRef({x:0,y:0}),Z=s==="left"||s==="right",I=a??(Z?280:400);e.useEffect(()=>{H!==void 0&&B(H)},[H]),e.useEffect(()=>{if(C&&n){const l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}}},[n,C]),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||!Q.current)return;const l=Q.current,k=l.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),$=k[0],q=k[k.length-1],_=re=>{re.key==="Tab"&&(re.shiftKey&&document.activeElement===$?(re.preventDefault(),q==null||q.focus()):!re.shiftKey&&document.activeElement===q&&(re.preventDefault(),$==null||$.focus()))};return l.addEventListener("keydown",_),$==null||$.focus(),()=>l.removeEventListener("keydown",_)},[n]);const V=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 Z?`translateX(calc(${l}% + ${k}px))`:`translateY(calc(${l}% + ${k}px))`},[n,s,g,Z]),F=e.useCallback(l=>{if(!y&&n)return;const k=l.touches[0];U.current={x:k.clientX,y:k.clientY},K.current={x:k.clientX,y:k.clientY},O.current=Date.now()},[y,n]),X=e.useCallback(l=>{if(!y||!n)return;const k=l.touches[0],$=k.clientX-U.current.x,q=k.clientY-U.current.y;let _=!1,re=0;switch(s){case"left":_=$<0,re=Math.min(0,$);break;case"right":_=$>0,re=Math.max(0,$);break;case"top":_=q<0,re=Math.min(0,q);break;case"bottom":_=q>0,re=Math.max(0,q);break}_&&Math.abs(Z?$:q)>10&&(Y(!0),T(re),K.current={x:k.clientX,y:k.clientY},l.preventDefault())},[y,n,s,Z]),v=e.useCallback(()=>{if(!S)return;const l=Date.now()-O.current,k=Math.abs(g),$=typeof I=="number"?I:280,q=k/l;(k>$*.3||q>R)&&r(),Y(!1),T(0)},[S,g,I,R,Z,r]);e.useEffect(()=>{if(!N||n)return;let l=0,k=0,$=!1;const q=re=>{const ie=re.touches[0];l=ie.clientX,k=ie.clientY;const se=window.innerWidth,oe=window.innerHeight;switch(s){case"left":$=l<j;break;case"right":$=l>se-j;break;case"top":$=k<j;break;case"bottom":$=k>oe-j;break}},_=re=>{if(!$)return;const ie=re.touches[0],se=ie.clientX-l,oe=ie.clientY-k,ne=50;let te=!1;switch(s){case"left":te=se>ne;break;case"right":te=se<-ne;break;case"top":te=oe>ne;break;case"bottom":te=oe<-ne;break}te&&re.preventDefault()};return document.addEventListener("touchstart",q,{passive:!0}),document.addEventListener("touchmove",_,{passive:!1}),()=>{document.removeEventListener("touchstart",q),document.removeEventListener("touchmove",_)}},[N,n,s,j]);const h=e.useCallback(l=>{B(l.id),w==null||w(l),l.href&&r()},[w,r]),x=e.useCallback(l=>{Q.current=l,typeof L=="function"?L(l):L&&(L.current=l)},[L]),i=e.useMemo(()=>({isOpen:n,position:s,close:r,activeNavId:P,setActiveNavId:B}),[n,s,r,P]);return t.jsxs(Mt.Provider,{value:i,children:[f&&c!=="persistent"&&t.jsx("div",{className:`nice-drawer-overlay ${n?"nice-drawer-overlay--visible":""}`,style:{zIndex:M-1,background:D,opacity:S?1-Math.abs(g)/(typeof I=="number"?I:280):void 0},onClick:b?r:void 0,"aria-hidden":"true"}),t.jsxs("div",{ref:x,className:`nice-drawer nice-drawer--${s} nice-drawer--${c} ${n?"nice-drawer--open":""} ${S?"nice-drawer--dragging":""} ${A}`,style:{...E,[Z?"width":"height"]:I,zIndex:M,transform:V()},onTouchStart:F,onTouchMove:X,onTouchEnd:v,role:"dialog","aria-modal":c!=="persistent","aria-label":W,"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(Tt,{item:l,onSelect:h,activeId:P},l.id))}):o}),m&&t.jsx("div",{className:"nice-drawer-footer",children:m})]})]})});Rt.displayName="NiceMobileDrawer";function kn(n={}){const{defaultOpen:r=!1,onOpenChange:s}=n,[c,a]=e.useState(r),o=e.useCallback(()=>{a(!0),s==null||s(!0)},[s]),d=e.useCallback(()=>{a(!1),s==null||s(!1)},[s]),u=e.useCallback(()=>{a(N=>{const y=!N;return s==null||s(y),y})},[s]),m=e.useCallback(N=>{a(N),s==null||s(N)},[s]);return{isOpen:c,open:o,close:d,toggle:u,setOpen:m}}const jn={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"})]})},Dt=e.createContext(null);function Nn(){const n=e.useContext(Dt);if(!n)throw new Error("useMobileModal must be used within a NiceMobileModal");return n}function Mn(n={}){const{defaultOpen:r=!1,open:s,onOpenChange:c,preventDismiss:a=!1}=n,[o,d]=e.useState(r),u=s!==void 0,m=u?s:o,N=e.useCallback((f,b)=>{!f&&a&&b!=="close"||(u||d(f),c==null||c(f,b))},[u,c,a]),y=e.useCallback(()=>N(!0),[N]),j=e.useCallback(f=>N(!1,f),[N]),R=e.useCallback(()=>N(!m),[N,m]);return{open:m,openModal:y,closeModal:j,toggle:R,setOpen:f=>N(f)}}const Tn=()=>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 Rn(n,r,s){return n==="content"?Math.min(s,r):n==="full"?r:n<=1?r*n:Math.min(n,r)}function Dn(n,r,s){return Math.min(Math.max(n,r),s)}const qe=e.forwardRef(function({open:r,onClose:s,title:c,children:a,footer:o,snapPoints:d=["content"],defaultSnapPoint:u=0,showHandle:m=!0,showClose:N=!0,showOverlay:y=!0,dismissOnDrag:j=!0,dismissOnOverlay:R=!0,dismissOnEscape:f=!0,preventDismiss:b=!1,onSnapChange:p,className:C="",overlayClassName:D="",headerClassName:M="",contentClassName:w="",footerClassName:H="",lockScroll:A=!0,borderRadius:E=16,zIndex:W,style:L,...g},T){const Y=`${e.useId()}-title`,P=e.useRef(null),B=e.useRef(null),Q=e.useRef(0),U=e.useRef(0),O=e.useRef(!1),[K,Z]=e.useState(u),[ee,I]=e.useState(0),[V,F]=e.useState(400),[X,v]=e.useState(typeof window<"u"?window.innerHeight:800),[h,x]=e.useState(!1),i=d.map(z=>Rn(z,X,V));e.useEffect(()=>{if(typeof window>"u")return;const z=()=>{v(window.innerHeight)};return window.addEventListener("resize",z),()=>window.removeEventListener("resize",z)},[]),e.useEffect(()=>{if(!B.current||!r)return;const z=new ResizeObserver(G=>{for(const J of G){const ce=J.contentRect.height+100;F(Math.min(ce,X*.9))}});return z.observe(B.current),()=>z.disconnect()},[r,X]),e.useEffect(()=>{if(r){const z=i[u]||i[0]||X*.5;I(z),Z(u)}},[r]),e.useEffect(()=>{if(r&&!h){const z=i[K]||i[0];I(z)}},[i.join(","),K,h,r]),e.useEffect(()=>{if(!A||!r)return;const z=document.body.style.overflow,G=document.body.style.paddingRight,J=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",J>0&&(document.body.style.paddingRight=`${J}px`),()=>{document.body.style.overflow=z,document.body.style.paddingRight=G}},[r,A]),e.useEffect(()=>{if(!r||!f||b)return;const z=G=>{G.key==="Escape"&&(s==null||s("escape"))};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[r,f,b,s]),e.useEffect(()=>{if(!r||!P.current)return;const G=P.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),J=G[0],ce=G[G.length-1],le=ue=>{ue.key==="Tab"&&(ue.shiftKey?document.activeElement===J&&(ue.preventDefault(),ce==null||ce.focus()):document.activeElement===ce&&(ue.preventDefault(),J==null||J.focus()))};return document.addEventListener("keydown",le),requestAnimationFrame(()=>{J==null||J.focus()}),()=>document.removeEventListener("keydown",le)},[r]);const l=e.useCallback(z=>{b&&z!=="close"||s==null||s(z)},[b,s]),k=e.useCallback(()=>{R&&l("overlay")},[R,l]),$=e.useCallback((z,G)=>{if(G>.5&&j&&!b)return-1;if(G<-.5)return i.length-1;let J=0,ce=Math.abs(i[0]-z);for(let le=1;le<i.length;le++){const ue=Math.abs(i[le]-z);ue<ce&&(ce=ue,J=le)}return J},[i,j,b]),q=e.useCallback(z=>{O.current=!0,Q.current=z,U.current=ee,x(!0)},[ee]),_=e.useCallback(z=>{if(!O.current)return;const G=Q.current-z,J=Dn(U.current+G,50,X);I(J)},[X]),re=e.useCallback((z,G)=>{if(!O.current)return;O.current=!1,x(!1);const J=$(ee,G);if(J===-1){l("drag");return}Z(J),I(i[J]),p==null||p(J,d[J])},[ee,$,l,i,d,p]),ie=z=>{q(z.touches[0].clientY)},se=z=>{_(z.touches[0].clientY)},oe=z=>{const G=z.changedTouches[0],J=(Q.current-G.clientY)/(z.timeStamp-(z.timeStamp-200));re(G.clientY,J>0?-J/1e3:J/1e3)},ne=z=>{z.preventDefault(),q(z.clientY);const G=ce=>{_(ce.clientY)},J=ce=>{const le=(Q.current-ce.clientY)/200;re(ce.clientY,le>0?-le/500:le/500),document.removeEventListener("mousemove",G),document.removeEventListener("mouseup",J)};document.addEventListener("mousemove",G),document.addEventListener("mouseup",J)},te=e.useCallback(z=>{z<0||z>=i.length||(Z(z),I(i[z]),p==null||p(z,d[z]))},[i,d,p]),ae={isOpen:r,snapPoints:d,currentSnapIndex:K,setSnapIndex:te,close:l};return r?t.jsxs(t.Fragment,{children:[y&&t.jsx("div",{className:`nice-mobile-modal-overlay nice-mobile-modal-overlay--visible ${D}`,onClick:k,"aria-hidden":"true",style:{zIndex:W?W-1:void 0}}),t.jsx(Dt.Provider,{value:ae,children:t.jsxs("div",{ref:z=>{P.current=z,typeof T=="function"?T(z):T&&(T.current=z)},role:"dialog","aria-modal":"true","aria-labelledby":c?Y:void 0,className:`nice-modal-sheet ${h?"nice-modal-sheet--dragging":""} ${C}`,style:{height:ee,borderTopLeftRadius:E,borderTopRightRadius:E,zIndex:W,...L},...g,children:[m&&t.jsx("div",{className:"nice-modal-handle-area",onTouchStart:ie,onTouchMove:se,onTouchEnd:oe,onMouseDown:ne,children:t.jsx("div",{className:"nice-modal-handle"})}),(c||N)&&t.jsxs("div",{className:`nice-modal-header ${M}`,children:[c&&t.jsx("h2",{id:Y,className:"nice-modal-title",children:c}),N&&!b&&t.jsx("button",{type:"button",className:"nice-modal-close",onClick:()=>l("close"),"aria-label":"Close modal",children:t.jsx(Tn,{})})]}),t.jsx("div",{ref:B,className:`nice-modal-content ${w}`,children:a}),o&&t.jsx("div",{className:`nice-modal-footer ${H}`,children:o})]})})]}):null}),Sn=e.forwardRef(function({actions:r,cancelLabel:s="Cancel",onClose:c,...a},o){return t.jsx(qe,{ref:o,onClose:c,showHandle:!0,showClose:!1,snapPoints:["content"],...a,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})]})})}),Cn=e.forwardRef(function({title:r,message:s,confirmLabel:c="Confirm",cancelLabel:a="Cancel",confirmDestructive:o=!1,onConfirm:d,onCancel:u,onClose:m,...N},y){const j=()=>{d==null||d(),m==null||m("close")},R=()=>{u==null||u(),m==null||m("close")};return t.jsx(qe,{ref:y,title:r,onClose:m,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:a}),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})})}),St=e.createContext(null);function Pn(){const n=e.useContext(St);if(!n)throw new Error("useMobileTabs must be used within a NiceMobileTabs");return n}function $n(n){var j;const{tabs:r,defaultTab:s,activeTab:c,onChange:a}=n,[o,d]=e.useState(s||((j=r[0])==null?void 0:j.id)||""),u=c!==void 0,m=u?c:o,N=e.useCallback(R=>{const f=r.find(b=>b.id===R);!f||f.disabled||(u||d(R),a==null||a(R))},[r,u,a]),y=e.useCallback(R=>m===R,[m]);return{activeTab:m,setActiveTab:N,tabs:r,isActive:y}}const de={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"})]})},it=({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})},at=({tab:n,isActive:r,showLabel:s,animation:c,activeColor:a,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 m=r&&n.activeIcon?n.activeIcon:n.icon,N={};return r&&a?N.color=a:!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:m}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(it,{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:m}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(it,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]})},In=e.forwardRef(function({tabs:r,activeTab:s,defaultTab:c,onChange:a,showLabels:o=!0,showAllLabels:d=!0,position:u="bottom",variant:m="default",haptic:N=!0,animation:y="scale",maxTabs:j,moreLabel:R="More",moreIcon:f=de.more,safeArea:b=!0,activeColor:p,inactiveColor:C,backgroundColor:D,hideOnScroll:M="none",lockScroll:w=!0,className:H="",style:A,...E},W){var ee;const[L,g]=e.useState(c||((ee=r[0])==null?void 0:ee.id)||""),[T,S]=e.useState(!1),Y=e.useRef(0),P=s!==void 0,B=P?s:L;e.useEffect(()=>{if(M==="none"||typeof window>"u")return;const I=()=>{const V=window.scrollY,F=V>Y.current?"down":"up";F===M&&V>50?S(!0):F!==M&&S(!1),Y.current=V};return window.addEventListener("scroll",I,{passive:!0}),()=>window.removeEventListener("scroll",I)},[M]);const Q=e.useCallback(I=>{const V=r.find(F=>F.id===I);!V||V.disabled||(N&&"vibrate"in navigator&&navigator.vibrate(10),P||g(I),a==null||a(I))},[r,N,P,a]),U=j&&r.length>j?r.slice(0,j-1):r,O=j&&r.length>j?r.slice(j-1):[],K={activeTab:B,setActiveTab:Q,tabs:r},Z={...A};return D&&(Z.backgroundColor=D),t.jsx(St.Provider,{value:K,children:t.jsxs("nav",{ref:W,className:`nice-mobile-tabs nice-mobile-tabs--${u} nice-mobile-tabs--${m} ${b?"nice-mobile-tabs--safe-area":""} ${T?"nice-mobile-tabs--hidden":""} ${H}`,style:Z,role:"tablist","aria-label":"Main navigation",...E,children:[U.map(I=>{const V=I.id===B,F=d||o&&V;return t.jsx(at,{tab:I,isActive:V,showLabel:F,animation:y,activeColor:p,inactiveColor:C,onClick:()=>Q(I.id)},I.id)}),O.length>0&&t.jsx(at,{tab:{id:"__more__",label:R,icon:f,badge:O.some(I=>I.badge)?!0:void 0},isActive:O.some(I=>I.id===B),showLabel:d||o,animation:y,activeColor:p,inactiveColor:C,onClick:()=>{console.log("Open more menu",O)}})]})})}),En={basic:[{id:"home",label:"Home",icon:de.home,activeIcon:de.homeFilled},{id:"search",label:"Search",icon:de.search},{id:"notifications",label:"Alerts",icon:de.bell,activeIcon:de.bellFilled},{id:"profile",label:"Profile",icon:de.user,activeIcon:de.userFilled}],social:[{id:"feed",label:"Feed",icon:de.home,activeIcon:de.homeFilled},{id:"discover",label:"Discover",icon:de.search},{id:"create",label:"Create",icon:de.plus},{id:"activity",label:"Activity",icon:de.heart,activeIcon:de.heartFilled},{id:"profile",label:"Profile",icon:de.user,activeIcon:de.userFilled}],ecommerce:[{id:"shop",label:"Shop",icon:de.home,activeIcon:de.homeFilled},{id:"search",label:"Search",icon:de.search},{id:"cart",label:"Cart",icon:de.cart},{id:"favorites",label:"Wishlist",icon:de.heart,activeIcon:de.heartFilled},{id:"account",label:"Account",icon:de.user,activeIcon:de.userFilled}],messaging:[{id:"chats",label:"Chats",icon:de.inbox},{id:"calls",label:"Calls",icon:de.bell},{id:"contacts",label:"Contacts",icon:de.user,activeIcon:de.userFilled},{id:"settings",label:"Settings",icon:de.settings}]},Ct=e.createContext(null);function Ln(){const n=e.useContext(Ct);if(!n)throw new Error("useMobileHeader must be used within a NiceMobileHeader");return n}function Bn(n={}){const{collapsedHeight:r=56,expandedHeight:s=200,scrollElement:c,mode:a="scroll",threshold:o=0}=n,[d,u]=e.useState(0),[m,N]=e.useState(!0),y=e.useRef(null),j=e.useRef(0),R=e.useRef(!1),f=s-r,b=s-d*f,p=d>=1;e.useEffect(()=>{const M=c||y.current||window,w=()=>{R.current||(R.current=!0,requestAnimationFrame(()=>{const H=M===window?window.scrollY:M.scrollTop,A=H-j.current;if(a==="scroll"||a==="exitUntilCollapsed"){const E=Math.min(1,Math.max(0,(H-o)/f));u(E)}if(a==="enterAlways"){A>5&&H>o?N(!1):A<-5&&N(!0);const E=f>0?Math.min(1,Math.max(0,H/f)):0;u(E)}j.current=H,R.current=!1}))};return M.addEventListener("scroll",w,{passive:!0}),w(),()=>M.removeEventListener("scroll",w)},[c,a,o,f]);const C=e.useCallback(()=>{u(0),N(!0)},[]),D=e.useCallback(()=>{u(1)},[]);return{progress:d,height:b,isCollapsed:p,isVisible:m,scrollRef:y,expand:C,collapse:D}}const Hn=()=>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"})}),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("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"})]}),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:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),Fn=()=>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"})]}),Vn={back:t.jsx(Hn,{}),menu:t.jsx(An,{}),search:t.jsx(Yn,{}),more:t.jsx(Fn,{})},zn=({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:a,rightActions:o=[],background:d,mode:u="scroll",variant:m="default",collapsedHeight:N=56,expandedHeight:y=s||d?140:56,parallax:j=!1,parallaxSpeed:R=.5,showShadow:f=!0,sticky:b=!0,zIndex:p=100,scrollElement:C,onCollapseChange:D,safeArea:M=!0,backgroundColor:w,textColor:H,showBorder:A=!1,collapsedContent:E,expandedContent:W,className:L="",style:g,children:T,...S},Y){const[P,B]=e.useState(0),[Q,U]=e.useState(!0),O=e.useRef(null),K=e.useRef(0),Z=e.useRef(!1),ee=y-N,I=y-P*ee,V=P>=.9;e.useEffect(()=>{const l=C||window,k=()=>{Z.current||(Z.current=!0,requestAnimationFrame(()=>{const $=l===window?window.scrollY:l.scrollTop,q=$-K.current;if(u==="scroll"||u==="exitUntilCollapsed"){const _=ee>0?Math.min(1,Math.max(0,$/ee)):0;B(_),D&&Math.abs(_-P)>.05&&D(_>=.9,_)}if(u==="enterAlways"){q>5&&$>N?U(!1):q<-5&&U(!0);const _=ee>0?Math.min(1,Math.max(0,$/ee)):0;B(_)}K.current=$,Z.current=!1}))};return l.addEventListener("scroll",k,{passive:!0}),k(),()=>l.removeEventListener("scroll",k)},[C,u,ee,N,D,P]);const F=1-P*2,X=P>.5?(P-.5)*2:0,v=1-P,h=j?`translateY(${P*ee*R}px) scale(${1+P*.1})`:void 0,x={height:u==="pin"?N:I,zIndex:p,...g};w&&(x.backgroundColor=w),H&&(x.color=H);const i={progress:P,isCollapsed:V,height:I,expandedHeight:y,collapsedHeight:N};return t.jsxs(Ct.Provider,{value:i,children:[t.jsxs("header",{ref:l=>{O.current=l,typeof Y=="function"?Y(l):Y&&(Y.current=l)},className:`
1
+ "use strict";var tn=Object.defineProperty;var nn=(n,r,s)=>r in n?tn(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s;var tt=(n,r,s)=>nn(n,typeof r!="symbol"?r+"":r,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),bt=e.createContext(null);function xt(){const n=e.useContext(bt);if(!n)throw new Error("usePullToRefresh must be used within NicePullToRefresh");return n}function Me(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const pt=({state:n,progress:r,pullDistance:s,threshold:c})=>{const a=r*360,l=Math.min(1,r),d=()=>{switch(n){case"pulling":return t.jsxs("svg",{className:"ptr-icon ptr-icon-arrow",style:{transform:`rotate(${Math.min(a,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(${l})`},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)"})]})})]})},qe=e.forwardRef(({children:n,onRefresh:r,indicator:s,threshold:c=80,maxPull:a=150,resistance:l=.4,completionDuration:d=1e3,hapticFeedback:u=!0,disabled:b=!1,onPullStart:k,onPullProgress:p,onRefreshSuccess:w,onRefreshError:M,className:f="",style:m,ariaLabel:x="Pull to refresh"},D)=>{const[T,N]=e.useState("idle"),[y,H]=e.useState(0),B=e.useRef(null),I=e.useRef(null),W=e.useRef(0),L=e.useRef(0),g=e.useRef(!1),j=e.useRef(!1),O=Math.min(1,y/c),U=T==="refreshing",E=e.useCallback(()=>y<=0?0:((F,K,v)=>{const C=F*(1-v);return Math.min(K,C+C*v/2)})(y,a,l),[y,a,l]),$=e.useCallback(async()=>{if(!(T==="refreshing"||b)){N("refreshing"),u&&Me("medium");try{await r(),N("success"),u&&Me("heavy"),w==null||w()}catch(X){N("error"),u&&Me("light"),M==null||M(X instanceof Error?X:new Error("Refresh failed"))}setTimeout(()=>{N("idle"),H(0)},d)}},[T,b,u,r,w,M,d]),A=e.useCallback(X=>{if(b||T==="refreshing")return;const F=I.current,K=(F==null?void 0:F.scrollTop)??0;K>0||(W.current=X.touches[0].clientY,L.current=K,j.current=!1)},[b,T]),Y=e.useCallback(X=>{if(b||T==="refreshing")return;const F=I.current;if(((F==null?void 0:F.scrollTop)??0)>0&&!g.current)return;const C=X.touches[0].clientY-W.current;if(C<=0){g.current&&(g.current=!1,N("idle"),H(0));return}g.current||(g.current=!0,k==null||k(),N("pulling")),X.preventDefault(),H(C);const S=Math.min(1,C/c);p==null||p(S),C>=c?T!=="ready"&&(N("ready"),u&&!j.current&&(Me("light"),j.current=!0)):T==="ready"&&(N("pulling"),j.current=!1)},[b,T,c,u,k,p]),z=e.useCallback(()=>{g.current&&(g.current=!1,T==="ready"?$():(N("idle"),H(0)))},[T,$]),G=e.useCallback(X=>{(X.key==="F5"||X.ctrlKey&&X.key==="r")&&(X.preventDefault(),$())},[$]),Q=e.useCallback(X=>{B.current=X,typeof D=="function"?D(X):D&&(D.current=X)},[D]),ee={state:T,progress:O,isRefreshing:U,triggerRefresh:$},P=E();return t.jsx(bt.Provider,{value:ee,children:t.jsxs("div",{ref:Q,className:`nice-ptr ${f} nice-ptr--${T}`,style:m,onTouchStart:A,onTouchMove:Y,onTouchEnd:z,onKeyDown:G,tabIndex:0,role:"region","aria-label":x,"data-state":T,"data-disabled":b||void 0,children:[t.jsx("div",{className:"nice-ptr-indicator-wrapper",style:{height:P,opacity:T==="idle"?0:1},children:s?t.jsx(s,{state:T,progress:O,pullDistance:y,threshold:c}):t.jsx(pt,{state:T,progress:O,pullDistance:y,threshold:c})}),t.jsx("div",{ref:I,className:"nice-ptr-content",style:{transform:T==="refreshing"?`translateY(${c}px)`:`translateY(${P}px)`,transition:g.current?"none":"transform 0.3s cubic-bezier(0.23, 1, 0.32, 1)"},children:n})]})})});qe.displayName="NicePullToRefresh";const rn=({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)}})]}),sn=({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}%`}})}),cn=({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]})})},an=({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,a)=>{const l=a/12*360,d=a/12*1,u=n==="refreshing"?void 0:Math.min(1,r*2-a*.08);return t.jsx("div",{className:"ptr-ios-bar",style:{transform:`rotate(${l}deg) translateY(-8px)`,animationDelay:`${d}s`,opacity:u}},a)})})}),ln=({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"?t.jsx("span",{"aria-hidden":"true",style:{display:"inline-block",width:"0.3em",height:"0.6em",marginBottom:"0.15em",borderRight:"0.12em solid currentColor",borderBottom:"0.12em solid currentColor",transform:"rotate(45deg)"}}):"!"})]}),gt=e.createContext(null),yt=({children:n})=>{const[r,s]=e.useState(null);return t.jsx(gt.Provider,{value:{activeItemId:r,setActiveItemId:s},children:n})};function wt(){return e.useContext(gt)}function Te(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const nt=({action:n,width:r,progress:s,index:c,total:a,side:l,onTrigger:d})=>{const u=Math.min(1,s*2),b=l==="right"?(a-1-c)*.05:c*.05;return t.jsxs("button",{className:`nice-swipe-action nice-swipe-action--${l} ${n.destructive?"nice-swipe-action--destructive":""}`,style:{width:r,background:n.background||"var(--nice-color-primary, #3b82f6)",color:n.color||"var(--nice-text-on-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})]})},kt=e.forwardRef(({children:n,leftActions:r=[],rightActions:s=[],actionWidth:c=72,threshold:a=.4,direction:l,exclusive:d=!0,onSwipeStart:u,onSwipeEnd:b,onAction:k,disabled:p=!1,className:w="",style:M,itemId:f,hapticFeedback:m=!0},x)=>{const D=wt(),[T,N]=e.useState(0),[y,H]=e.useState(null),[B,I]=e.useState(!1),W=e.useRef(null),L=e.useRef(0),g=e.useRef(0),j=e.useRef(0),O=e.useRef(!1),U=e.useRef(null),E=e.useRef(!1),$=-(r.length*c),A=s.length*c,Y=(l==="left"||l==="both"||!l)&&r.length>0,z=(l==="right"||l==="both"||!l)&&s.length>0,G=Math.min(1,Math.abs(T)/Math.abs($)),Q=Math.min(1,T/A),ee=e.useMemo(()=>f||`swipe-${Math.random().toString(36).substr(2,9)}`,[f]),P=e.useCallback(()=>{I(!0),N(0),H(null),setTimeout(()=>I(!1),300)},[]);e.useEffect(()=>{d&&D&&D.activeItemId!==null&&D.activeItemId!==ee&&y&&P()},[d,D,ee,y,P]);const X=e.useCallback(o=>{p||B||(L.current=o.touches[0].clientX,g.current=o.touches[0].clientY,j.current=T,O.current=!1,U.current=null,E.current=!1)},[p,B,T]),F=e.useCallback(o=>{if(p||B)return;const i=o.touches[0].clientX,h=o.touches[0].clientY,R=i-L.current,V=h-g.current;if(!O.current){if(Math.abs(R)<Math.abs(V))return;O.current=!0,U.current=R<0?"left":"right",u==null||u(U.current),d&&D&&D.setActiveItemId(ee)}let q=j.current+R;if(!Y&&q<0&&(q=Math.max(q,-30)*.3),!z&&q>0&&(q=Math.min(q,30)*.3),Y&&q<$){const re=$-q;q=$-re*.3}if(z&&q>A){const re=q-A;q=A+re*.3}const ne=U.current==="left"?Math.abs($)*a:A*a,ie=U.current==="left"?Math.abs(q):q;ie>=ne&&!E.current?(E.current=!0,m&&Te("light")):ie<ne&&E.current&&(E.current=!1),N(q),o.preventDefault()},[p,B,Y,z,$,A,a,m,d,D,ee,u]),K=e.useCallback(()=>{if(!O.current)return;O.current=!1,I(!0);const o=Math.abs($)*a,i=A*a;let h=0,R=null;U.current==="left"&&Y?Math.abs(T)>=o&&(h=$,R="left",m&&Te("medium")):U.current==="right"&&z&&T>=i&&(h=A,R="right",m&&Te("medium")),(y==="left"&&T>0||y==="right"&&T<0)&&(h=0,R=null),N(h),H(R),b==null||b(R),setTimeout(()=>I(!1),300)},[T,$,A,a,Y,z,y,m,b]),v=e.useCallback((o,i)=>{o.onClick(),k==null||k(o,i),m&&Te("heavy"),P()},[k,m,P]),C=e.useCallback(o=>{o.key==="Escape"&&y&&P()},[y,P]),S=e.useCallback(o=>{W.current=o,typeof x=="function"?x(o):x&&(x.current=o)},[x]);return t.jsxs("div",{ref:S,className:`nice-swipe-container ${w} ${y?`nice-swipe-container--open-${y}`:""}`,style:M,onKeyDown:C,tabIndex:0,role:"listitem","aria-label":y?`Swipe actions ${y} visible`:"Swipe for actions","data-disabled":p||void 0,children:[s.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--left",style:{width:A},children:s.map((o,i)=>t.jsx(nt,{action:o,width:c,progress:Q,index:i,total:s.length,side:"right",onTrigger:()=>v(o,"right")},o.id))}),t.jsx("div",{className:"nice-swipe-content",style:{transform:`translateX(${T}px)`,transition:B?"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none"},onTouchStart:X,onTouchMove:F,onTouchEnd:K,children:n}),r.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--right",style:{width:Math.abs($)},children:r.map((o,i)=>t.jsx(nt,{action:o,width:c,progress:G,index:i,total:r.length,side:"left",onTrigger:()=>v(o,"left")},o.id))})]})});kt.displayName="NiceSwipeActions";const on=({children:n,className:r="",style:s})=>t.jsx(yt,{children:t.jsx("div",{className:`nice-swipe-list ${r}`,style:s,role:"list",children:n})}),un={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(--nice-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(--nice-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(--nice-bg-tertiary, #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(--nice-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(--nice-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(--nice-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(--nice-bg-tertiary, #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(--nice-color-info, #0ea5e9)",onClick:n})};function rt(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function dn(n,r,s){return n==="full"?r*.95:n==="content"?Math.min(s,r*.9):r*n/100}const jt=e.forwardRef(({children:n,open:r,onClose:s,onSnapChange:c,snapPoints:a=[50,100],initialSnap:l=0,header:d,footer:u,showHandle:b=!0,showBackdrop:k=!0,closeOnBackdrop:p=!0,closeOnEscape:w=!0,dismissible:M=!0,velocityThreshold:f=.5,hapticFeedback:m=!0,handleColor:x,borderRadius:D=16,zIndex:T=1e3,className:N="",style:y,ariaLabel:H="Bottom sheet",size:B="md",disabled:I=!1,loading:W=!1,error:L},g)=>{const[j,O]=e.useState(l),[U,E]=e.useState(0),[$,A]=e.useState(!1),[Y,z]=e.useState(typeof window<"u"?window.innerHeight:800),[G,Q]=e.useState(400),ee=e.useRef(null),P=e.useRef(null),X=e.useRef(0),F=e.useRef(0),K=e.useRef(0),v=e.useRef(0),C=e.useRef(0),S=e.useRef(-1),o=a.map(te=>dn(te,Y,G)),i=o[j]??o[0];e.useImperativeHandle(g,()=>({snapTo:te=>{te>=0&&te<a.length&&(O(te),E(0),c==null||c(te,o[te]))},close:()=>s(),getCurrentSnap:()=>j})),e.useEffect(()=>{const te=()=>{z(window.innerHeight)};return window.addEventListener("resize",te),()=>window.removeEventListener("resize",te)},[]),e.useEffect(()=>{if(P.current&&r){const te=P.current.scrollHeight;Q(te+60)}},[r,n]),e.useEffect(()=>{if(!r||!w)return;const te=se=>{se.key==="Escape"&&s()};return document.addEventListener("keydown",te),()=>document.removeEventListener("keydown",te)},[r,w,s]),e.useEffect(()=>{if(r){const te=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=te}}},[r]);const h=e.useCallback(te=>{const se=Y-i+te,oe=Y-se;for(let _=0;_<o.length;_++){const J=o[_];if(Math.abs(oe-J)<20&&S.current!==_){S.current=_,m&&rt("light");break}}},[Y,i,o,m]),R=e.useCallback((te,se)=>{if(se>f*2&&M&&te<o[0]*.5)return-1;if(se<-f)return o.length-1;if(se>f)return M&&te<o[0]*.7?-1:0;let oe=0,_=Math.abs(te-o[0]);for(let J=1;J<o.length;J++){const Z=Math.abs(te-o[J]);Z<_&&(_=Z,oe=J)}return M&&te<o[0]*.5?-1:oe},[o,f,M]),V=e.useCallback(te=>{X.current=te.touches[0].clientY,F.current=U,K.current=te.touches[0].clientY,v.current=Date.now(),C.current=0,S.current=-1,A(!0)},[U]),q=e.useCallback(te=>{if(!$)return;const se=te.touches[0].clientY,oe=se-X.current,_=Date.now(),J=_-v.current;J>0&&(C.current=(se-K.current)/J),K.current=se,v.current=_;let Z=F.current+oe;const ce=i+50;if(Z>ce){const ue=Z-ce;Z=ce+ue*.2}const le=-(Y*.95-i);if(Z<le){const ue=le-Z;Z=le-ue*.2}E(Z),h(Z),te.preventDefault()},[$,i,Y,h]),ne=e.useCallback(()=>{if(!$)return;A(!1);const te=i-U,se=R(te,C.current);if(se===-1)E(i+100),setTimeout(()=>{s(),E(0),O(l)},300);else{const oe=o[se];E(0),O(se),se!==j&&(c==null||c(se,oe),m&&rt("medium"))}},[$,i,U,R,j,o,s,c,l,m]),ie=e.useCallback(te=>{p&&te.target===te.currentTarget&&s()},[p,s]);if(!r)return null;const re=Math.max(0,i-U),ae=Math.min(.5,re/Y*.8);return t.jsxs("div",{className:`nice-bottom-sheet-container ${N}`,style:{zIndex:T},children:[k&&t.jsx("div",{className:"nice-bottom-sheet-backdrop",style:{opacity:ae},onMouseDown:ie,"aria-hidden":"true"}),t.jsxs("div",{ref:ee,className:`nice-bottom-sheet nice-bottom-sheet--${B} ${$?"nice-bottom-sheet--dragging":""} ${I?"nice-bottom-sheet--disabled":""} ${W?"nice-bottom-sheet--loading":""} ${L?"nice-bottom-sheet--error":""}`,style:{...y,height:re,borderTopLeftRadius:D,borderTopRightRadius:D,transition:$?"none":"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},role:"dialog","aria-modal":"true","aria-label":H,"aria-disabled":I||void 0,"aria-busy":W||void 0,children:[L&&t.jsx("div",{className:"nice-bottom-sheet-error",role:"alert",children:L}),W&&t.jsx("span",{className:"nice-bottom-sheet-spinner","aria-hidden":"true",children:t.jsx("span",{className:"nice-spinner nice-spinner--sm"})}),b&&t.jsx("div",{className:"nice-bottom-sheet-handle",onTouchStart:V,onTouchMove:q,onTouchEnd:ne,children:t.jsx("div",{className:"nice-bottom-sheet-handle-bar",style:x?{backgroundColor:x}:void 0})}),d&&t.jsx("div",{className:"nice-bottom-sheet-header",children:d}),t.jsx("div",{ref:P,className:"nice-bottom-sheet-content",onTouchStart:V,onTouchMove:q,onTouchEnd:ne,children:n}),u&&t.jsx("div",{className:"nice-bottom-sheet-footer",children:u})]})]})});jt.displayName="NiceBottomSheet";function fn(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function st(n,r){return Math.hypot(r.x-n.x,r.y-n.y)}function ct(n,r){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}const Nt=e.forwardRef(({items:n,selectedIndex:r=0,onIndexChange:s,onClose:c,showClose:a=!0,showCounter:l=!0,showCaption:d=!0,showThumbnails:u=!1,enablePinchZoom:b=!0,enableDoubleTapZoom:k=!0,enableSwipe:p=!0,enableKeyboard:w=!0,minZoom:M=1,maxZoom:f=4,doubleTapZoom:m=2.5,swipeThreshold:x=50,loop:D=!0,hapticFeedback:T=!0,backgroundColor:N="var(--nice-overlay-95, rgba(0, 0, 0, 0.95))",zIndex:y=2e3,className:H="",style:B},I)=>{const[W,L]=e.useState(r),[g,j]=e.useState(1),[O,U]=e.useState(0),[E,$]=e.useState(0),[A,Y]=e.useState(!1),[z,G]=e.useState({}),Q=e.useRef(null),ee=e.useRef(null),P=e.useRef([]),X=e.useRef(0),F=e.useRef(1),K=e.useRef({x:0,y:0}),v=e.useRef(0),C=e.useRef({x:0,y:0}),S=e.useRef(!1),o=e.useRef(!1),i=e.useRef(null),h=n[W],R=e.useCallback(_=>{let J=_;D?J=(_%n.length+n.length)%n.length:J=Math.max(0,Math.min(n.length-1,_)),J!==W&&(Y(!0),L(J),j(1),U(0),$(0),s==null||s(J,n[J]),T&&fn("light"),setTimeout(()=>Y(!1),300))},[W,n,D,s,T]),V=e.useCallback(()=>R(W+1),[R,W]),q=e.useCallback(()=>R(W-1),[R,W]),ne=e.useCallback((_,J,Z)=>{const ce=Math.max(M,Math.min(f,_));j(ce),ce<=1&&(U(0),$(0))},[M,f]),ie=e.useCallback(()=>ne(g*1.5),[g,ne]),re=e.useCallback(()=>ne(g/1.5),[g,ne]),ae=e.useCallback(()=>{j(1),U(0),$(0)},[]);e.useImperativeHandle(I,()=>({goTo:R,goNext:V,goPrev:q,zoomIn:ie,zoomOut:re,resetZoom:ae,close:()=>c==null?void 0:c()})),e.useEffect(()=>{if(!w)return;const _=J=>{switch(J.key){case"ArrowLeft":q();break;case"ArrowRight":V();break;case"ArrowUp":ie();break;case"ArrowDown":re();break;case"Escape":c==null||c();break;case"0":case"Home":ae();break}};return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[w,V,q,ie,re,ae,c]);const te=e.useCallback(_=>{const J=Array.from(_.touches).map(Z=>({x:Z.clientX,y:Z.clientY,id:Z.identifier}));if(P.current=J,C.current={x:J[0].x,y:J[0].y},o.current=!1,i.current=null,J.length===2&&b)S.current=!0,X.current=st(J[0],J[1]),F.current=g,K.current={x:O,y:E};else if(J.length===1){const Z=Date.now();Z-v.current<300&&k?(g>1.1?ae():ne(m,J[0].x,J[0].y),v.current=0):v.current=Z,K.current={x:O,y:E}}},[g,O,E,b,k,m,ae,ne]),se=e.useCallback(_=>{const J=Array.from(_.touches).map(Z=>({x:Z.clientX,y:Z.clientY,id:Z.identifier}));if(J.length===2&&S.current&&b){const ce=st(J[0],J[1])/X.current,le=F.current*ce;ne(le);const ue=ct(J[0],J[1]),fe=ct(P.current[0],P.current[1]||P.current[0]),he=ue.x-fe.x,Ye=ue.y-fe.y;U(K.current.x+he),$(K.current.y+Ye),_.preventDefault()}else if(J.length===1){const Z=J[0].x-C.current.x,ce=J[0].y-C.current.y;if(i.current||(Math.abs(Z)>10||Math.abs(ce)>10)&&(i.current=Math.abs(Z)>Math.abs(ce)?"horizontal":"vertical",o.current=!0),g>1.1){const le=K.current.x+Z,ue=K.current.y+ce;U(le),$(ue)}_.preventDefault()}},[g,b,ne]),oe=e.useCallback(_=>{if(S.current){S.current=!1;return}const J=_.changedTouches[0],Z=J.clientX-C.current.x;J.clientY-C.current.y,p&&g<=1.1&&i.current==="horizontal"&&(Z>x?q():Z<-x&&V()),g<=1.1&&(U(0),$(0)),o.current=!1,i.current=null},[g,p,x,V,q]);return e.useEffect(()=>{n.forEach((_,J)=>{const Z=new Image;Z.onload=()=>{G(ce=>({...ce,[J]:!0}))},Z.src=_.src})},[n]),n.length===0?null:t.jsxs("div",{ref:Q,className:`nice-image-gallery ${H}`,style:{...B,backgroundColor:N,zIndex:y},role:"dialog","aria-modal":"true","aria-label":"Image gallery",children:[t.jsxs("div",{className:"nice-image-gallery-header",children:[l&&t.jsxs("span",{className:"nice-image-gallery-counter",children:[W+1," / ",n.length]}),t.jsxs("div",{className:"nice-image-gallery-actions",children:[t.jsx("button",{className:"nice-image-gallery-btn",onClick:re,disabled:g<=M,"aria-label":"Zoom out",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--minus","aria-hidden":"true"})}),t.jsx("button",{className:"nice-image-gallery-btn",onClick:ie,disabled:g>=f,"aria-label":"Zoom in",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--plus","aria-hidden":"true"})}),a&&t.jsx("button",{className:"nice-image-gallery-btn nice-image-gallery-close",onClick:c,"aria-label":"Close",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--close","aria-hidden":"true"})})]})]}),t.jsxs("div",{className:"nice-image-gallery-viewport",onTouchStart:te,onTouchMove:se,onTouchEnd:oe,children:[t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--prev",onClick:q,disabled:!D&&W===0,"aria-label":"Previous image",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--prev","aria-hidden":"true"})}),t.jsxs("div",{className:"nice-image-gallery-image-container",children:[h.placeholder&&!z[W]&&t.jsx("div",{className:"nice-image-gallery-placeholder",style:{backgroundColor:h.placeholder}}),t.jsx("img",{ref:ee,src:h.src,alt:h.alt||h.title||"",className:`nice-image-gallery-image ${A?"nice-image-gallery-image--animating":""}`,style:{transform:`scale(${g}) translate(${O/g}px, ${E/g}px)`,transition:S.current||o.current?"none":"transform 0.2s ease-out"},draggable:!1})]}),t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--next",onClick:V,disabled:!D&&W===n.length-1,"aria-label":"Next image",children:t.jsx("span",{className:"nice-image-gallery-mark nice-image-gallery-mark--next","aria-hidden":"true"})})]}),d&&h.title&&t.jsxs("div",{className:"nice-image-gallery-caption",children:[t.jsx("h3",{children:h.title}),h.description&&t.jsx("p",{children:h.description})]}),u&&n.length>1&&t.jsx("div",{className:"nice-image-gallery-thumbnails",children:n.map((_,J)=>t.jsx("button",{className:`nice-image-gallery-thumb ${J===W?"nice-image-gallery-thumb--active":""}`,onClick:()=>R(J),"aria-label":`Go to image ${J+1}`,children:t.jsx("img",{src:_.thumbnail||_.src,alt:_.alt||"",loading:"lazy"})},J))}),!u&&n.length>1&&n.length<=10&&t.jsx("div",{className:"nice-image-gallery-dots",children:n.map((_,J)=>t.jsx("button",{className:`nice-image-gallery-dot ${J===W?"nice-image-gallery-dot--active":""}`,onClick:()=>R(J),"aria-label":`Go to image ${J+1}`},J))})]})});Nt.displayName="NiceImageGallery";const Mt=e.createContext(null);function hn(){const n=e.useContext(Mt);if(!n)throw new Error("useInfiniteScroll must be used within NiceInfiniteScroll");return n}const it=()=>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..."})]}),vn=()=>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"})]}),mn=({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"})]}),bn=()=>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"})]}),xn=({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 pn({items:n,renderItem:r,onLoadMore:s,hasMore:c,isLoading:a=!1,error:l=null,threshold:d=200,loadingIndicator:u,endIndicator:b,errorIndicator:k,onRetry:p,pullToRefresh:w=!1,onRefresh:M,direction:f="vertical",reverse:m=!1,initialScrollPosition:x="top",keyboardNav:D=!0,keyExtractor:T,emptyContent:N,header:y,footer:H,gap:B=0,className:I="",style:W,ariaLabel:L="Scrollable list"},g){const[j,O]=e.useState("idle"),[U,E]=e.useState(!1),[$,A]=e.useState(!1),Y=e.useRef(null),z=e.useRef(null),G=e.useRef(!1),Q=e.useRef(null);e.useEffect(()=>{l?O("error"):a?O("loading"):!c&&n.length>0?O("end"):O("idle")},[l,a,c,n.length]);const ee=e.useCallback((o,i)=>T?T(o,i):`item-${i}`,[T]),P=e.useCallback(async()=>{if(!(G.current||!c||l)){G.current=!0;try{await s()}finally{G.current=!1}}},[c,l,s]),X=e.useCallback(()=>{var o;(o=Y.current)==null||o.scrollTo({top:0,behavior:"smooth"})},[]),F=e.useCallback(()=>{Y.current&&Y.current.scrollTo({top:Y.current.scrollHeight,behavior:"smooth"})},[]);e.useEffect(()=>{if(!z.current)return;const o=i=>{const[h]=i;h.isIntersecting&&c&&!a&&!l&&P()};return Q.current=new IntersectionObserver(o,{root:Y.current,rootMargin:`${d}px`,threshold:.1}),Q.current.observe(z.current),()=>{var i;(i=Q.current)==null||i.disconnect()}},[c,a,l,d,P]),e.useEffect(()=>{const o=Y.current;if(!o)return;const i=()=>{const h=f==="vertical"?o.scrollTop:o.scrollLeft;E(h>500)};return o.addEventListener("scroll",i,{passive:!0}),()=>o.removeEventListener("scroll",i)},[f]),e.useEffect(()=>{x==="bottom"&&Y.current&&(Y.current.scrollTop=Y.current.scrollHeight)},[x]);const K=e.useCallback(o=>{D&&(o.key==="Home"?(o.preventDefault(),X()):o.key==="End"&&(o.preventDefault(),F()))},[D,X,F]);e.useCallback(async()=>{if(!(!M||$)){A(!0);try{await M()}finally{A(!1)}}},[M,$]);const v=e.useCallback(o=>{Y.current=o,typeof g=="function"?g(o):g&&(g.current=o)},[g]),C=e.useMemo(()=>({status:j,loadMore:P,hasMore:c,itemCount:n.length,scrollToTop:X,scrollToBottom:F}),[j,P,c,n.length,X,F]),S=e.useMemo(()=>(m?[...n].reverse():n).map((i,h)=>t.jsx("div",{className:"nice-infinite-item","data-index":h,children:r(i,h)},ee(i,h))),[n,m,ee,r]);return n.length===0&&!a&&!l?t.jsx("div",{ref:v,className:`nice-infinite-container nice-infinite-container--empty ${I}`,style:W,role:"region","aria-label":L,children:N||t.jsx(bn,{})}):t.jsx(Mt.Provider,{value:C,children:t.jsxs("div",{ref:v,className:`nice-infinite-container nice-infinite-container--${f} ${m?"nice-infinite-container--reverse":""} ${I}`,style:W,onKeyDown:K,tabIndex:0,role:"feed","aria-label":L,"aria-busy":a,children:[y&&t.jsx("div",{className:"nice-infinite-header",children:y}),w&&$&&t.jsx("div",{className:"nice-infinite-pull",children:u||t.jsx(it,{})}),t.jsx("div",{className:"nice-infinite-items",style:{gap:B},children:S}),t.jsx("div",{ref:z,className:"nice-infinite-sentinel","aria-hidden":"true"}),j==="loading"&&(u||t.jsx(it,{})),j==="error"&&l&&(k||t.jsx(mn,{message:l,onRetry:p})),j==="end"&&(b||t.jsx(vn,{})),H&&t.jsx("div",{className:"nice-infinite-footer",children:H}),t.jsx(xn,{visible:U,onClick:X})]})})}const gn=e.forwardRef(pn);function yn(n){const{fetchPage:r,initialCursor:s,refetchOnFocus:c=!1}=n,[a,l]=e.useState([]),[d,u]=e.useState(s),[b,k]=e.useState(!1),[p,w]=e.useState(null),[M,f]=e.useState(!0),[m,x]=e.useState(!1),D=e.useCallback(async()=>{if(!(b||!M)){k(!0),w(null);try{const y=await r(d);l(H=>[...H,...y.items]),u(y.nextCursor),f(y.hasMore),x(!0)}catch(y){w(y instanceof Error?y.message:"Failed to load data")}finally{k(!1)}}},[r,d,b,M]),T=e.useCallback(async()=>{l([]),u(s),f(!0),w(null),k(!0);try{const y=await r(s);l(y.items),u(y.nextCursor),f(y.hasMore)}catch(y){w(y instanceof Error?y.message:"Failed to refresh data")}finally{k(!1)}},[r,s]),N=e.useCallback(()=>{l([]),u(s),f(!0),w(null),x(!1)},[s]);return e.useEffect(()=>{!m&&!b&&D()},[m,b,D]),e.useEffect(()=>{if(!c)return;const y=()=>{m&&T()};return window.addEventListener("focus",y),()=>window.removeEventListener("focus",y)},[c,m,T]),{items:a,isLoading:b,error:p,hasMore:M,loadMore:D,refresh:T,reset:N}}function wn(n){const{itemCount:r,itemHeight:s,overscan:c=5,containerRef:a}=n,[l,d]=e.useState(0),[u,b]=e.useState(0),k=e.useCallback(f=>typeof s=="function"?s(f):s,[s]),p=e.useMemo(()=>{let f=0;for(let m=0;m<r;m++)f+=k(m);return f},[r,k]),w=e.useMemo(()=>{const f=[];let m=0,x=-1,D=-1;for(let T=0;T<r;T++){const N=k(T),y=m+N;y>=l&&x===-1&&(x=T),m<=l+u&&(D=T),m=y}x=Math.max(0,x-c),D=Math.min(r-1,D+c),m=0;for(let T=0;T<r;T++){const N=k(T);T>=x&&T<=D&&f.push({index:T,start:m,size:N,end:m+N}),m+=N}return f},[r,k,l,u,c]);e.useEffect(()=>{const f=a.current;if(!f)return;b(f.clientHeight);const m=()=>{d(f.scrollTop)},x=()=>{b(f.clientHeight)};return f.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",x),()=>{f.removeEventListener("scroll",m),window.removeEventListener("resize",x)}},[a]);const M=e.useCallback(f=>{const m=a.current;if(!m)return;let x=0;for(let D=0;D<f&&D<r;D++)x+=k(D);m.scrollTo({top:x,behavior:"smooth"})},[a,r,k]);return{virtualItems:w,totalSize:p,scrollToIndex:M}}const Tt=e.createContext(null);function kn(){const n=e.useContext(Tt);if(!n)throw new Error("useMobileDrawer must be used within NiceMobileDrawer");return n}const Rt=({item:n,depth:r=0,onSelect:s,activeId:c})=>{const[a,l]=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?l(!a):(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?a: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 ${a?"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&&a&&t.jsx("div",{className:"nice-drawer-nav-children",children:n.children.map(k=>t.jsx(Rt,{item:k,depth:r+1,onSelect:s,activeId:c},k.id))})]})},Ct=e.forwardRef(({open:n,onClose:r,position:s="left",variant:c="overlay",size:a,children:l,navItems:d,header:u,footer:b,swipeToOpen:k=!0,swipeToClose:p=!0,edgeSwipeWidth:w=20,velocityThreshold:M=.3,showOverlay:f=!0,closeOnOverlayClick:m=!0,closeOnEscape:x=!0,disableBodyScroll:D=!0,overlayColor:T,zIndex:N=1e3,onNavSelect:y,activeNavId:H,className:B="",style:I,ariaLabel:W="Navigation drawer"},L)=>{const[g,j]=e.useState(0),[O,U]=e.useState(!1),[E,$]=e.useState(H),A=e.useRef(null),Y=e.useRef({x:0,y:0}),z=e.useRef(0),G=e.useRef({x:0,y:0}),Q=s==="left"||s==="right",P=a??(Q?280:400);e.useEffect(()=>{H!==void 0&&$(H)},[H]),e.useEffect(()=>{if(D&&n){const i=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=i}}},[n,D]),e.useEffect(()=>{if(!x||!n)return;const i=h=>{h.key==="Escape"&&r()};return document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[x,n,r]),e.useEffect(()=>{if(!n||!A.current)return;const i=A.current,h=i.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),R=h[0],V=h[h.length-1],q=ne=>{ne.key==="Tab"&&(ne.shiftKey&&document.activeElement===R?(ne.preventDefault(),V==null||V.focus()):!ne.shiftKey&&document.activeElement===V&&(ne.preventDefault(),R==null||R.focus()))};return i.addEventListener("keydown",q),R==null||R.focus(),()=>i.removeEventListener("keydown",q)},[n]);const X=e.useCallback(()=>{let i=0;const h=g;if(!n)switch(s){case"left":i=-100;break;case"right":i=100;break;case"top":i=-100;break;case"bottom":i=100;break}return Q?`translateX(calc(${i}% + ${h}px))`:`translateY(calc(${i}% + ${h}px))`},[n,s,g,Q]),F=e.useCallback(i=>{if(!p&&n)return;const h=i.touches[0];Y.current={x:h.clientX,y:h.clientY},G.current={x:h.clientX,y:h.clientY},z.current=Date.now()},[p,n]),K=e.useCallback(i=>{if(!p||!n)return;const h=i.touches[0],R=h.clientX-Y.current.x,V=h.clientY-Y.current.y;let q=!1,ne=0;switch(s){case"left":q=R<0,ne=Math.min(0,R);break;case"right":q=R>0,ne=Math.max(0,R);break;case"top":q=V<0,ne=Math.min(0,V);break;case"bottom":q=V>0,ne=Math.max(0,V);break}q&&Math.abs(Q?R:V)>10&&(U(!0),j(ne),G.current={x:h.clientX,y:h.clientY},i.preventDefault())},[p,n,s,Q]),v=e.useCallback(()=>{if(!O)return;const i=Date.now()-z.current,h=Math.abs(g),R=typeof P=="number"?P:280,V=h/i;(h>R*.3||V>M)&&r(),U(!1),j(0)},[O,g,P,M,Q,r]);e.useEffect(()=>{if(!k||n)return;let i=0,h=0,R=!1;const V=ne=>{const ie=ne.touches[0];i=ie.clientX,h=ie.clientY;const re=window.innerWidth,ae=window.innerHeight;switch(s){case"left":R=i<w;break;case"right":R=i>re-w;break;case"top":R=h<w;break;case"bottom":R=h>ae-w;break}},q=ne=>{if(!R)return;const ie=ne.touches[0],re=ie.clientX-i,ae=ie.clientY-h,te=50;let se=!1;switch(s){case"left":se=re>te;break;case"right":se=re<-te;break;case"top":se=ae>te;break;case"bottom":se=ae<-te;break}se&&ne.preventDefault()};return document.addEventListener("touchstart",V,{passive:!0}),document.addEventListener("touchmove",q,{passive:!1}),()=>{document.removeEventListener("touchstart",V),document.removeEventListener("touchmove",q)}},[k,n,s,w]);const C=e.useCallback(i=>{$(i.id),y==null||y(i),i.href&&r()},[y,r]),S=e.useCallback(i=>{A.current=i,typeof L=="function"?L(i):L&&(L.current=i)},[L]),o=e.useMemo(()=>({isOpen:n,position:s,close:r,activeNavId:E,setActiveNavId:$}),[n,s,r,E]);return t.jsxs(Tt.Provider,{value:o,children:[f&&c!=="persistent"&&t.jsx("div",{className:`nice-drawer-overlay ${n?"nice-drawer-overlay--visible":""}`,style:{zIndex:N-1,background:T,opacity:O?1-Math.abs(g)/(typeof P=="number"?P:280):void 0},onClick:m?r:void 0,"aria-hidden":"true"}),t.jsxs("div",{ref:S,className:`nice-drawer nice-drawer--${s} nice-drawer--${c} ${n?"nice-drawer--open":""} ${O?"nice-drawer--dragging":""} ${B}`,style:{...I,[Q?"width":"height"]:P,zIndex:N,transform:X()},onTouchStart:F,onTouchMove:K,onTouchEnd:v,role:"dialog","aria-modal":c!=="persistent","aria-label":W,"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(i=>t.jsx(Rt,{item:i,onSelect:C,activeId:E},i.id))}):l}),b&&t.jsx("div",{className:"nice-drawer-footer",children:b})]})]})});Ct.displayName="NiceMobileDrawer";function jn(n={}){const{defaultOpen:r=!1,onOpenChange:s}=n,[c,a]=e.useState(r),l=e.useCallback(()=>{a(!0),s==null||s(!0)},[s]),d=e.useCallback(()=>{a(!1),s==null||s(!1)},[s]),u=e.useCallback(()=>{a(k=>{const p=!k;return s==null||s(p),p})},[s]),b=e.useCallback(k=>{a(k),s==null||s(k)},[s]);return{isOpen:c,open:l,close:d,toggle:u,setOpen:b}}const Nn={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"})]})},Dt=e.createContext(null);function Mn(){const n=e.useContext(Dt);if(!n)throw new Error("useMobileModal must be used within a NiceMobileModal");return n}function Tn(n={}){const{defaultOpen:r=!1,open:s,onOpenChange:c,preventDismiss:a=!1}=n,[l,d]=e.useState(r),u=s!==void 0,b=u?s:l,k=e.useCallback((f,m)=>{!f&&a&&m!=="close"||(u||d(f),c==null||c(f,m))},[u,c,a]),p=e.useCallback(()=>k(!0),[k]),w=e.useCallback(f=>k(!1,f),[k]),M=e.useCallback(()=>k(!b),[k,b]);return{open:b,openModal:p,closeModal:w,toggle:M,setOpen:f=>k(f)}}const Rn=()=>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 Cn(n,r,s){return n==="content"?Math.min(s,r):n==="full"?r:n<=1?r*n:Math.min(n,r)}function Dn(n,r,s){return Math.min(Math.max(n,r),s)}const Ge=e.forwardRef(function({open:r,onClose:s,title:c,children:a,footer:l,snapPoints:d=["content"],defaultSnapPoint:u=0,showHandle:b=!0,showClose:k=!0,showOverlay:p=!0,dismissOnDrag:w=!0,dismissOnOverlay:M=!0,dismissOnEscape:f=!0,preventDismiss:m=!1,onSnapChange:x,className:D="",overlayClassName:T="",headerClassName:N="",contentClassName:y="",footerClassName:H="",lockScroll:B=!0,borderRadius:I=16,zIndex:W,style:L,...g},j){const U=`${e.useId()}-title`,E=e.useRef(null),$=e.useRef(null),A=e.useRef(0),Y=e.useRef(0),z=e.useRef(!1),[G,Q]=e.useState(u),[ee,P]=e.useState(0),[X,F]=e.useState(400),[K,v]=e.useState(typeof window<"u"?window.innerHeight:800),[C,S]=e.useState(!1),o=d.map(_=>Cn(_,K,X));e.useEffect(()=>{if(typeof window>"u")return;const _=()=>{v(window.innerHeight)};return window.addEventListener("resize",_),()=>window.removeEventListener("resize",_)},[]),e.useEffect(()=>{if(!$.current||!r)return;const _=new ResizeObserver(()=>{const J=$.current,Z=E.current;if(!J)return;let ce=0;for(const le of Array.from((Z==null?void 0:Z.children)??[]))le!==J&&(ce+=le.offsetHeight);F(Math.min(J.scrollHeight+ce,K*.9))});return _.observe($.current),()=>_.disconnect()},[r,K]),e.useEffect(()=>{if(r){const _=o[u]||o[0]||K*.5;P(_),Q(u)}},[r]),e.useEffect(()=>{if(r&&!C){const _=o[G]||o[0];P(_)}},[o.join(","),G,C,r]),e.useEffect(()=>{if(!B||!r)return;const _=document.body.style.overflow,J=document.body.style.paddingRight,Z=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",Z>0&&(document.body.style.paddingRight=`${Z}px`),()=>{document.body.style.overflow=_,document.body.style.paddingRight=J}},[r,B]),e.useEffect(()=>{if(!r||!f||m)return;const _=J=>{J.key==="Escape"&&(s==null||s("escape"))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[r,f,m,s]),e.useEffect(()=>{if(!r||!E.current)return;const J=E.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),Z=J[0],ce=J[J.length-1],le=ue=>{ue.key==="Tab"&&(ue.shiftKey?document.activeElement===Z&&(ue.preventDefault(),ce==null||ce.focus()):document.activeElement===ce&&(ue.preventDefault(),Z==null||Z.focus()))};return document.addEventListener("keydown",le),requestAnimationFrame(()=>{Z==null||Z.focus()}),()=>document.removeEventListener("keydown",le)},[r]);const i=e.useCallback(_=>{m&&_!=="close"||s==null||s(_)},[m,s]),h=e.useCallback(()=>{M&&i("overlay")},[M,i]),R=e.useCallback((_,J)=>{if(J>.5&&w&&!m)return-1;if(J<-.5)return o.length-1;let Z=0,ce=Math.abs(o[0]-_);for(let le=1;le<o.length;le++){const ue=Math.abs(o[le]-_);ue<ce&&(ce=ue,Z=le)}return Z},[o,w,m]),V=e.useCallback(_=>{z.current=!0,A.current=_,Y.current=ee,S(!0)},[ee]),q=e.useCallback(_=>{if(!z.current)return;const J=A.current-_,Z=Dn(Y.current+J,50,K);P(Z)},[K]),ne=e.useCallback((_,J)=>{if(!z.current)return;z.current=!1,S(!1);const Z=R(ee,J);if(Z===-1){i("drag");return}Q(Z),P(o[Z]),x==null||x(Z,d[Z])},[ee,R,i,o,d,x]),ie=_=>{V(_.touches[0].clientY)},re=_=>{q(_.touches[0].clientY)},ae=_=>{const J=_.changedTouches[0],Z=(A.current-J.clientY)/(_.timeStamp-(_.timeStamp-200));ne(J.clientY,Z>0?-Z/1e3:Z/1e3)},te=_=>{_.preventDefault(),V(_.clientY);const J=ce=>{q(ce.clientY)},Z=ce=>{const le=(A.current-ce.clientY)/200;ne(ce.clientY,le>0?-le/500:le/500),document.removeEventListener("mousemove",J),document.removeEventListener("mouseup",Z)};document.addEventListener("mousemove",J),document.addEventListener("mouseup",Z)},se=e.useCallback(_=>{_<0||_>=o.length||(Q(_),P(o[_]),x==null||x(_,d[_]))},[o,d,x]),oe={isOpen:r,snapPoints:d,currentSnapIndex:G,setSnapIndex:se,close:i};return r?t.jsxs(t.Fragment,{children:[p&&t.jsx("div",{className:`nice-mobile-modal-overlay nice-mobile-modal-overlay--visible ${T}`,onClick:h,"aria-hidden":"true",style:{zIndex:W?W-1:void 0}}),t.jsx(Dt.Provider,{value:oe,children:t.jsxs("div",{ref:_=>{E.current=_,typeof j=="function"?j(_):j&&(j.current=_)},role:"dialog","aria-modal":"true","aria-labelledby":c?U:void 0,className:`nice-modal-sheet ${C?"nice-modal-sheet--dragging":""} ${D}`,style:{height:ee,borderTopLeftRadius:I,borderTopRightRadius:I,zIndex:W,...L},...g,children:[b&&t.jsx("div",{className:"nice-modal-handle-area",onTouchStart:ie,onTouchMove:re,onTouchEnd:ae,onMouseDown:te,children:t.jsx("div",{className:"nice-modal-handle"})}),(c||k)&&t.jsxs("div",{className:`nice-modal-header ${N}`,children:[c&&t.jsx("h2",{id:U,className:"nice-modal-title",children:c}),k&&!m&&t.jsx("button",{type:"button",className:"nice-modal-close",onClick:()=>i("close"),"aria-label":"Close modal",children:t.jsx(Rn,{})})]}),t.jsx("div",{ref:$,className:`nice-modal-content ${y}`,children:a}),l&&t.jsx("div",{className:`nice-modal-footer ${H}`,children:l})]})})]}):null}),Sn=e.forwardRef(function({actions:r,cancelLabel:s="Cancel",onClose:c,...a},l){return t.jsx(Ge,{ref:l,onClose:c,showHandle:!0,showClose:!1,snapPoints:["content"],...a,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})]})})}),Pn=e.forwardRef(function({title:r,message:s,confirmLabel:c="Confirm",cancelLabel:a="Cancel",confirmDestructive:l=!1,onConfirm:d,onCancel:u,onClose:b,...k},p){const w=()=>{d==null||d(),b==null||b("close")},M=()=>{u==null||u(),b==null||b("close")};return t.jsx(Ge,{ref:p,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:M,children:a}),t.jsx("button",{type:"button",className:`nice-confirm-sheet-btn nice-confirm-sheet-btn--confirm ${l?"nice-confirm-sheet-btn--destructive":""}`,onClick:w,children:c})]}),...k,children:t.jsx("div",{className:"nice-confirm-sheet-message",children:s})})}),St=e.createContext(null);function $n(){const n=e.useContext(St);if(!n)throw new Error("useMobileTabs must be used within a NiceMobileTabs");return n}function In(n){var w;const{tabs:r,defaultTab:s,activeTab:c,onChange:a}=n,[l,d]=e.useState(s||((w=r[0])==null?void 0:w.id)||""),u=c!==void 0,b=u?c:l,k=e.useCallback(M=>{const f=r.find(m=>m.id===M);!f||f.disabled||(u||d(M),a==null||a(M))},[r,u,a]),p=e.useCallback(M=>b===M,[b]);return{activeTab:b,setActiveTab:k,tabs:r,isActive:p}}const de={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"})]})},at=({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})},lt=({tab:n,isActive:r,showLabel:s,animation:c,activeColor:a,inactiveColor:l,onClick:d})=>{const u=e.useRef(null);e.useEffect(()=>{if(!u.current||c==="none")return;const p=u.current;c==="scale"&&r&&(p.style.transform="scale(1.2)",setTimeout(()=>{p.style.transform="scale(1)"},150))},[r,c]);const b=r&&n.activeIcon?n.activeIcon:n.icon,k={};return r&&a?k.color=a:!r&&l&&(k.color=l),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:k,"aria-current":r?"page":void 0,onClick:p=>{var w;if(n.disabled){p.preventDefault();return}(w=n.onClick)==null||w.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(at,{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:k,disabled:n.disabled,"aria-pressed":r,onClick:()=>{var p;(p=n.onClick)==null||p.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(at,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]})},En=e.forwardRef(function({tabs:r,activeTab:s,defaultTab:c,onChange:a,showLabels:l=!0,showAllLabels:d=!0,position:u="bottom",variant:b="default",haptic:k=!0,animation:p="scale",maxTabs:w,moreLabel:M="More",moreIcon:f=de.more,safeArea:m=!0,activeColor:x,inactiveColor:D,backgroundColor:T,hideOnScroll:N="none",lockScroll:y=!0,className:H="",style:B,...I},W){var ee;const[L,g]=e.useState(c||((ee=r[0])==null?void 0:ee.id)||""),[j,O]=e.useState(!1),U=e.useRef(0),E=s!==void 0,$=E?s:L;e.useEffect(()=>{if(N==="none"||typeof window>"u")return;const P=()=>{const X=window.scrollY,F=X>U.current?"down":"up";F===N&&X>50?O(!0):F!==N&&O(!1),U.current=X};return window.addEventListener("scroll",P,{passive:!0}),()=>window.removeEventListener("scroll",P)},[N]);const A=e.useCallback(P=>{const X=r.find(F=>F.id===P);!X||X.disabled||(k&&"vibrate"in navigator&&navigator.vibrate(10),E||g(P),a==null||a(P))},[r,k,E,a]),Y=w&&r.length>w?r.slice(0,w-1):r,z=w&&r.length>w?r.slice(w-1):[],G={activeTab:$,setActiveTab:A,tabs:r},Q={...B};return T&&(Q.backgroundColor=T),t.jsx(St.Provider,{value:G,children:t.jsxs("nav",{ref:W,className:`nice-mobile-tabs nice-mobile-tabs--${u} nice-mobile-tabs--${b} ${m?"nice-mobile-tabs--safe-area":""} ${j?"nice-mobile-tabs--hidden":""} ${H}`,style:Q,role:"tablist","aria-label":"Main navigation",...I,children:[Y.map(P=>{const X=P.id===$,F=d||l&&X;return t.jsx(lt,{tab:P,isActive:X,showLabel:F,animation:p,activeColor:x,inactiveColor:D,onClick:()=>A(P.id)},P.id)}),z.length>0&&t.jsx(lt,{tab:{id:"__more__",label:M,icon:f,badge:z.some(P=>P.badge)?!0:void 0},isActive:z.some(P=>P.id===$),showLabel:d||l,animation:p,activeColor:x,inactiveColor:D,onClick:()=>{console.log("Open more menu",z)}})]})})}),Ln={basic:[{id:"home",label:"Home",icon:de.home,activeIcon:de.homeFilled},{id:"search",label:"Search",icon:de.search},{id:"notifications",label:"Alerts",icon:de.bell,activeIcon:de.bellFilled},{id:"profile",label:"Profile",icon:de.user,activeIcon:de.userFilled}],social:[{id:"feed",label:"Feed",icon:de.home,activeIcon:de.homeFilled},{id:"discover",label:"Discover",icon:de.search},{id:"create",label:"Create",icon:de.plus},{id:"activity",label:"Activity",icon:de.heart,activeIcon:de.heartFilled},{id:"profile",label:"Profile",icon:de.user,activeIcon:de.userFilled}],ecommerce:[{id:"shop",label:"Shop",icon:de.home,activeIcon:de.homeFilled},{id:"search",label:"Search",icon:de.search},{id:"cart",label:"Cart",icon:de.cart},{id:"favorites",label:"Wishlist",icon:de.heart,activeIcon:de.heartFilled},{id:"account",label:"Account",icon:de.user,activeIcon:de.userFilled}],messaging:[{id:"chats",label:"Chats",icon:de.inbox},{id:"calls",label:"Calls",icon:de.bell},{id:"contacts",label:"Contacts",icon:de.user,activeIcon:de.userFilled},{id:"settings",label:"Settings",icon:de.settings}]},Pt=e.createContext(null);function Bn(){const n=e.useContext(Pt);if(!n)throw new Error("useMobileHeader must be used within a NiceMobileHeader");return n}function Hn(n={}){const{collapsedHeight:r=56,expandedHeight:s=200,scrollElement:c,mode:a="scroll",threshold:l=0}=n,[d,u]=e.useState(0),[b,k]=e.useState(!0),p=e.useRef(null),w=e.useRef(0),M=e.useRef(!1),f=s-r,m=s-d*f,x=d>=1;e.useEffect(()=>{const N=c||p.current||window,y=()=>{M.current||(M.current=!0,requestAnimationFrame(()=>{const H=N===window?window.scrollY:N.scrollTop,B=H-w.current;if(a==="scroll"||a==="exitUntilCollapsed"){const I=Math.min(1,Math.max(0,(H-l)/f));u(I)}if(a==="enterAlways"){B>5&&H>l?k(!1):B<-5&&k(!0);const I=f>0?Math.min(1,Math.max(0,H/f)):0;u(I)}w.current=H,M.current=!1}))};return N.addEventListener("scroll",y,{passive:!0}),y(),()=>N.removeEventListener("scroll",y)},[c,a,l,f]);const D=e.useCallback(()=>{u(0),k(!0)},[]),T=e.useCallback(()=>{u(1)},[]);return{progress:d,height:m,isCollapsed:x,isVisible:b,scrollRef:p,expand:D,collapse:T}}const An=()=>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"})}),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("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"})]}),Fn=()=>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"})]}),Vn=()=>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"})]}),zn={back:t.jsx(An,{}),menu:t.jsx(Yn,{}),search:t.jsx(Fn,{}),more:t.jsx(Vn,{})},Wn=({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})]}),Ee=e.forwardRef(function({title:r,largeTitle:s,subtitle:c,leftAction:a,rightActions:l=[],background:d,mode:u="scroll",variant:b="default",collapsedHeight:k=56,expandedHeight:p=s||d?140:56,parallax:w=!1,parallaxSpeed:M=.5,showShadow:f=!0,sticky:m=!0,zIndex:x=100,scrollElement:D,onCollapseChange:T,safeArea:N=!0,backgroundColor:y,textColor:H,showBorder:B=!1,collapsedContent:I,expandedContent:W,className:L="",style:g,children:j,...O},U){const[E,$]=e.useState(0),[A,Y]=e.useState(!0),z=e.useRef(null),G=e.useRef(0),Q=e.useRef(!1),ee=p-k,P=p-E*ee,X=E>=.9;e.useEffect(()=>{const i=D||window,h=()=>{Q.current||(Q.current=!0,requestAnimationFrame(()=>{const R=i===window?window.scrollY:i.scrollTop,V=R-G.current;if(u==="scroll"||u==="exitUntilCollapsed"){const q=ee>0?Math.min(1,Math.max(0,R/ee)):0;$(q),T&&Math.abs(q-E)>.05&&T(q>=.9,q)}if(u==="enterAlways"){V>5&&R>k?Y(!1):V<-5&&Y(!0);const q=ee>0?Math.min(1,Math.max(0,R/ee)):0;$(q)}G.current=R,Q.current=!1}))};return i.addEventListener("scroll",h,{passive:!0}),h(),()=>i.removeEventListener("scroll",h)},[D,u,ee,k,T,E]);const F=1-E*2,K=E>.5?(E-.5)*2:0,v=1-E,C=w?`translateY(${E*ee*M}px) scale(${1+E*.1})`:void 0,S={height:u==="pin"?k:P,zIndex:x,...g};y&&(S.backgroundColor=y),H&&(S.color=H);const o={progress:E,isCollapsed:X,height:P,expandedHeight:p,collapsedHeight:k};return t.jsxs(Pt.Provider,{value:o,children:[t.jsxs("header",{ref:i=>{z.current=i,typeof U=="function"?U(i):U&&(U.current=i)},className:`
2
2
  nice-mobile-header
3
- nice-mobile-header--${m}
4
- ${b?"nice-mobile-header--sticky":""}
5
- ${V&&f?"nice-mobile-header--shadow":""}
6
- ${A?"nice-mobile-header--border":""}
7
- ${M?"nice-mobile-header--safe-area":""}
8
- ${Q?"":"nice-mobile-header--hidden"}
3
+ nice-mobile-header--${b}
4
+ ${m?"nice-mobile-header--sticky":""}
5
+ ${X&&f?"nice-mobile-header--shadow":""}
6
+ ${B?"nice-mobile-header--border":""}
7
+ ${N?"nice-mobile-header--safe-area":""}
8
+ ${A?"":"nice-mobile-header--hidden"}
9
9
  ${L}
10
- `,style:x,role:"banner",...S,children:[d&&t.jsx("div",{className:"nice-header-background",style:{opacity:v,transform:h},children:d}),t.jsxs("div",{className:"nice-header-toolbar",style:{height:N},children:[a&&t.jsx("div",{className:"nice-header-left",children:a}),t.jsx("div",{className:"nice-header-center",style:{opacity:s?X: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(zn,{action:l},l.id))})]}),(s||W)&&t.jsx("div",{className:"nice-header-expanded",style:{opacity:F,visibility:F<=0?"hidden":"visible"},children:W||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})]})}),T]}),b&&t.jsx("div",{className:"nice-header-spacer",style:{height:u==="pin"?N:y}})]})}),Wn=e.forwardRef(function(r,s){return t.jsx(Ie,{ref:s,mode:"scroll",variant:"blur",collapsedHeight:44,expandedHeight:96,safeArea:!0,...r})}),On=e.forwardRef(function(r,s){return t.jsx(Ie,{ref:s,mode:"enterAlways",variant:"solid",collapsedHeight:56,expandedHeight:56,showShadow:!0,...r})}),Un=e.forwardRef(function(r,s){return t.jsx(Ie,{ref:s,mode:"scroll",variant:"transparent",collapsedHeight:56,expandedHeight:280,parallax:!0,parallaxSpeed:.5,...r})}),Pt=e.createContext(null);function Xn(){const n=e.useContext(Pt);if(!n)throw new Error("useMobilePicker must be used within a NiceMobilePicker");return n}function _n(n){var M;const{items:r,defaultValue:s,value:c,onChange:a,itemHeight:o=40,visibleItems:d=5,loop:u=!1}=n,m=e.useRef(null),N=e.useRef(void 0),y=e.useCallback(w=>{if(w===void 0)return 0;const H=r.findIndex(A=>A.value===w);return H>=0?H:0},[r]),[j,R]=e.useState(()=>y(c??s)),f=c!==void 0,b=f?y(c):j,p=(M=r[b])==null?void 0:M.value,C=e.useCallback((w,H=!0)=>{if(!m.current)return;const E=(u?(w%r.length+r.length)%r.length:Math.max(0,Math.min(w,r.length-1)))*o;m.current.scrollTo({top:E,behavior:H?"smooth":"auto"})},[r.length,o,d,u]),D=e.useCallback(w=>{const H=r[w];!H||H.disabled||(f||R(w),a==null||a(H.value,H))},[r,f,a]);return e.useEffect(()=>{const w=m.current;if(!w)return;const H=()=>{clearTimeout(N.current),N.current=setTimeout(()=>{const A=w.scrollTop,E=Math.round(A/o),W=Math.max(0,Math.min(E,r.length-1));C(W,!0),D(W)},100)};return w.addEventListener("scroll",H,{passive:!0}),()=>{w.removeEventListener("scroll",H),clearTimeout(N.current)}},[o,r.length,C,D]),e.useEffect(()=>{C(b,!1)},[]),{selectedValue:p,selectedIndex:b,setSelectedIndex:D,scrollToIndex:C,containerRef:m}}const $t=e.forwardRef(function({items:r,value:s,defaultValue:c,onChange:a,itemHeight:o=40,visibleItems:d=5,loop:u=!1,renderItem:m,className:N="",style:y,...j},R){const f=e.useRef(null),b=e.useRef(void 0),p=e.useRef(!1),C=e.useRef(0),D=e.useRef(0),M=e.useCallback(O=>{if(O===void 0)return 0;const K=r.findIndex(Z=>Z.value===O);return K>=0?K:0},[r]),[w,H]=e.useState(()=>M(s??c)),A=s!==void 0,E=A?M(s):w,W=Math.floor(d/2),L=o*d,g=W*o,T=e.useCallback((O,K=!0)=>{if(!f.current)return;const ee=Math.max(0,Math.min(O,r.length-1))*o;f.current.scrollTo({top:ee,behavior:K?"smooth":"auto"})},[r.length,o]),S=e.useCallback(O=>{const K=r[O];!K||K.disabled||(A||H(O),a==null||a(K.value,K))},[r,A,a]),Y=e.useCallback(()=>{if(!f.current)return;const O=f.current.scrollTop,K=Math.round(O/o),Z=Math.max(0,Math.min(K,r.length-1));T(Z,!0),S(Z)},[o,r.length,T,S]);e.useEffect(()=>{const O=f.current;if(!O)return;const K=()=>{clearTimeout(b.current),b.current=setTimeout(Y,100)};return O.addEventListener("scroll",K,{passive:!0}),()=>{O.removeEventListener("scroll",K),clearTimeout(b.current)}},[Y]),e.useEffect(()=>{T(E,!1)},[]);const P=O=>{var K;p.current=!0,C.current=O.touches[0].clientY,D.current=((K=f.current)==null?void 0:K.scrollTop)||0},B=O=>{if(!p.current||!f.current)return;const K=C.current-O.touches[0].clientY;f.current.scrollTop=D.current+K},Q=()=>{p.current=!1},U=O=>{T(O,!0),S(O)};return t.jsx("div",{ref:O=>{f.current=O,typeof R=="function"?R(O):R&&(R.current=O)},className:`nice-picker-column ${N}`,style:{height:L,...y},onTouchStart:P,onTouchMove:B,onTouchEnd:Q,...j,children:t.jsx("div",{className:"nice-picker-column-inner",style:{paddingTop:g,paddingBottom:g},children:r.map((O,K)=>{const Z=K===E,ee=Math.abs(K-E),I=ee===0?1:Math.max(.3,1-ee*.25),V=ee===0?1:Math.max(.85,1-ee*.05);return t.jsx("div",{className:`nice-picker-item ${Z?"nice-picker-item--selected":""} ${O.disabled?"nice-picker-item--disabled":""}`,style:{height:o,lineHeight:`${o}px`,opacity:I,transform:`scale(${V})`},onClick:()=>!O.disabled&&U(K),children:m?m(O,Z):O.label},String(O.value))})})})}),Ge=e.forwardRef(function({columns:r,value:s,defaultValue:c,onChange:a,itemHeight:o=40,visibleItems:d=5,loop:u=!1,showLabels:m=!1,renderItem:N,showIndicator:y=!0,indicatorClassName:j="",className:R="",style:f,...b},p){const[C,D]=e.useState(c??{}),M=s!==void 0,w=M?s:C,H=e.useCallback((L,g)=>{const T={...w,[L]:g};M||D(T),a==null||a(T,L)},[w,M,a]),A=o*d,E=Math.floor(d/2)*o,W={visibleItems:d,itemHeight:o,isScrolling:!1};return t.jsx(Pt.Provider,{value:W,children:t.jsxs("div",{ref:p,className:`nice-mobile-picker ${R}`,style:{height:m?A+24:A,...f},...b,children:[m&&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($t,{items:L.items,value:w[L.id],onChange:g=>H(L.id,g),itemHeight:o,visibleItems:d,loop:u,renderItem:N?(g,T)=>N(g,L.id,T):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 a=[];for(let o=n;o<=r;o+=s)a.push({value:o,label:String(o).padStart(c,"0")});return a}const qn=e.forwardRef(function({value:r,defaultValue:s={hour:12,minute:0},onChange:c,use24Hour:a=!1,minuteStep:o=1,...d},u){const m=e.useMemo(()=>we(a?0:1,a?23:12,1,2),[a]),N=e.useMemo(()=>we(0,59,o,2),[o]),y=[{value:"AM",label:"AM"},{value:"PM",label:"PM"}],j=[{id:"hour",items:m,width:60},{id:"minute",items:N,width:60}];a||j.push({id:"period",items:y,width:60});const R=e.useCallback(b=>{const p=b.hour,C=b.minute,D=b.period;let M=p;a||(D==="PM"&&p!==12?M=p+12:D==="AM"&&p===12&&(M=0)),c==null||c({hour:M,minute:C})},[a,c]),f=e.useMemo(()=>{if(!r)return s;if(a)return r;const b=r.hour%12||12,p=r.hour>=12?"PM":"AM";return{hour:b,minute:r.minute,period:p}},[r,s,a]);return t.jsx(Ge,{ref:u,columns:j,value:f,onChange:R,...d})}),Gn=["January","February","March","April","May","June","July","August","September","October","November","December"],Kn=e.forwardRef(function({value:r,defaultValue:s=new Date,onChange:c,minYear:a=new Date().getFullYear()-100,maxYear:o=new Date().getFullYear()+10,...d},u){const m=e.useMemo(()=>we(1,31,1,2),[]),N=e.useMemo(()=>Gn.map((b,p)=>({value:p,label:b})),[]),y=e.useMemo(()=>we(a,o,1,4),[a,o]),j=[{id:"day",items:m,width:60},{id:"month",items:N,flex:1},{id:"year",items:y,width:80}],R=e.useCallback(b=>{const p=b.day,C=b.month,D=b.year,M=new Date(D,C+1,0).getDate(),w=Math.min(p,M);c==null||c(new Date(D,C,w))},[c]),f=e.useMemo(()=>{const b=r??s;return{day:b.getDate(),month:b.getMonth(),year:b.getFullYear()}},[r,s]);return t.jsx(Ge,{ref:u,columns:j,value:f,onChange:R,...d})}),It=e.createContext(null);function Jn(){const n=e.useContext(It);if(!n)throw new Error("useMobileCalendar must be used within a NiceMobileCalendar");return n}const Qn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Et=["January","February","March","April","May","June","July","August","September","October","November","December"],Zn=["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 er(n,r,s){if(!r||!s)return!1;const c=n.getTime();return c>=r.getTime()&&c<=s.getTime()}function tr(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 lt(n,r){const s=new Date(n);return s.setFullYear(s.getFullYear()+r),s}function Lt(n={}){const{defaultDate:r=new Date,selectedDate:s,selectedDates:c,selectedRange:a,selectionMode:o="single",minDate:d,maxDate:u,disabledDates:m=[],events:N=[],weekStartDay:y=0,onChange:j}=n,[R,f]=e.useState(r),[b,p]=e.useState("day"),[C,D]=e.useState(null),[M,w]=e.useState([]),[H,A]=e.useState({start:null,end:null}),E=s??C,W=c??M,L=a??H,g=e.useCallback(I=>d&&I<d||u&&I>u?!0:m.some(V=>ve(V,I)),[d,u,m]),T=e.useCallback(I=>o==="single"&&E?ve(I,E):o==="multiple"?W.some(V=>ve(V,I)):!!(o==="range"&&(L.start&&ve(I,L.start)||L.end&&ve(I,L.end))),[o,E,W,L]),S=e.useCallback(I=>{if(!g(I)){if(o==="single")D(I),j==null||j(I);else if(o==="multiple"){const F=M.some(X=>ve(X,I))?M.filter(X=>!ve(X,I)):[...M,I];w(F),j==null||j(F)}else if(o==="range")if(!H.start||H.start&&H.end){const V={start:I,end:null};A(V),j==null||j(V)}else{const V=I<H.start?{start:I,end:H.start}:{start:H.start,end:I};A(V),j==null||j(V)}}},[o,M,H,g,j]),Y=e.useCallback(I=>f(I),[]),P=e.useCallback(()=>f(I=>Se(I,-1)),[]),B=e.useCallback(()=>f(I=>Se(I,1)),[]),Q=e.useCallback(()=>f(I=>lt(I,-1)),[]),U=e.useCallback(()=>f(I=>lt(I,1)),[]),O=e.useCallback(()=>f(new Date),[]),K=e.useCallback(()=>{const I=R.getFullYear(),V=R.getMonth(),F=new Date,v=(new Date(I,V,1).getDay()-y+7)%7,h=42,x=[];for(let i=0;i<h;i++){const l=new Date(I,V,1-v+i),k=l.getMonth()===V,$=l.getDate(),q=N.filter(_=>ve(_.date,l));x.push({date:l,dayOfMonth:$,isCurrentMonth:k,isToday:ve(l,F),isSelected:T(l),isInRange:er(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:q.length>0?q:void 0})}return x},[R,y,N,T,L,g]),Z=e.useCallback(()=>Et.map((I,V)=>({month:V,label:I})),[]),ee=e.useCallback(()=>{const I=R.getFullYear(),V=[];for(let F=I-50;F<=I+50;F++)V.push(F);return V},[R]);return{viewDate:R,selectedDate:E,selectedDates:W,selectedRange:L,view:b,setView:p,goToDate:Y,goToPrevMonth:P,goToNextMonth:B,goToPrevYear:Q,goToNextYear:U,goToToday:O,selectDate:S,isDateSelected:T,isDateDisabled:g,getDaysInMonth:K,getMonths:Z,getYears:ee}}const 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:"15 18 9 12 15 6"})}),rr=()=>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"})}),sr=({cell:n,compact:r,onClick:s,renderDay:c})=>c?t.jsx(t.Fragment,{children:c(n)}):t.jsxs("button",{type:"button",className:`
10
+ `,style:S,role:"banner",...O,children:[d&&t.jsx("div",{className:"nice-header-background",style:{opacity:v,transform:C},children:d}),t.jsxs("div",{className:"nice-header-toolbar",style:{height:k},children:[a&&t.jsx("div",{className:"nice-header-left",children:a}),t.jsx("div",{className:"nice-header-center",style:{opacity:s?K:1},children:I||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})]})}),l.length>0&&t.jsx("div",{className:"nice-header-right",children:l.map(i=>t.jsx(Wn,{action:i},i.id))})]}),(s||W)&&t.jsx("div",{className:"nice-header-expanded",style:{opacity:F,visibility:F<=0?"hidden":"visible"},children:W||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})]})}),j]}),m&&t.jsx("div",{className:"nice-header-spacer",style:{height:u==="pin"?k:p}})]})}),On=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,mode:"scroll",variant:"blur",collapsedHeight:44,expandedHeight:96,safeArea:!0,...r})}),Un=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,mode:"enterAlways",variant:"solid",collapsedHeight:56,expandedHeight:56,showShadow:!0,...r})}),Xn=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,mode:"scroll",variant:"transparent",collapsedHeight:56,expandedHeight:280,parallax:!0,parallaxSpeed:.5,...r})}),$t=e.createContext(null);function _n(){const n=e.useContext($t);if(!n)throw new Error("useMobilePicker must be used within a NiceMobilePicker");return n}function qn(n){var N;const{items:r,defaultValue:s,value:c,onChange:a,itemHeight:l=40,visibleItems:d=5,loop:u=!1}=n,b=e.useRef(null),k=e.useRef(void 0),p=e.useCallback(y=>{if(y===void 0)return 0;const H=r.findIndex(B=>B.value===y);return H>=0?H:0},[r]),[w,M]=e.useState(()=>p(c??s)),f=c!==void 0,m=f?p(c):w,x=(N=r[m])==null?void 0:N.value,D=e.useCallback((y,H=!0)=>{if(!b.current)return;const I=(u?(y%r.length+r.length)%r.length:Math.max(0,Math.min(y,r.length-1)))*l;b.current.scrollTo({top:I,behavior:H?"smooth":"auto"})},[r.length,l,d,u]),T=e.useCallback(y=>{const H=r[y];!H||H.disabled||(f||M(y),a==null||a(H.value,H))},[r,f,a]);return e.useEffect(()=>{const y=b.current;if(!y)return;const H=()=>{clearTimeout(k.current),k.current=setTimeout(()=>{const B=y.scrollTop,I=Math.round(B/l),W=Math.max(0,Math.min(I,r.length-1));D(W,!0),T(W)},100)};return y.addEventListener("scroll",H,{passive:!0}),()=>{y.removeEventListener("scroll",H),clearTimeout(k.current)}},[l,r.length,D,T]),e.useEffect(()=>{D(m,!1)},[]),{selectedValue:x,selectedIndex:m,setSelectedIndex:T,scrollToIndex:D,containerRef:b}}const It=e.forwardRef(function({items:r,value:s,defaultValue:c,onChange:a,itemHeight:l=40,visibleItems:d=5,loop:u=!1,renderItem:b,className:k="",style:p,...w},M){const f=e.useRef(null),m=e.useRef(void 0),x=e.useRef(!1),D=e.useRef(0),T=e.useRef(0),N=e.useCallback(z=>{if(z===void 0)return 0;const G=r.findIndex(Q=>Q.value===z);return G>=0?G:0},[r]),[y,H]=e.useState(()=>N(s??c)),B=s!==void 0,I=B?N(s):y,W=Math.floor(d/2),L=l*d,g=W*l,j=e.useCallback((z,G=!0)=>{if(!f.current)return;const ee=Math.max(0,Math.min(z,r.length-1))*l;f.current.scrollTo({top:ee,behavior:G?"smooth":"auto"})},[r.length,l]),O=e.useCallback(z=>{const G=r[z];!G||G.disabled||(B||H(z),a==null||a(G.value,G))},[r,B,a]),U=e.useCallback(()=>{if(!f.current)return;const z=f.current.scrollTop,G=Math.round(z/l),Q=Math.max(0,Math.min(G,r.length-1));j(Q,!0),O(Q)},[l,r.length,j,O]);e.useEffect(()=>{const z=f.current;if(!z)return;const G=()=>{clearTimeout(m.current),m.current=setTimeout(U,100)};return z.addEventListener("scroll",G,{passive:!0}),()=>{z.removeEventListener("scroll",G),clearTimeout(m.current)}},[U]),e.useEffect(()=>{j(I,!1)},[]);const E=z=>{var G;x.current=!0,D.current=z.touches[0].clientY,T.current=((G=f.current)==null?void 0:G.scrollTop)||0},$=z=>{if(!x.current||!f.current)return;const G=D.current-z.touches[0].clientY;f.current.scrollTop=T.current+G},A=()=>{x.current=!1},Y=z=>{j(z,!0),O(z)};return t.jsx("div",{ref:z=>{f.current=z,typeof M=="function"?M(z):M&&(M.current=z)},className:`nice-picker-column ${k}`,style:{height:L,...p},onTouchStart:E,onTouchMove:$,onTouchEnd:A,...w,children:t.jsx("div",{className:"nice-picker-column-inner",style:{paddingTop:g,paddingBottom:g},children:r.map((z,G)=>{const Q=G===I,ee=Math.abs(G-I),P=ee===0?1:Math.max(.3,1-ee*.25),X=ee===0?1:Math.max(.85,1-ee*.05);return t.jsx("div",{className:`nice-picker-item ${Q?"nice-picker-item--selected":""} ${z.disabled?"nice-picker-item--disabled":""}`,style:{height:l,lineHeight:`${l}px`,opacity:P,transform:`scale(${X})`},onClick:()=>!z.disabled&&Y(G),children:b?b(z,Q):z.label},String(z.value))})})})}),Ke=e.forwardRef(function({columns:r,value:s,defaultValue:c,onChange:a,itemHeight:l=40,visibleItems:d=5,loop:u=!1,showLabels:b=!1,renderItem:k,showIndicator:p=!0,indicatorClassName:w="",className:M="",style:f,...m},x){const[D,T]=e.useState(c??{}),N=s!==void 0,y=N?s:D,H=e.useCallback((L,g)=>{const j={...y,[L]:g};N||T(j),a==null||a(j,L)},[y,N,a]),B=l*d,I=Math.floor(d/2)*l,W={visibleItems:d,itemHeight:l,isScrolling:!1};return t.jsx($t.Provider,{value:W,children:t.jsxs("div",{ref:x,className:`nice-mobile-picker ${M}`,style:{height:b?B+24:B,...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:[p&&t.jsx("div",{className:`nice-picker-indicator ${w}`,style:{top:I,height:l}}),t.jsx("div",{className:"nice-picker-columns",children:r.map(L=>t.jsx(It,{items:L.items,value:y[L.id],onChange:g=>H(L.id,g),itemHeight:l,visibleItems:d,loop:u,renderItem:k?(g,j)=>k(g,L.id,j):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 ke(n,r,s=1,c=2){const a=[];for(let l=n;l<=r;l+=s)a.push({value:l,label:String(l).padStart(c,"0")});return a}const Gn=e.forwardRef(function({value:r,defaultValue:s={hour:12,minute:0},onChange:c,use24Hour:a=!1,minuteStep:l=1,...d},u){const b=e.useMemo(()=>ke(a?0:1,a?23:12,1,2),[a]),k=e.useMemo(()=>ke(0,59,l,2),[l]),p=[{value:"AM",label:"AM"},{value:"PM",label:"PM"}],w=[{id:"hour",items:b,width:60},{id:"minute",items:k,width:60}];a||w.push({id:"period",items:p,width:60});const M=e.useCallback(m=>{const x=m.hour,D=m.minute,T=m.period;let N=x;a||(T==="PM"&&x!==12?N=x+12:T==="AM"&&x===12&&(N=0)),c==null||c({hour:N,minute:D})},[a,c]),f=e.useMemo(()=>{if(!r)return s;if(a)return r;const m=r.hour%12||12,x=r.hour>=12?"PM":"AM";return{hour:m,minute:r.minute,period:x}},[r,s,a]);return t.jsx(Ke,{ref:u,columns:w,value:f,onChange:M,...d})}),Kn=["January","February","March","April","May","June","July","August","September","October","November","December"],Jn=e.forwardRef(function({value:r,defaultValue:s=new Date,onChange:c,minYear:a=new Date().getFullYear()-100,maxYear:l=new Date().getFullYear()+10,...d},u){const b=e.useMemo(()=>ke(1,31,1,2),[]),k=e.useMemo(()=>Kn.map((m,x)=>({value:x,label:m})),[]),p=e.useMemo(()=>ke(a,l,1,4),[a,l]),w=[{id:"day",items:b,width:60},{id:"month",items:k,flex:1},{id:"year",items:p,width:80}],M=e.useCallback(m=>{const x=m.day,D=m.month,T=m.year,N=new Date(T,D+1,0).getDate(),y=Math.min(x,N);c==null||c(new Date(T,D,y))},[c]),f=e.useMemo(()=>{const m=r??s;return{day:m.getDate(),month:m.getMonth(),year:m.getFullYear()}},[r,s]);return t.jsx(Ke,{ref:u,columns:w,value:f,onChange:M,...d})}),Et=e.createContext(null);function Qn(){const n=e.useContext(Et);if(!n)throw new Error("useMobileCalendar must be used within a NiceMobileCalendar");return n}const Zn=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],Lt=["January","February","March","April","May","June","July","August","September","October","November","December"],er=["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 tr(n,r,s){if(!r||!s)return!1;const c=n.getTime();return c>=r.getTime()&&c<=s.getTime()}function nr(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 ot(n,r){const s=new Date(n);return s.setFullYear(s.getFullYear()+r),s}function Bt(n={}){const{defaultDate:r=new Date,selectedDate:s,selectedDates:c,selectedRange:a,selectionMode:l="single",minDate:d,maxDate:u,disabledDates:b=[],events:k=[],weekStartDay:p=0,onChange:w}=n,[M,f]=e.useState(r),[m,x]=e.useState("day"),[D,T]=e.useState(null),[N,y]=e.useState([]),[H,B]=e.useState({start:null,end:null}),I=s??D,W=c??N,L=a??H,g=e.useCallback(P=>d&&P<d||u&&P>u?!0:b.some(X=>ve(X,P)),[d,u,b]),j=e.useCallback(P=>l==="single"&&I?ve(P,I):l==="multiple"?W.some(X=>ve(X,P)):!!(l==="range"&&(L.start&&ve(P,L.start)||L.end&&ve(P,L.end))),[l,I,W,L]),O=e.useCallback(P=>{if(!g(P)){if(l==="single")T(P),w==null||w(P);else if(l==="multiple"){const F=N.some(K=>ve(K,P))?N.filter(K=>!ve(K,P)):[...N,P];y(F),w==null||w(F)}else if(l==="range")if(!H.start||H.start&&H.end){const X={start:P,end:null};B(X),w==null||w(X)}else{const X=P<H.start?{start:P,end:H.start}:{start:H.start,end:P};B(X),w==null||w(X)}}},[l,N,H,g,w]),U=e.useCallback(P=>f(P),[]),E=e.useCallback(()=>f(P=>Se(P,-1)),[]),$=e.useCallback(()=>f(P=>Se(P,1)),[]),A=e.useCallback(()=>f(P=>ot(P,-1)),[]),Y=e.useCallback(()=>f(P=>ot(P,1)),[]),z=e.useCallback(()=>f(new Date),[]),G=e.useCallback(()=>{const P=M.getFullYear(),X=M.getMonth(),F=new Date,v=(new Date(P,X,1).getDay()-p+7)%7,C=42,S=[];for(let o=0;o<C;o++){const i=new Date(P,X,1-v+o),h=i.getMonth()===X,R=i.getDate(),V=k.filter(q=>ve(q.date,i));S.push({date:i,dayOfMonth:R,isCurrentMonth:h,isToday:ve(i,F),isSelected:j(i),isInRange:tr(i,L.start,L.end),isRangeStart:L.start?ve(i,L.start):!1,isRangeEnd:L.end?ve(i,L.end):!1,isDisabled:g(i),isWeekend:i.getDay()===0||i.getDay()===6,events:V.length>0?V:void 0})}return S},[M,p,k,j,L,g]),Q=e.useCallback(()=>Lt.map((P,X)=>({month:X,label:P})),[]),ee=e.useCallback(()=>{const P=M.getFullYear(),X=[];for(let F=P-50;F<=P+50;F++)X.push(F);return X},[M]);return{viewDate:M,selectedDate:I,selectedDates:W,selectedRange:L,view:m,setView:x,goToDate:U,goToPrevMonth:E,goToNextMonth:$,goToPrevYear:A,goToNextYear:Y,goToToday:z,selectDate:O,isDateSelected:j,isDateDisabled:g,getDaysInMonth:G,getMonths:Q,getYears:ee}}const rr=()=>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"})}),sr=()=>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"})}),cr=({cell:n,compact:r,onClick:s,renderDay:c})=>c?t.jsx(t.Fragment,{children:c(n)}):t.jsxs("button",{type:"button",className:`
11
11
  nice-calendar-day
12
12
  ${n.isCurrentMonth?"":"nice-calendar-day--other-month"}
13
13
  ${n.isToday?"nice-calendar-day--today":""}
@@ -17,10 +17,10 @@
17
17
  ${n.isRangeEnd?"nice-calendar-day--range-end":""}
18
18
  ${n.isDisabled?"nice-calendar-day--disabled":""}
19
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((a,o)=>t.jsx("span",{className:"nice-calendar-day-dot",style:a.color?{backgroundColor:a.color}:void 0},a.id))})]}),Ke=e.forwardRef(function({defaultDate:r,viewDate:s,selectedDate:c,selectedDates:a,selectedRange:o,selectionMode:d="single",minDate:u,maxDate:m,disabledDates:N=[],disableWeekends:y=!1,events:j=[],weekStartDay:R=0,locale:f="en-US",showWeekNumbers:b=!1,showAdjacentMonths:p=!0,enableSwipe:C=!0,onChange:D,onViewChange:M,onMonthChange:w,renderDay:H,renderHeader:A,showTodayButton:E=!0,todayLabel:W="Today",compact:L=!1,className:g="",...T},S){const Y=e.useMemo(()=>N,[N,y]),P=Lt({defaultDate:r,selectedDate:c,selectedDates:a,selectedRange:o,selectionMode:d,minDate:u,maxDate:m,disabledDates:Y,events:j,weekStartDay:R,onChange:D}),[B,Q]=e.useState(s??r??new Date),U=e.useRef(0),O=e.useRef(0);e.useEffect(()=>{s&&Q(s)},[s]);const K=e.useCallback(()=>{const i=Se(B,-1);Q(i),P.goToDate(i),w==null||w(i),M==null||M(i,P.view)},[B,P,w,M]),Z=e.useCallback(()=>{const i=Se(B,1);Q(i),P.goToDate(i),w==null||w(i),M==null||M(i,P.view)},[B,P,w,M]),ee=e.useCallback(()=>{const i=new Date;Q(i),P.goToDate(i),w==null||w(i)},[P,w]),I=e.useCallback(i=>{C&&(U.current=i.touches[0].clientX)},[C]),V=e.useCallback(i=>{C&&(O.current=i.touches[0].clientX)},[C]),F=e.useCallback(()=>{if(!C)return;const i=U.current-O.current;Math.abs(i)>50&&(i>0?Z():K())},[C,Z,K]),X=e.useCallback(i=>{y&&(i.getDay()===0||i.getDay()===6)||P.selectDate(i)},[P,y]),v=e.useMemo(()=>{const i=[...Qn];return[...i.slice(R),...i.slice(0,R)]},[R]),h=P.getDaysInMonth(),x={viewDate:B,selectedDate:P.selectedDate,selectedDates:P.selectedDates,selectedRange:P.selectedRange,selectionMode:d,view:P.view,selectDate:X,setView:P.setView,goToDate:P.goToDate};return t.jsx(It.Provider,{value:x,children:t.jsxs("div",{ref:S,className:`nice-mobile-calendar ${L?"nice-mobile-calendar--compact":""} ${g}`,onTouchStart:I,onTouchMove:V,onTouchEnd:F,...T,children:[A?A(B,P.view,{prev:K,next:Z,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(nr,{})}),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:Et[B.getMonth()]}),t.jsx("span",{className:"nice-calendar-year",children:B.getFullYear()})]}),t.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:Z,"aria-label":"Next month",children:t.jsx(rr,{})})]}),P.view==="day"&&t.jsxs(t.Fragment,{children:[t.jsxs("div",{className:`nice-calendar-weekdays ${b?"nice-calendar-weekdays--with-numbers":""}`,children:[b&&t.jsx("div",{className:"nice-calendar-weekday nice-calendar-weekday--number",children:"W"}),v.map((i,l)=>t.jsx("div",{className:"nice-calendar-weekday",children:L?i.charAt(0):i},i))]}),t.jsx("div",{className:`nice-calendar-grid ${b?"nice-calendar-grid--with-numbers":""}`,children:h.map((i,l)=>{const k=b&&l%7===0;return t.jsxs(e.Fragment,{children:[k&&t.jsx("div",{className:"nice-calendar-week-number",children:tr(i.date)}),!i.isCurrentMonth&&!p?t.jsx("div",{className:"nice-calendar-day nice-calendar-day--empty"}):t.jsx(sr,{cell:{...i,isDisabled:i.isDisabled||y&&i.isWeekend},compact:L,onClick:()=>X(i.date),renderDay:H})]},i.date.toISOString())})})]}),P.view==="month"&&t.jsx("div",{className:"nice-calendar-months",children:P.getMonths().map(({month:i,label:l})=>t.jsx("button",{type:"button",className:`nice-calendar-month-btn ${i===B.getMonth()?"nice-calendar-month-btn--selected":""}`,onClick:()=>{const k=new Date(B.getFullYear(),i,1);Q(k),P.goToDate(k),P.setView("day")},children:L?Zn[i]:l},i))}),P.view==="year"&&t.jsx("div",{className:"nice-calendar-years",children:P.getYears().map(i=>t.jsx("button",{type:"button",className:`nice-calendar-year-btn ${i===B.getFullYear()?"nice-calendar-year-btn--selected":""}`,onClick:()=>{const l=new Date(i,B.getMonth(),1);Q(l),P.goToDate(l),P.setView("month")},children:i},i))}),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:W})})]})})}),cr=e.forwardRef(function(r,s){return t.jsx(Ke,{ref:s,selectionMode:"range",...r})}),ir=e.forwardRef(function(r,s){return t.jsx(Ke,{ref:s,selectionMode:"multiple",...r})}),Bt=e.createContext(null);function ar(){const n=e.useContext(Bt);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 ot(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 Ht(n={}){const{enablePinch:r=!0,enableRotation:s=!0,enablePan:c=!0,enableSwipe:a=!0,enableTap:o=!0,enableDoubleTap:d=!0,enableLongPress:u=!0,minScale:m=.5,maxScale:N=4,panThreshold:y=5,swipeVelocityThreshold:j=.5,swipeDistanceThreshold:R=50,longPressDuration:f=500,doubleTapDelay:b=300,onPinchStart:p,onPinch:C,onPinchEnd:D,onRotateStart:M,onRotate:w,onRotateEnd:H,onPanStart:A,onPan:E,onPanEnd:W,onSwipe:L,onTap:g,onDoubleTap:T,onLongPress:S}=n,[Y,P]=e.useState({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),B=e.useRef(new Map),Q=e.useRef(0),U=e.useRef(0),O=e.useRef(1),K=e.useRef(0),Z=e.useRef({x:0,y:0}),ee=e.useRef(0),I=e.useRef({x:0,y:0}),V=e.useRef(0),F=e.useRef({x:0,y:0}),X=e.useRef(0),v=e.useRef(null),h=e.useRef(!1),x=e.useRef(!1),i=e.useRef(!1),l=e.useCallback(()=>{v.current&&(clearTimeout(v.current),v.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}),O.current=1,K.current=0,Z.current={x:0,y:0}},[]),$=e.useCallback(se=>{se.currentTarget.setPointerCapture(se.pointerId),B.current.set(se.pointerId,{x:se.clientX,y:se.clientY});const oe=B.current.size;if(oe===1)V.current=Date.now(),F.current={x:se.clientX,y:se.clientY},I.current={x:se.clientX,y:se.clientY},ee.current=Date.now(),u&&(l(),v.current=setTimeout(()=>{S==null||S({position:{x:se.clientX,y:se.clientY},duration:f,target:se.target})},f));else if(oe===2){l();const[ne,te]=Array.from(B.current.values());Q.current=ge(ne,te),U.current=ot(ne,te),O.current=Y.scale,K.current=Y.rotation,r&&!x.current&&(x.current=!0,p==null||p()),s&&!i.current&&(i.current=!0,M==null||M())}P(ne=>({...ne,isActive:!0}))},[Y.scale,Y.rotation,u,r,s,f,S,p,M,l]),q=e.useCallback(se=>{if(!B.current.has(se.pointerId))return;B.current.set(se.pointerId,{x:se.clientX,y:se.clientY});const oe=B.current.size,ne=Date.now();if(oe===1){const te={x:se.clientX,y:se.clientY},ae={x:te.x-I.current.x,y:te.y-I.current.y},z={x:te.x-F.current.x,y:te.y-F.current.y};if(ge(F.current,te)>y&&(l(),c)){h.current||(h.current=!0,A==null||A());const J=ne-ee.current,ce=J>0?{x:ae.x/J*1e3,y:ae.y/J*1e3}:{x:0,y:0},le={x:Z.current.x+z.x,y:Z.current.y+z.y};P(ue=>({...ue,translation:le,velocity:ce,center:te})),E==null||E({translation:le,delta:ae,velocity:ce,center:te,direction:Fe(ae)})}I.current=te,ee.current=ne}else if(oe===2){const[te,ae]=Array.from(B.current.values()),z=ge(te,ae),G=ot(te,ae),J=Ye(te,ae);if(r){const ce=Math.max(m,Math.min(N,O.current*(z/Q.current))),le=ce-Y.scale;P(ue=>({...ue,scale:ce,center:J})),C==null||C({scale:ce,deltaScale:le,center:J,distance:z,initialDistance:Q.current})}if(s){let ce=G-U.current;ce>180&&(ce-=360),ce<-180&&(ce+=360);const le=K.current+ce,ue=le-Y.rotation;P(fe=>({...fe,rotation:le,center:J})),w==null||w({rotation:le,deltaRotation:ue,center:J})}}},[c,r,s,m,N,y,Y.scale,Y.rotation,E,A,C,w,l]),_=e.useCallback(se=>{se.currentTarget.releasePointerCapture(se.pointerId),l();const oe=B.current.size,ne=Date.now();if(oe===1){const te={x:se.clientX,y:se.clientY},ae=ge(F.current,te),z=ne-V.current;if(ae<y)d&&ne-X.current<b?(T==null||T({position:te,target:se.target}),X.current=0):o&&(setTimeout(()=>{X.current===ne&&(g==null||g({position:te,target:se.target}))},b),X.current=ne);else{const G=ae/z*1e3;if(a&&G>j&&ae>R){const J={x:te.x-F.current.x,y:te.y-F.current.y},ce=Fe(J);ce&&(L==null||L({direction:ce,velocity:G,distance:ae,duration:z}))}if(h.current){const J=ne-ee.current,ce={x:te.x-I.current.x,y:te.y-I.current.y},le=J>0?{x:ce.x/J*1e3,y:ce.y/J*1e3}:{x:0,y:0};W==null||W({translation:Y.translation,delta:ce,velocity:le,center:te,direction:Fe(ce)})}}Z.current=Y.translation}if(oe===2){if(x.current){const[te,ae]=Array.from(B.current.values()),z=Ye(te,ae);D==null||D({scale:Y.scale,deltaScale:0,center:z,distance:ge(te,ae),initialDistance:Q.current})}if(i.current){const[te,ae]=Array.from(B.current.values()),z=Ye(te,ae);H==null||H({rotation:Y.rotation,deltaRotation:0,center:z})}}B.current.delete(se.pointerId),B.current.size===0&&(h.current=!1,x.current=!1,i.current=!1,P(te=>({...te,isActive:!1})))},[o,d,a,b,y,j,R,Y.scale,Y.rotation,Y.translation,g,T,L,W,D,H,l]),re=e.useCallback(se=>{l(),B.current.delete(se.pointerId),B.current.size===0&&(h.current=!1,x.current=!1,i.current=!1,P(oe=>({...oe,isActive:!1})))},[l]),ie=e.useCallback(()=>({onPointerDown:$,onPointerMove:q,onPointerUp:_,onPointerCancel:re,style:{touchAction:"none"}}),[$,q,_,re]);return e.useEffect(()=>()=>{l()},[l]),{bind:ie,state:Y,reset:k}}const Ee=e.forwardRef(function({enablePinch:r=!0,enableRotation:s=!0,enablePan:c=!0,enableSwipe:a=!0,enableTap:o=!0,enableDoubleTap:d=!0,enableLongPress:u=!0,minScale:m=.5,maxScale:N=4,applyTransform:y=!1,initialScale:j=1,scale:R,initialRotation:f=0,rotation:b,initialTranslation:p={x:0,y:0},translation:C,onTransformChange:D,onPinchStart:M,onPinch:w,onPinchEnd:H,onRotateStart:A,onRotate:E,onRotateEnd:W,onPanStart:L,onPan:g,onPanEnd:T,onSwipe:S,onTap:Y,onDoubleTap:P,onLongPress:B,children:Q,className:U="",style:O,...K},Z){const ee=Ht({enablePinch:r,enableRotation:s,enablePan:c,enableSwipe:a,enableTap:o,enableDoubleTap:d,enableLongPress:u,minScale:m,maxScale:N,onPinchStart:M,onPinch:l=>{w==null||w(l),D==null||D(ee.state)},onPinchEnd:H,onRotateStart:A,onRotate:l=>{E==null||E(l),D==null||D(ee.state)},onRotateEnd:W,onPanStart:L,onPan:l=>{g==null||g(l),D==null||D(ee.state)},onPanEnd:T,onSwipe:S,onTap:Y,onDoubleTap:P,onLongPress:B}),{bind:I,state:V}=ee,F=I(),X=R??V.scale,v=b??V.rotation,h=C??V.translation,x=y?{transform:`translate(${h.x}px, ${h.y}px) scale(${X}) rotate(${v}deg)`,transformOrigin:`${V.center.x}px ${V.center.y}px`}:{},i={state:{...V,scale:X,rotation:v,translation:h},reset:ee.reset};return t.jsx(Bt.Provider,{value:i,children:t.jsx("div",{ref:Z,className:`nice-gestures ${V.isActive?"nice-gestures--active":""} ${U}`,style:{...F.style,...O,...x},onPointerDown:F.onPointerDown,onPointerMove:F.onPointerMove,onPointerUp:F.onPointerUp,onPointerCancel:F.onPointerCancel,...K,children:Q})})}),lr=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})}),or=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})}),ur=e.forwardRef(function(r,s){return t.jsx(Ee,{ref:s,enablePinch:!1,enableRotation:!1,enablePan:!1,enableSwipe:!0,enableTap:!1,enableLongPress:!1,...r})}),Je={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},dr={light:.5,medium:1,heavy:1.5};function pe(){return typeof navigator<"u"&&"vibrate"in navigator}function fr(n,r){return typeof n=="number"?Math.round(n*r):n.map(s=>Math.round(s*r))}function hr(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const At=e.createContext(null);function vr(){const n=e.useContext(At);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,a=e.useRef(r),[o,d]=e.useState(r),u=e.useMemo(()=>pe(),[]),m=e.useCallback(b=>{a.current=b,d(b)},[]),N=e.useCallback(()=>dr[s],[s]),y=e.useCallback((b=50)=>{if(!u||!a.current)return!1;try{const p=fr(b,N());return navigator.vibrate(p)}catch{return!1}},[u,N]),j=e.useCallback(()=>{u&&navigator.vibrate(0)},[u]),R=e.useCallback(b=>{if(!u||!a.current)return!1;const p=Je[b];return p?y(p):!1},[u,y]),f=e.useCallback(b=>{if(!u||!a.current)return!1;const p=c[b];return p?y(p):!1},[u,c,y]);return{isSupported:u,isEnabled:o,setEnabled:m,vibrate:y,cancel:j,trigger:R,triggerPattern:f,getIntensityMultiplier:N}}function br({enabled:n=!0,intensity:r="medium",respectReducedMotion:s=!0,customPatterns:c={},children:a}){const o=e.useMemo(()=>s&&hr()?!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)"),m=N=>{d.setEnabled(!N.matches&&n)};return u.addEventListener("change",m),()=>u.removeEventListener("change",m)},[s,n,d]),t.jsx(At.Provider,{value:d,children:a})}function mr(n=50){if(!pe())return!1;try{return navigator.vibrate(n)}catch{return!1}}function xr(n){if(!pe())return!1;const r=Je[n];if(!r)return!1;try{return navigator.vibrate(r)}catch{return!1}}function pr(){pe()&&navigator.vibrate(0)}function gr(n){return function(s){const c=xe();return t.jsx(n,{...s,haptics:c})}}function yr(){const n=xe();return e.useCallback(()=>{n.trigger("button-press")},[n])}function wr(){const n=xe();return e.useCallback(r=>{n.trigger(r?"toggle-on":"toggle-off")},[n])}function kr(){const n=xe();return e.useCallback(()=>{n.trigger("selection")},[n])}function jr(){const n=xe();return e.useCallback(r=>{n.trigger(`notification-${r}`)},[n])}function Nr(){const n=xe();return e.useCallback((r="medium")=>{n.trigger(`impact-${r}`)},[n])}class Yt{constructor(){et(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 a=0;a<r;a++)this.vibrate(s),a<r-1&&this.pause(c);return this}rampUp(r,s){for(let c=1;c<=r;c++){const a=Math.round(s/r*c);this.vibrate(a),c<r&&this.pause(50)}return this}rampDown(r,s){for(let c=r;c>=1;c--){const a=Math.round(s/r*c);this.vibrate(a),c>1&&this.pause(50)}return this}build(){return[...this.pattern]}execute(){return pe()?navigator.vibrate(this.pattern):!1}}function Mr(){return new Yt}const Le={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Ce=["xs","sm","md","lg","xl","2xl"];function We(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 ut(n){return n==="xs"||n==="sm"?"mobile":n==="md"?"tablet":"desktop"}function dt(n,r){return n>=r?"landscape":"portrait"}function Oe(){return typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0}function be(n){return Ce.indexOf(n)}function Tr(n,r){let s=null;return(...c)=>{s&&clearTimeout(s),s=setTimeout(()=>n(...c),r)}}const Ft=e.createContext(null);function Rr(){const n=e.useContext(Ft);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,a=e.useMemo(()=>({...Le,...r}),[r]),[o,d]=e.useState(()=>{const f=typeof window<"u"?window.innerWidth:c,b=typeof window<"u"?window.innerHeight:768,p=We(f,a),C=ut(p),D=dt(f,b);return{width:f,height:b,breakpoint:p,deviceType:C,orientation:D,isMobile:C==="mobile",isTablet:C==="tablet",isDesktop:C==="desktop",isPortrait:D==="portrait",isLandscape:D==="landscape",isTouchDevice:Oe(),pixelRatio:typeof window<"u"?window.devicePixelRatio:1}});e.useEffect(()=>{if(typeof window>"u")return;const f=()=>{const p=window.innerWidth,C=window.innerHeight,D=We(p,a),M=ut(D),w=dt(p,C);d({width:p,height:C,breakpoint:D,deviceType:M,orientation:w,isMobile:M==="mobile",isTablet:M==="tablet",isDesktop:M==="desktop",isPortrait:w==="portrait",isLandscape:w==="landscape",isTouchDevice:Oe(),pixelRatio:window.devicePixelRatio})},b=Tr(f,s);return f(),window.addEventListener("resize",b),window.addEventListener("orientationchange",f),()=>{window.removeEventListener("resize",b),window.removeEventListener("orientationchange",f)}},[a,s]);const u=e.useCallback(f=>o.breakpoint===f,[o.breakpoint]),m=e.useCallback(f=>{const b=be(o.breakpoint),p=be(f);return b>=p},[o.breakpoint]),N=e.useCallback(f=>{const b=be(o.breakpoint),p=be(f);return b<p},[o.breakpoint]),y=e.useCallback((f,b)=>{const p=be(o.breakpoint),C=be(f),D=be(b);return p>=C&&p<=D},[o.breakpoint]),j=e.useCallback((f,b)=>{const p=be(o.breakpoint);for(let C=p;C>=0;C--){const D=Ce[C];if(f[D]!==void 0)return f[D]}return f.base??b},[o.breakpoint]),R=e.useCallback((f,b="min")=>{const p=a[f],C=be(f),D=Ce[C+1],M=D?a[D]-1:null;return b==="min"?`(min-width: ${p}px)`:b==="max"&&M?`(max-width: ${M}px)`:b==="only"?M?`(min-width: ${p}px) and (max-width: ${M}px)`:`(min-width: ${p}px)`:`(min-width: ${p}px)`},[a]);return{...o,is:u,isAbove:m,isBelow:N,isBetween:y,getResponsive:j,mediaQuery:R}}function Vt(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 a=o=>s(o.matches);return c.addEventListener("change",a),()=>c.removeEventListener("change",a)},[n]),r}function Dr({breakpoints:n,debounceDelay:r=100,children:s}){const c=ke({breakpoints:n,debounceDelay:r});return t.jsx(Ft.Provider,{value:c,children:s})}function Sr({on:n,above:r,below:s,device:c,orientation:a,children:o,fallback:d=null}){const u=ke();let m=!0;return n!==void 0?m=u.is(n):r!==void 0?m=u.isAbove(r):s!==void 0&&(m=u.isBelow(s)),c!==void 0&&(m=m&&u.deviceType===c),a!==void 0&&(m=m&&u.orientation===a),m?t.jsx(t.Fragment,{children:o}):t.jsx(t.Fragment,{children:d})}function Cr({on:n,above:r,below:s,device:c,orientation:a,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),a!==void 0&&(u=u||d.orientation===a),u?null:t.jsx(t.Fragment,{children:o})}function Pr(n,r="min",s=Le){const c=s[n],a=be(n),o=Ce[a+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 $r(n){return n}function zt(n=Le){return typeof window>"u"?null:We(window.innerWidth,n)}function Ir(){if(typeof window>"u")return!1;const n=zt();return n==="xs"||n==="sm"}function Er(){return Oe()}const Lr={sm:"nice-touch-btn--sm",md:"nice-touch-btn--md",lg:"nice-touch-btn--lg",xl:"nice-touch-btn--xl"},Br={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"},Hr={rounded:"nice-touch-btn--rounded",pill:"nice-touch-btn--pill",square:"nice-touch-btn--square",circle:"nice-touch-btn--circle"},Qe=e.forwardRef(function({variant:r="primary",size:s="md",shape:c="rounded",fullWidth:a=!1,loading:o=!1,leftIcon:d,rightIcon:u,iconOnly:m=!1,haptic:N=!0,hapticIntensity:y="light",ripple:j=!0,active:R=!1,disabled:f,className:b="",onClick:p,onPointerDown:C,children:D,...M},w){const[H,A]=e.useState(!1),[E,W]=e.useState(null),L=e.useRef(null),g=e.useCallback(U=>{L.current=U,typeof w=="function"?w(U):w&&(w.current=U)},[w]),T=e.useCallback(()=>{if(!N||typeof navigator>"u"||!("vibrate"in navigator))return;const U={light:10,medium:20,heavy:40};try{navigator.vibrate(U[y]||10)}catch{}},[N,y]),S=e.useCallback(U=>{if(!(f||o)){if(A(!0),j&&L.current){const O=L.current.getBoundingClientRect();W({x:U.clientX-O.left,y:U.clientY-O.top}),setTimeout(()=>W(null),600)}T(),C==null||C(U)}},[f,o,j,T,C]),Y=e.useCallback(()=>{A(!1)},[]),P=e.useCallback(()=>{A(!1)},[]),B=e.useCallback(U=>{f||o||p==null||p(U)},[f,o,p]),Q=["nice-touch-btn",Br[r],Lr[s],Hr[c],a?"nice-touch-btn--full-width":"",o?"nice-touch-btn--loading":"",m?"nice-touch-btn--icon-only":"",H?"nice-touch-btn--pressed":"",R?"nice-touch-btn--active":"",b].filter(Boolean).join(" ");return t.jsxs("button",{ref:g,type:"button",className:Q,disabled:f||o,onClick:B,onPointerDown:S,onPointerUp:Y,onPointerLeave:P,onPointerCancel:P,...M,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}),!m&&D&&t.jsx("span",{className:"nice-touch-btn-text",children:D}),u&&t.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--right",children:u})]})]})}),Ar=e.forwardRef(function({icon:r,...s},c){return t.jsx(Qe,{ref:c,iconOnly:!0,leftIcon:r,...s})}),Yr=e.forwardRef(function({position:r="bottom-right",mini:s=!1,className:c="",...a},o){const d=`nice-fab--${r}`;return t.jsx(Qe,{ref:o,shape:"circle",size:s?"md":"xl",className:`nice-fab ${d} ${c}`,...a})});function Wt(n){const{min:r,max:s,step:c,value:a,defaultValue:o=r,onChange:d,onChangeCommitted:u}=n,[m,N]=e.useState(o),y=a??m,j=Array.isArray(y),R=e.useCallback(M=>Math.min(s,Math.max(r,M)),[r,s]),f=e.useCallback(M=>{const w=Math.round((M-r)/c)*c+r;return R(w)},[r,c,R]),b=e.useMemo(()=>{const M=s-r;if(j){const[w,H]=y;return[(w-r)/M*100,(H-r)/M*100]}return(y-r)/M*100},[y,r,s,j]),p=e.useCallback(M=>{if(Array.isArray(M)){const[w,H]=M,A=[f(w),f(H)];A[0]>A[1]&&([A[0],A[1]]=[A[1],A[0]]),N(A),d==null||d(A)}else{const w=f(M);N(w),d==null||d(w)}},[f,d]),C=e.useCallback((M,w)=>{const H=s-r,A=M/100*H+r;if(j&&typeof w=="number"){const W=[...y];W[w]=f(A),p(W)}else p(A)},[s,r,j,y,f,p]),D=e.useCallback(()=>{u==null||u(y)},[y,u]);return{value:y,isRange:j,percentage:b,setValue:p,setValueByPercentage:C,commitValue:D,clamp:R,snap:f}}const Fr=e.forwardRef(function({value:r,defaultValue:s,min:c=0,max:a=100,step:o=1,orientation:d="horizontal",disabled:u=!1,marks:m=!1,markStep:N,labelDisplay:y="auto",formatLabel:j=T=>String(T),showRange:R=!1,trackColor:f,fillColor:b,thumbSize:p=44,trackHeight:C=8,haptic:D=!0,snapToMarks:M=!1,onChange:w,onChangeCommitted:H,className:A="","aria-label":E,"aria-labelledby":W,...L},g){const T=Wt({min:c,max:a,step:o,value:r,defaultValue:s,onChange:w,onChangeCommitted:H}),S=e.useRef(null),[Y,P]=e.useState(!1),[B,Q]=e.useState(null),[U,O]=e.useState(y==="on"),K=e.useRef(T.value),Z=e.useMemo(()=>{if(!m)return[];if(Array.isArray(m))return m;const l=[],k=N??o;for(let $=c;$<=a;$+=k)l.push({value:$});return l},[m,N,o,c,a]),ee=e.useCallback(l=>{if(!S.current)return 0;const k=S.current.getBoundingClientRect();if(d==="horizontal"){const $=l.clientX-k.left;return Math.max(0,Math.min(100,$/k.width*100))}else{const $=l.clientY-k.top;return Math.max(0,Math.min(100,100-$/k.height*100))}},[d]),I=e.useCallback(()=>{if(!(!D||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[D]),V=e.useCallback(l=>{if(!T.isRange)return 0;const[k,$]=T.percentage,q=Math.abs(l-k),_=Math.abs(l-$);return q<=_?0:1},[T.isRange,T.percentage]),F=e.useCallback((l,k)=>{if(u)return;l.preventDefault(),l.currentTarget.setPointerCapture(l.pointerId);const $=ee(l),q=k??V($);if(P(!0),Q(q),O(y!=="off"),M&&Z.length>0){const _=Z.reduce((re,ie)=>{const se=(re.value-c)/(a-c)*100,oe=(ie.value-c)/(a-c)*100;return Math.abs(oe-$)<Math.abs(se-$)?ie:re});T.setValue(T.isRange?q===0?[_.value,T.value[1]]:[T.value[0],_.value]:_.value)}else T.setValueByPercentage($,q);I()},[u,ee,V,y,M,Z,c,a,T,I]),X=e.useCallback(l=>{var $;if(!Y||u||B===null)return;const k=ee(l);if(M&&Z.length>0){const q=Z.reduce((re,ie)=>{const se=(re.value-c)/(a-c)*100,oe=(ie.value-c)/(a-c)*100;return Math.abs(oe-k)<Math.abs(se-k)?ie:re}),_=T.isRange?B===0?[q.value,T.value[1]]:[T.value[0],q.value]:q.value;JSON.stringify(_)!==JSON.stringify(K.current)&&(T.setValue(_),K.current=_,I())}else{T.setValueByPercentage(k,B);const q=T.isRange?T.value[B]:T.value,_=T.isRange?($=K.current)==null?void 0:$[B]:K.current;Math.abs(q-_)>=o&&(I(),K.current=T.value)}},[Y,u,B,ee,M,Z,c,a,T,o,I]),v=e.useCallback(l=>{Y&&(l.currentTarget.releasePointerCapture(l.pointerId),P(!1),Q(null),y==="auto"&&O(!1),T.commitValue())},[Y,y,T]),h=e.useCallback((l,k)=>{if(u)return;let $=T.isRange?T.value[k]:T.value;switch(l.key){case"ArrowRight":case"ArrowUp":l.preventDefault(),$=Math.min(a,$+o);break;case"ArrowLeft":case"ArrowDown":l.preventDefault(),$=Math.max(c,$-o);break;case"Home":l.preventDefault(),$=c;break;case"End":l.preventDefault(),$=a;break;case"PageUp":l.preventDefault(),$=Math.min(a,$+o*10);break;case"PageDown":l.preventDefault(),$=Math.max(c,$-o*10);break;default:return}if(T.isRange){const q=T.value;T.setValue(k===0?[$,q[1]]:[q[0],$])}else T.setValue($);I(),T.commitValue()},[u,T,a,c,o,I]),x=e.useMemo(()=>{if(T.isRange){const[k,$]=T.percentage;return d==="horizontal"?{left:`${k}%`,width:`${$-k}%`}:{bottom:`${k}%`,height:`${$-k}%`}}const l=T.percentage;return d==="horizontal"?{left:0,width:`${l}%`}:{bottom:0,height:`${l}%`}},[T.isRange,T.percentage,d]),i=(l,k)=>{const $=T.isRange?T.value[l]:T.value,q=d==="horizontal"?{left:`${k}%`}:{bottom:`${k}%`};return t.jsx("div",{className:`nice-touch-slider-thumb ${B===l?"nice-touch-slider-thumb--active":""}`,style:{...q,width:p,height:p},role:"slider",tabIndex:u?-1:0,"aria-label":E,"aria-labelledby":W,"aria-valuenow":$,"aria-valuemin":c,"aria-valuemax":a,"aria-disabled":u,onKeyDown:_=>h(_,l),children:U&&t.jsx("span",{className:"nice-touch-slider-label",children:j($)})},l)};return t.jsxs("div",{ref:g,className:`
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((a,l)=>t.jsx("span",{className:"nice-calendar-day-dot",style:a.color?{backgroundColor:a.color}:void 0},a.id))})]}),Je=e.forwardRef(function({defaultDate:r,viewDate:s,selectedDate:c,selectedDates:a,selectedRange:l,selectionMode:d="single",minDate:u,maxDate:b,disabledDates:k=[],disableWeekends:p=!1,events:w=[],weekStartDay:M=0,locale:f="en-US",showWeekNumbers:m=!1,showAdjacentMonths:x=!0,enableSwipe:D=!0,onChange:T,onViewChange:N,onMonthChange:y,renderDay:H,renderHeader:B,showTodayButton:I=!0,todayLabel:W="Today",compact:L=!1,className:g="",...j},O){const U=e.useMemo(()=>k,[k,p]),E=Bt({defaultDate:r,selectedDate:c,selectedDates:a,selectedRange:l,selectionMode:d,minDate:u,maxDate:b,disabledDates:U,events:w,weekStartDay:M,onChange:T}),[$,A]=e.useState(s??r??new Date),Y=e.useRef(0),z=e.useRef(0);e.useEffect(()=>{s&&A(s)},[s]);const G=e.useCallback(()=>{const o=Se($,-1);A(o),E.goToDate(o),y==null||y(o),N==null||N(o,E.view)},[$,E,y,N]),Q=e.useCallback(()=>{const o=Se($,1);A(o),E.goToDate(o),y==null||y(o),N==null||N(o,E.view)},[$,E,y,N]),ee=e.useCallback(()=>{const o=new Date;A(o),E.goToDate(o),y==null||y(o)},[E,y]),P=e.useCallback(o=>{D&&(Y.current=o.touches[0].clientX)},[D]),X=e.useCallback(o=>{D&&(z.current=o.touches[0].clientX)},[D]),F=e.useCallback(()=>{if(!D)return;const o=Y.current-z.current;Math.abs(o)>50&&(o>0?Q():G())},[D,Q,G]),K=e.useCallback(o=>{p&&(o.getDay()===0||o.getDay()===6)||E.selectDate(o)},[E,p]),v=e.useMemo(()=>{const o=[...Zn];return[...o.slice(M),...o.slice(0,M)]},[M]),C=E.getDaysInMonth(),S={viewDate:$,selectedDate:E.selectedDate,selectedDates:E.selectedDates,selectedRange:E.selectedRange,selectionMode:d,view:E.view,selectDate:K,setView:E.setView,goToDate:E.goToDate};return t.jsx(Et.Provider,{value:S,children:t.jsxs("div",{ref:O,className:`nice-mobile-calendar ${L?"nice-mobile-calendar--compact":""} ${g}`,onTouchStart:P,onTouchMove:X,onTouchEnd:F,...j,children:[B?B($,E.view,{prev:G,next:Q,setView:E.setView}):t.jsxs("div",{className:"nice-calendar-header",children:[t.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:G,"aria-label":"Previous month",children:t.jsx(rr,{})}),t.jsxs("button",{type:"button",className:"nice-calendar-title-btn",onClick:()=>E.setView(E.view==="day"?"month":"day"),children:[t.jsx("span",{className:"nice-calendar-month",children:Lt[$.getMonth()]}),t.jsx("span",{className:"nice-calendar-year",children:$.getFullYear()})]}),t.jsx("button",{type:"button",className:"nice-calendar-nav-btn",onClick:Q,"aria-label":"Next month",children:t.jsx(sr,{})})]}),E.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"}),v.map((o,i)=>t.jsx("div",{className:"nice-calendar-weekday",children:L?o.charAt(0):o},o))]}),t.jsx("div",{className:`nice-calendar-grid ${m?"nice-calendar-grid--with-numbers":""}`,children:C.map((o,i)=>{const h=m&&i%7===0;return t.jsxs(e.Fragment,{children:[h&&t.jsx("div",{className:"nice-calendar-week-number",children:nr(o.date)}),!o.isCurrentMonth&&!x?t.jsx("div",{className:"nice-calendar-day nice-calendar-day--empty"}):t.jsx(cr,{cell:{...o,isDisabled:o.isDisabled||p&&o.isWeekend},compact:L,onClick:()=>K(o.date),renderDay:H})]},o.date.toISOString())})})]}),E.view==="month"&&t.jsx("div",{className:"nice-calendar-months",children:E.getMonths().map(({month:o,label:i})=>t.jsx("button",{type:"button",className:`nice-calendar-month-btn ${o===$.getMonth()?"nice-calendar-month-btn--selected":""}`,onClick:()=>{const h=new Date($.getFullYear(),o,1);A(h),E.goToDate(h),E.setView("day")},children:L?er[o]:i},o))}),E.view==="year"&&t.jsx("div",{className:"nice-calendar-years",children:E.getYears().map(o=>t.jsx("button",{type:"button",className:`nice-calendar-year-btn ${o===$.getFullYear()?"nice-calendar-year-btn--selected":""}`,onClick:()=>{const i=new Date(o,$.getMonth(),1);A(i),E.goToDate(i),E.setView("month")},children:o},o))}),I&&E.view==="day"&&t.jsx("div",{className:"nice-calendar-footer",children:t.jsx("button",{type:"button",className:"nice-calendar-today-btn",onClick:ee,children:W})})]})})}),ir=e.forwardRef(function(r,s){return t.jsx(Je,{ref:s,selectionMode:"range",...r})}),ar=e.forwardRef(function(r,s){return t.jsx(Je,{ref:s,selectionMode:"multiple",...r})}),Ht=e.createContext(null);function lr(){const n=e.useContext(Ht);if(!n)throw new Error("useGesturesContext must be used within a NiceGestures");return n}function ye(n,r){const s=r.x-n.x,c=r.y-n.y;return Math.sqrt(s*s+c*c)}function ut(n,r){return Math.atan2(r.y-n.y,r.x-n.x)*(180/Math.PI)}function Fe(n,r){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}function Ve(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 At(n={}){const{enablePinch:r=!0,enableRotation:s=!0,enablePan:c=!0,enableSwipe:a=!0,enableTap:l=!0,enableDoubleTap:d=!0,enableLongPress:u=!0,minScale:b=.5,maxScale:k=4,panThreshold:p=5,swipeVelocityThreshold:w=.5,swipeDistanceThreshold:M=50,longPressDuration:f=500,doubleTapDelay:m=300,onPinchStart:x,onPinch:D,onPinchEnd:T,onRotateStart:N,onRotate:y,onRotateEnd:H,onPanStart:B,onPan:I,onPanEnd:W,onSwipe:L,onTap:g,onDoubleTap:j,onLongPress:O}=n,[U,E]=e.useState({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),$=e.useRef(new Map),A=e.useRef(0),Y=e.useRef(0),z=e.useRef(1),G=e.useRef(0),Q=e.useRef({x:0,y:0}),ee=e.useRef(0),P=e.useRef({x:0,y:0}),X=e.useRef(0),F=e.useRef({x:0,y:0}),K=e.useRef(0),v=e.useRef(null),C=e.useRef(!1),S=e.useRef(!1),o=e.useRef(!1),i=e.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null)},[]),h=e.useCallback(()=>{E({scale:1,rotation:0,translation:{x:0,y:0},velocity:{x:0,y:0},center:{x:0,y:0},isActive:!1}),z.current=1,G.current=0,Q.current={x:0,y:0}},[]),R=e.useCallback(re=>{re.currentTarget.setPointerCapture(re.pointerId),$.current.set(re.pointerId,{x:re.clientX,y:re.clientY});const ae=$.current.size;if(ae===1)X.current=Date.now(),F.current={x:re.clientX,y:re.clientY},P.current={x:re.clientX,y:re.clientY},ee.current=Date.now(),u&&(i(),v.current=setTimeout(()=>{O==null||O({position:{x:re.clientX,y:re.clientY},duration:f,target:re.target})},f));else if(ae===2){i();const[te,se]=Array.from($.current.values());A.current=ye(te,se),Y.current=ut(te,se),z.current=U.scale,G.current=U.rotation,r&&!S.current&&(S.current=!0,x==null||x()),s&&!o.current&&(o.current=!0,N==null||N())}E(te=>({...te,isActive:!0}))},[U.scale,U.rotation,u,r,s,f,O,x,N,i]),V=e.useCallback(re=>{if(!$.current.has(re.pointerId))return;$.current.set(re.pointerId,{x:re.clientX,y:re.clientY});const ae=$.current.size,te=Date.now();if(ae===1){const se={x:re.clientX,y:re.clientY},oe={x:se.x-P.current.x,y:se.y-P.current.y},_={x:se.x-F.current.x,y:se.y-F.current.y};if(ye(F.current,se)>p&&(i(),c)){C.current||(C.current=!0,B==null||B());const Z=te-ee.current,ce=Z>0?{x:oe.x/Z*1e3,y:oe.y/Z*1e3}:{x:0,y:0},le={x:Q.current.x+_.x,y:Q.current.y+_.y};E(ue=>({...ue,translation:le,velocity:ce,center:se})),I==null||I({translation:le,delta:oe,velocity:ce,center:se,direction:Ve(oe)})}P.current=se,ee.current=te}else if(ae===2){const[se,oe]=Array.from($.current.values()),_=ye(se,oe),J=ut(se,oe),Z=Fe(se,oe);if(r){const ce=Math.max(b,Math.min(k,z.current*(_/A.current))),le=ce-U.scale;E(ue=>({...ue,scale:ce,center:Z})),D==null||D({scale:ce,deltaScale:le,center:Z,distance:_,initialDistance:A.current})}if(s){let ce=J-Y.current;ce>180&&(ce-=360),ce<-180&&(ce+=360);const le=G.current+ce,ue=le-U.rotation;E(fe=>({...fe,rotation:le,center:Z})),y==null||y({rotation:le,deltaRotation:ue,center:Z})}}},[c,r,s,b,k,p,U.scale,U.rotation,I,B,D,y,i]),q=e.useCallback(re=>{re.currentTarget.releasePointerCapture(re.pointerId),i();const ae=$.current.size,te=Date.now();if(ae===1){const se={x:re.clientX,y:re.clientY},oe=ye(F.current,se),_=te-X.current;if(oe<p)d&&te-K.current<m?(j==null||j({position:se,target:re.target}),K.current=0):l&&(setTimeout(()=>{K.current===te&&(g==null||g({position:se,target:re.target}))},m),K.current=te);else{const J=oe/_*1e3;if(a&&J>w&&oe>M){const Z={x:se.x-F.current.x,y:se.y-F.current.y},ce=Ve(Z);ce&&(L==null||L({direction:ce,velocity:J,distance:oe,duration:_}))}if(C.current){const Z=te-ee.current,ce={x:se.x-P.current.x,y:se.y-P.current.y},le=Z>0?{x:ce.x/Z*1e3,y:ce.y/Z*1e3}:{x:0,y:0};W==null||W({translation:U.translation,delta:ce,velocity:le,center:se,direction:Ve(ce)})}}Q.current=U.translation}if(ae===2){if(S.current){const[se,oe]=Array.from($.current.values()),_=Fe(se,oe);T==null||T({scale:U.scale,deltaScale:0,center:_,distance:ye(se,oe),initialDistance:A.current})}if(o.current){const[se,oe]=Array.from($.current.values()),_=Fe(se,oe);H==null||H({rotation:U.rotation,deltaRotation:0,center:_})}}$.current.delete(re.pointerId),$.current.size===0&&(C.current=!1,S.current=!1,o.current=!1,E(se=>({...se,isActive:!1})))},[l,d,a,m,p,w,M,U.scale,U.rotation,U.translation,g,j,L,W,T,H,i]),ne=e.useCallback(re=>{i(),$.current.delete(re.pointerId),$.current.size===0&&(C.current=!1,S.current=!1,o.current=!1,E(ae=>({...ae,isActive:!1})))},[i]),ie=e.useCallback(()=>({onPointerDown:R,onPointerMove:V,onPointerUp:q,onPointerCancel:ne,style:{touchAction:"none"}}),[R,V,q,ne]);return e.useEffect(()=>()=>{i()},[i]),{bind:ie,state:U,reset:h}}const Le=e.forwardRef(function({enablePinch:r=!0,enableRotation:s=!0,enablePan:c=!0,enableSwipe:a=!0,enableTap:l=!0,enableDoubleTap:d=!0,enableLongPress:u=!0,minScale:b=.5,maxScale:k=4,applyTransform:p=!1,initialScale:w=1,scale:M,initialRotation:f=0,rotation:m,initialTranslation:x={x:0,y:0},translation:D,onTransformChange:T,onPinchStart:N,onPinch:y,onPinchEnd:H,onRotateStart:B,onRotate:I,onRotateEnd:W,onPanStart:L,onPan:g,onPanEnd:j,onSwipe:O,onTap:U,onDoubleTap:E,onLongPress:$,children:A,className:Y="",style:z,...G},Q){const ee=At({enablePinch:r,enableRotation:s,enablePan:c,enableSwipe:a,enableTap:l,enableDoubleTap:d,enableLongPress:u,minScale:b,maxScale:k,onPinchStart:N,onPinch:i=>{y==null||y(i),T==null||T(ee.state)},onPinchEnd:H,onRotateStart:B,onRotate:i=>{I==null||I(i),T==null||T(ee.state)},onRotateEnd:W,onPanStart:L,onPan:i=>{g==null||g(i),T==null||T(ee.state)},onPanEnd:j,onSwipe:O,onTap:U,onDoubleTap:E,onLongPress:$}),{bind:P,state:X}=ee,F=P(),K=M??X.scale,v=m??X.rotation,C=D??X.translation,S=p?{transform:`translate(${C.x}px, ${C.y}px) scale(${K}) rotate(${v}deg)`,transformOrigin:`${X.center.x}px ${X.center.y}px`}:{},o={state:{...X,scale:K,rotation:v,translation:C},reset:ee.reset};return t.jsx(Ht.Provider,{value:o,children:t.jsx("div",{ref:Q,className:`nice-gestures ${X.isActive?"nice-gestures--active":""} ${Y}`,style:{...F.style,...z,...S},onPointerDown:F.onPointerDown,onPointerMove:F.onPointerMove,onPointerUp:F.onPointerUp,onPointerCancel:F.onPointerCancel,...G,children:A})})}),or=e.forwardRef(function(r,s){return t.jsx(Le,{ref:s,enablePinch:!0,enableRotation:!1,enablePan:!1,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...r})}),ur=e.forwardRef(function(r,s){return t.jsx(Le,{ref:s,enablePinch:!1,enableRotation:!1,enablePan:!0,enableSwipe:!1,enableTap:!1,enableLongPress:!1,applyTransform:!0,...r})}),dr=e.forwardRef(function(r,s){return t.jsx(Le,{ref:s,enablePinch:!1,enableRotation:!1,enablePan:!1,enableSwipe:!0,enableTap:!1,enableLongPress:!1,...r})}),Qe={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},fr={light:.5,medium:1,heavy:1.5};function ge(){return typeof navigator<"u"&&"vibrate"in navigator}function hr(n,r){return typeof n=="number"?Math.round(n*r):n.map(s=>Math.round(s*r))}function vr(){return typeof window>"u"?!1:window.matchMedia("(prefers-reduced-motion: reduce)").matches}const Yt=e.createContext(null);function mr(){const n=e.useContext(Yt);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,a=e.useRef(r),[l,d]=e.useState(r),u=e.useMemo(()=>ge(),[]),b=e.useCallback(m=>{a.current=m,d(m)},[]),k=e.useCallback(()=>fr[s],[s]),p=e.useCallback((m=50)=>{if(!u||!a.current)return!1;try{const x=hr(m,k());return navigator.vibrate(x)}catch{return!1}},[u,k]),w=e.useCallback(()=>{u&&navigator.vibrate(0)},[u]),M=e.useCallback(m=>{if(!u||!a.current)return!1;const x=Qe[m];return x?p(x):!1},[u,p]),f=e.useCallback(m=>{if(!u||!a.current)return!1;const x=c[m];return x?p(x):!1},[u,c,p]);return{isSupported:u,isEnabled:l,setEnabled:b,vibrate:p,cancel:w,trigger:M,triggerPattern:f,getIntensityMultiplier:k}}function br({enabled:n=!0,intensity:r="medium",respectReducedMotion:s=!0,customPatterns:c={},children:a}){const l=e.useMemo(()=>s&&vr()?!1:n,[n,s]),d=xe({enabled:l,intensity:r,customPatterns:c});return e.useEffect(()=>{if(!s)return;const u=window.matchMedia("(prefers-reduced-motion: reduce)"),b=k=>{d.setEnabled(!k.matches&&n)};return u.addEventListener("change",b),()=>u.removeEventListener("change",b)},[s,n,d]),t.jsx(Yt.Provider,{value:d,children:a})}function xr(n=50){if(!ge())return!1;try{return navigator.vibrate(n)}catch{return!1}}function pr(n){if(!ge())return!1;const r=Qe[n];if(!r)return!1;try{return navigator.vibrate(r)}catch{return!1}}function gr(){ge()&&navigator.vibrate(0)}function yr(n){return function(s){const c=xe();return t.jsx(n,{...s,haptics:c})}}function wr(){const n=xe();return e.useCallback(()=>{n.trigger("button-press")},[n])}function kr(){const n=xe();return e.useCallback(r=>{n.trigger(r?"toggle-on":"toggle-off")},[n])}function jr(){const n=xe();return e.useCallback(()=>{n.trigger("selection")},[n])}function Nr(){const n=xe();return e.useCallback(r=>{n.trigger(`notification-${r}`)},[n])}function Mr(){const n=xe();return e.useCallback((r="medium")=>{n.trigger(`impact-${r}`)},[n])}class Ft{constructor(){tt(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 a=0;a<r;a++)this.vibrate(s),a<r-1&&this.pause(c);return this}rampUp(r,s){for(let c=1;c<=r;c++){const a=Math.round(s/r*c);this.vibrate(a),c<r&&this.pause(50)}return this}rampDown(r,s){for(let c=r;c>=1;c--){const a=Math.round(s/r*c);this.vibrate(a),c>1&&this.pause(50)}return this}build(){return[...this.pattern]}execute(){return ge()?navigator.vibrate(this.pattern):!1}}function Tr(){return new Ft}const Be={xs:0,sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Pe=["xs","sm","md","lg","xl","2xl"];function Oe(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 dt(n){return n==="xs"||n==="sm"?"mobile":n==="md"?"tablet":"desktop"}function ft(n,r){return n>=r?"landscape":"portrait"}function Ue(){return typeof window>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0}function me(n){return Pe.indexOf(n)}function Rr(n,r){let s=null;return(...c)=>{s&&clearTimeout(s),s=setTimeout(()=>n(...c),r)}}const Vt=e.createContext(null);function Cr(){const n=e.useContext(Vt);if(!n)throw new Error("useBreakpointContext must be used within a NiceBreakpointProvider");return n}function je(n={}){const{breakpoints:r,debounceDelay:s=100,ssrDefaultWidth:c=1024}=n,a=e.useMemo(()=>({...Be,...r}),[r]),[l,d]=e.useState(()=>{const f=typeof window<"u"?window.innerWidth:c,m=typeof window<"u"?window.innerHeight:768,x=Oe(f,a),D=dt(x),T=ft(f,m);return{width:f,height:m,breakpoint:x,deviceType:D,orientation:T,isMobile:D==="mobile",isTablet:D==="tablet",isDesktop:D==="desktop",isPortrait:T==="portrait",isLandscape:T==="landscape",isTouchDevice:Ue(),pixelRatio:typeof window<"u"?window.devicePixelRatio:1}});e.useEffect(()=>{if(typeof window>"u")return;const f=()=>{const x=window.innerWidth,D=window.innerHeight,T=Oe(x,a),N=dt(T),y=ft(x,D);d({width:x,height:D,breakpoint:T,deviceType:N,orientation:y,isMobile:N==="mobile",isTablet:N==="tablet",isDesktop:N==="desktop",isPortrait:y==="portrait",isLandscape:y==="landscape",isTouchDevice:Ue(),pixelRatio:window.devicePixelRatio})},m=Rr(f,s);return f(),window.addEventListener("resize",m),window.addEventListener("orientationchange",f),()=>{window.removeEventListener("resize",m),window.removeEventListener("orientationchange",f)}},[a,s]);const u=e.useCallback(f=>l.breakpoint===f,[l.breakpoint]),b=e.useCallback(f=>{const m=me(l.breakpoint),x=me(f);return m>=x},[l.breakpoint]),k=e.useCallback(f=>{const m=me(l.breakpoint),x=me(f);return m<x},[l.breakpoint]),p=e.useCallback((f,m)=>{const x=me(l.breakpoint),D=me(f),T=me(m);return x>=D&&x<=T},[l.breakpoint]),w=e.useCallback((f,m)=>{const x=me(l.breakpoint);for(let D=x;D>=0;D--){const T=Pe[D];if(f[T]!==void 0)return f[T]}return f.base??m},[l.breakpoint]),M=e.useCallback((f,m="min")=>{const x=a[f],D=me(f),T=Pe[D+1],N=T?a[T]-1:null;return m==="min"?`(min-width: ${x}px)`:m==="max"&&N?`(max-width: ${N}px)`:m==="only"?N?`(min-width: ${x}px) and (max-width: ${N}px)`:`(min-width: ${x}px)`:`(min-width: ${x}px)`},[a]);return{...l,is:u,isAbove:b,isBelow:k,isBetween:p,getResponsive:w,mediaQuery:M}}function zt(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 a=l=>s(l.matches);return c.addEventListener("change",a),()=>c.removeEventListener("change",a)},[n]),r}function Dr({breakpoints:n,debounceDelay:r=100,children:s}){const c=je({breakpoints:n,debounceDelay:r});return t.jsx(Vt.Provider,{value:c,children:s})}function Sr({on:n,above:r,below:s,device:c,orientation:a,children:l,fallback:d=null}){const u=je();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),a!==void 0&&(b=b&&u.orientation===a),b?t.jsx(t.Fragment,{children:l}):t.jsx(t.Fragment,{children:d})}function Pr({on:n,above:r,below:s,device:c,orientation:a,children:l}){const d=je();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),a!==void 0&&(u=u||d.orientation===a),u?null:t.jsx(t.Fragment,{children:l})}function $r(n,r="min",s=Be){const c=s[n],a=me(n),l=Pe[a+1],d=l?s[l]-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 Ir(n){return n}function Wt(n=Be){return typeof window>"u"?null:Oe(window.innerWidth,n)}function Er(){if(typeof window>"u")return!1;const n=Wt();return n==="xs"||n==="sm"}function Lr(){return Ue()}const Br={sm:"nice-touch-btn--sm",md:"nice-touch-btn--md",lg:"nice-touch-btn--lg",xl:"nice-touch-btn--xl"},Hr={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"},Ar={rounded:"nice-touch-btn--rounded",pill:"nice-touch-btn--pill",square:"nice-touch-btn--square",circle:"nice-touch-btn--circle"},Ze=e.forwardRef(function({variant:r="primary",size:s="md",shape:c="rounded",fullWidth:a=!1,loading:l=!1,leftIcon:d,rightIcon:u,iconOnly:b=!1,haptic:k=!0,hapticIntensity:p="light",ripple:w=!0,active:M=!1,disabled:f,className:m="",onClick:x,onPointerDown:D,children:T,...N},y){const[H,B]=e.useState(!1),[I,W]=e.useState(null),L=e.useRef(null),g=e.useCallback(Y=>{L.current=Y,typeof y=="function"?y(Y):y&&(y.current=Y)},[y]),j=e.useCallback(()=>{if(!k||typeof navigator>"u"||!("vibrate"in navigator))return;const Y={light:10,medium:20,heavy:40};try{navigator.vibrate(Y[p]||10)}catch{}},[k,p]),O=e.useCallback(Y=>{if(!(f||l)){if(B(!0),w&&L.current){const z=L.current.getBoundingClientRect();W({x:Y.clientX-z.left,y:Y.clientY-z.top}),setTimeout(()=>W(null),600)}j(),D==null||D(Y)}},[f,l,w,j,D]),U=e.useCallback(()=>{B(!1)},[]),E=e.useCallback(()=>{B(!1)},[]),$=e.useCallback(Y=>{f||l||x==null||x(Y)},[f,l,x]),A=["nice-touch-btn",Hr[r],Br[s],Ar[c],a?"nice-touch-btn--full-width":"",l?"nice-touch-btn--loading":"",b?"nice-touch-btn--icon-only":"",H?"nice-touch-btn--pressed":"",M?"nice-touch-btn--active":"",m].filter(Boolean).join(" ");return t.jsxs("button",{ref:g,type:"button",className:A,disabled:f||l,onClick:$,onPointerDown:O,onPointerUp:U,onPointerLeave:E,onPointerCancel:E,...N,children:[w&&I&&t.jsx("span",{className:"nice-touch-btn-ripple",style:{left:I.x,top:I.y}}),l&&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:l?0:1},children:[d&&t.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--left",children:d}),!b&&T&&t.jsx("span",{className:"nice-touch-btn-text",children:T}),u&&t.jsx("span",{className:"nice-touch-btn-icon nice-touch-btn-icon--right",children:u})]})]})}),Yr=e.forwardRef(function({icon:r,...s},c){return t.jsx(Ze,{ref:c,iconOnly:!0,leftIcon:r,...s})}),Fr=e.forwardRef(function({position:r="bottom-right",mini:s=!1,className:c="",...a},l){const d=`nice-fab--${r}`;return t.jsx(Ze,{ref:l,shape:"circle",size:s?"md":"xl",className:`nice-fab ${d} ${c}`,...a})});function Ot(n){const{min:r,max:s,step:c,value:a,defaultValue:l=r,onChange:d,onChangeCommitted:u}=n,[b,k]=e.useState(l),p=a??b,w=Array.isArray(p),M=e.useCallback(N=>Math.min(s,Math.max(r,N)),[r,s]),f=e.useCallback(N=>{const y=Math.round((N-r)/c)*c+r;return M(y)},[r,c,M]),m=e.useMemo(()=>{const N=s-r;if(w){const[y,H]=p;return[(y-r)/N*100,(H-r)/N*100]}return(p-r)/N*100},[p,r,s,w]),x=e.useCallback(N=>{if(Array.isArray(N)){const[y,H]=N,B=[f(y),f(H)];B[0]>B[1]&&([B[0],B[1]]=[B[1],B[0]]),k(B),d==null||d(B)}else{const y=f(N);k(y),d==null||d(y)}},[f,d]),D=e.useCallback((N,y)=>{const H=s-r,B=N/100*H+r;if(w&&typeof y=="number"){const W=[...p];W[y]=f(B),x(W)}else x(B)},[s,r,w,p,f,x]),T=e.useCallback(()=>{u==null||u(p)},[p,u]);return{value:p,isRange:w,percentage:m,setValue:x,setValueByPercentage:D,commitValue:T,clamp:M,snap:f}}const Vr=e.forwardRef(function({value:r,defaultValue:s,min:c=0,max:a=100,step:l=1,orientation:d="horizontal",disabled:u=!1,marks:b=!1,markStep:k,labelDisplay:p="auto",formatLabel:w=j=>String(j),showRange:M=!1,trackColor:f,fillColor:m,thumbSize:x=44,trackHeight:D=8,haptic:T=!0,snapToMarks:N=!1,onChange:y,onChangeCommitted:H,className:B="","aria-label":I,"aria-labelledby":W,...L},g){const j=Ot({min:c,max:a,step:l,value:r,defaultValue:s,onChange:y,onChangeCommitted:H}),O=e.useRef(null),[U,E]=e.useState(!1),[$,A]=e.useState(null),[Y,z]=e.useState(p==="on"),G=e.useRef(j.value),Q=e.useMemo(()=>{if(!b)return[];if(Array.isArray(b))return b;const i=[],h=k??l;for(let R=c;R<=a;R+=h)i.push({value:R});return i},[b,k,l,c,a]),ee=e.useCallback(i=>{if(!O.current)return 0;const h=O.current.getBoundingClientRect();if(d==="horizontal"){const R=i.clientX-h.left;return Math.max(0,Math.min(100,R/h.width*100))}else{const R=i.clientY-h.top;return Math.max(0,Math.min(100,100-R/h.height*100))}},[d]),P=e.useCallback(()=>{if(!(!T||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[T]),X=e.useCallback(i=>{if(!j.isRange)return 0;const[h,R]=j.percentage,V=Math.abs(i-h),q=Math.abs(i-R);return V<=q?0:1},[j.isRange,j.percentage]),F=e.useCallback((i,h)=>{if(u)return;i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId);const R=ee(i),V=h??X(R);if(E(!0),A(V),z(p!=="off"),N&&Q.length>0){const q=Q.reduce((ne,ie)=>{const re=(ne.value-c)/(a-c)*100,ae=(ie.value-c)/(a-c)*100;return Math.abs(ae-R)<Math.abs(re-R)?ie:ne});j.setValue(j.isRange?V===0?[q.value,j.value[1]]:[j.value[0],q.value]:q.value)}else j.setValueByPercentage(R,V);P()},[u,ee,X,p,N,Q,c,a,j,P]),K=e.useCallback(i=>{var R;if(!U||u||$===null)return;const h=ee(i);if(N&&Q.length>0){const V=Q.reduce((ne,ie)=>{const re=(ne.value-c)/(a-c)*100,ae=(ie.value-c)/(a-c)*100;return Math.abs(ae-h)<Math.abs(re-h)?ie:ne}),q=j.isRange?$===0?[V.value,j.value[1]]:[j.value[0],V.value]:V.value;JSON.stringify(q)!==JSON.stringify(G.current)&&(j.setValue(q),G.current=q,P())}else{j.setValueByPercentage(h,$);const V=j.isRange?j.value[$]:j.value,q=j.isRange?(R=G.current)==null?void 0:R[$]:G.current;Math.abs(V-q)>=l&&(P(),G.current=j.value)}},[U,u,$,ee,N,Q,c,a,j,l,P]),v=e.useCallback(i=>{U&&(i.currentTarget.releasePointerCapture(i.pointerId),E(!1),A(null),p==="auto"&&z(!1),j.commitValue())},[U,p,j]),C=e.useCallback((i,h)=>{if(u)return;let R=j.isRange?j.value[h]:j.value;switch(i.key){case"ArrowRight":case"ArrowUp":i.preventDefault(),R=Math.min(a,R+l);break;case"ArrowLeft":case"ArrowDown":i.preventDefault(),R=Math.max(c,R-l);break;case"Home":i.preventDefault(),R=c;break;case"End":i.preventDefault(),R=a;break;case"PageUp":i.preventDefault(),R=Math.min(a,R+l*10);break;case"PageDown":i.preventDefault(),R=Math.max(c,R-l*10);break;default:return}if(j.isRange){const V=j.value;j.setValue(h===0?[R,V[1]]:[V[0],R])}else j.setValue(R);P(),j.commitValue()},[u,j,a,c,l,P]),S=e.useMemo(()=>{if(j.isRange){const[h,R]=j.percentage;return d==="horizontal"?{left:`${h}%`,width:`${R-h}%`}:{bottom:`${h}%`,height:`${R-h}%`}}const i=j.percentage;return d==="horizontal"?{left:0,width:`${i}%`}:{bottom:0,height:`${i}%`}},[j.isRange,j.percentage,d]),o=(i,h)=>{const R=j.isRange?j.value[i]:j.value,V=d==="horizontal"?{left:`${h}%`}:{bottom:`${h}%`};return t.jsx("div",{className:`nice-touch-slider-thumb ${$===i?"nice-touch-slider-thumb--active":""}`,style:{...V,width:x,height:x},role:"slider",tabIndex:u?-1:0,"aria-label":I,"aria-labelledby":W,"aria-valuenow":R,"aria-valuemin":c,"aria-valuemax":a,"aria-disabled":u,onKeyDown:q=>C(q,i),children:Y&&t.jsx("span",{className:"nice-touch-slider-label",children:w(R)})},i)};return t.jsxs("div",{ref:g,className:`
21
21
  nice-touch-slider
22
22
  nice-touch-slider--${d}
23
23
  ${u?"nice-touch-slider--disabled":""}
24
- ${Y?"nice-touch-slider--dragging":""}
25
- ${A}
26
- `,style:{"--thumb-size":`${p}px`,"--track-height":`${C}px`,...f?{"--track-color":f}:{},...b?{"--fill-color":b}:{}},...L,children:[R&&t.jsx("span",{className:"nice-touch-slider-min",children:j(c)}),t.jsxs("div",{ref:S,className:"nice-touch-slider-track-container",onPointerDown:F,onPointerMove:X,onPointerUp:v,onPointerCancel:v,children:[t.jsx("div",{className:"nice-touch-slider-track"}),t.jsx("div",{className:"nice-touch-slider-fill",style:x}),Z.length>0&&t.jsx("div",{className:"nice-touch-slider-marks",children:Z.map(l=>{const k=(l.value-c)/(a-c)*100,$=d==="horizontal"?{left:`${k}%`}:{bottom:`${k}%`};return t.jsxs("div",{className:"nice-touch-slider-mark",style:$,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)})}),T.isRange?t.jsxs(t.Fragment,{children:[i(0,T.percentage[0]),i(1,T.percentage[1])]}):i(0,T.percentage)]}),R&&t.jsx("span",{className:"nice-touch-slider-max",children:j(a)})]})});function Be(n,r,s){r/=100,s/=100;const c=(1-Math.abs(2*s-1))*r,a=c*(1-Math.abs(n/60%2-1)),o=s-c/2;let d=0,u=0,m=0;return n>=0&&n<60?(d=c,u=a,m=0):n>=60&&n<120?(d=a,u=c,m=0):n>=120&&n<180?(d=0,u=c,m=a):n>=180&&n<240?(d=0,u=a,m=c):n>=240&&n<300?(d=a,u=0,m=c):(d=c,u=0,m=a),{r:Math.round((d+o)*255),g:Math.round((u+o)*255),b:Math.round((m+o)*255)}}function Ot(n,r,s){n/=255,r/=255,s/=255;const c=Math.max(n,r,s),a=Math.min(n,r,s),o=(c+a)/2;let d=0,u=0;if(c!==a){const m=c-a;switch(u=o>.5?m/(2-c-a):m/(c+a),c){case n:d=((r-s)/m+(r<s?6:0))*60;break;case r:d=((s-n)/m+2)*60;break;case s:d=((n-r)/m+4)*60;break}}return{h:Math.round(d),s:Math.round(u*100),l:Math.round(o*100)}}function Ut(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 Xt(n,r,s){return"#"+[n,r,s].map(c=>c.toString(16).padStart(2,"0")).join("")}function ye(n){const r=Ut(n);return Ot(r.r,r.g,r.b)}function Pe(n,r,s){const c=Be(n,r,s);return Xt(c.r,c.g,c.b)}function Ue(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 Vr=e.forwardRef(function({value:r,defaultValue:s="var(--nice-color-accent, #6366f1)",format:c="hex",showAlpha:a=!1,showPreview:o=!0,showInput:d=!0,presetColors:u,wheelSize:m=240,haptic:N=!0,onChange:y,presetLabel:j="Presets",className:R="",...f},b){const[p,C]=e.useState(()=>ye(r||s)),[D,M]=e.useState(r||s),[w,H]=e.useState(1),A=e.useRef(null),E=e.useRef(null),W=e.useRef(!1),L=e.useRef(!1);e.useEffect(()=>{if(r){const v=ye(r);C(v),M(r)}},[r]);const g=e.useCallback(()=>{if(!(!N||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[N]),T=e.useCallback(v=>{const h=Ue(v,c);M(c==="hex"?h:Pe(v.h,v.s,v.l)),y==null||y(h)},[c,y]);e.useEffect(()=>{const v=A.current;if(!v)return;const h=v.getContext("2d");if(!h)return;const x=m,i=x/2,l=i-10,k=l-30;v.width=x,v.height=x;for(let $=0;$<360;$++){const q=($-1)*Math.PI/180,_=($+1)*Math.PI/180;h.beginPath(),h.arc(i,i,l,q,_),h.arc(i,i,k,_,q,!0),h.closePath(),h.fillStyle=`hsl(${$}, 100%, 50%)`,h.fill()}},[m]),e.useEffect(()=>{const v=E.current;if(!v)return;const h=v.getContext("2d");if(!h)return;const x=m*.5;v.width=x,v.height=x;const i=h.createImageData(x,x);for(let l=0;l<x;l++)for(let k=0;k<x;k++){const $=k/x*100,q=100-l/x*100,_=Be(p.h,$,q),re=(l*x+k)*4;i.data[re]=_.r,i.data[re+1]=_.g,i.data[re+2]=_.b,i.data[re+3]=255}h.putImageData(i,0,0)},[p.h,m]);const S=e.useCallback(v=>{const h=A.current;if(!h)return;const x=h.getBoundingClientRect(),i=v.clientX-x.left-x.width/2,l=v.clientY-x.top-x.height/2;let k=Math.atan2(l,i)*(180/Math.PI)+90;k<0&&(k+=360);const $={...p,h:Math.round(k)};C($),T($),g()},[p,T,g]),Y=e.useCallback(v=>{const h=E.current;if(!h)return;const x=h.getBoundingClientRect(),i=Math.max(0,Math.min(x.width,v.clientX-x.left)),l=Math.max(0,Math.min(x.height,v.clientY-x.top)),k=Math.round(i/x.width*100),$=Math.round(100-l/x.height*100),q={...p,s:k,l:$};C(q),T(q),g()},[p,T,g]),P=e.useCallback(v=>{v.currentTarget.setPointerCapture(v.pointerId),W.current=!0,S(v)},[S]),B=e.useCallback(v=>{W.current&&S(v)},[S]),Q=e.useCallback(v=>{v.currentTarget.releasePointerCapture(v.pointerId),W.current=!1},[]),U=e.useCallback(v=>{v.currentTarget.setPointerCapture(v.pointerId),L.current=!0,Y(v)},[Y]),O=e.useCallback(v=>{L.current&&Y(v)},[Y]),K=e.useCallback(v=>{v.currentTarget.releasePointerCapture(v.pointerId),L.current=!1},[]),Z=e.useCallback(v=>{const h=v.target.value;if(M(h),/^#?[0-9a-f]{6}$/i.test(h)){const x=h.startsWith("#")?h:`#${h}`,i=ye(x);C(i),y==null||y(Ue(i,c))}},[c,y]),ee=e.useCallback(v=>{const h=ye(v);C(h),T(h),g()},[T,g]),I=e.useMemo(()=>{const v=m/2,h=v-25,x=(p.h-90)*Math.PI/180;return{x:v+h*Math.cos(x),y:v+h*Math.sin(x)}},[p.h,m]),V=m*.5,F=e.useMemo(()=>({x:p.s/100*V,y:(1-p.l/100)*V}),[p.s,p.l,V]),X=e.useMemo(()=>Pe(p.h,p.s,p.l),[p]);return t.jsxs("div",{ref:b,className:`nice-touch-color-picker ${R}`,...f,children:[t.jsxs("div",{className:"nice-touch-color-picker-wheel-container",style:{width:m,height:m},children:[t.jsx("canvas",{ref:A,className:"nice-touch-color-picker-wheel",onPointerDown:P,onPointerMove:B,onPointerUp:Q,onPointerCancel:Q}),t.jsx("div",{className:"nice-touch-color-picker-hue-indicator",style:{left:I.x,top:I.y,backgroundColor:`hsl(${p.h}, 100%, 50%)`}}),t.jsxs("div",{className:"nice-touch-color-picker-sl-container",style:{width:V,height:V},children:[t.jsx("canvas",{ref:E,className:"nice-touch-color-picker-sl",onPointerDown:U,onPointerMove:O,onPointerUp:K,onPointerCancel:K}),t.jsx("div",{className:"nice-touch-color-picker-sl-indicator",style:{left:F.x,top:F.y,backgroundColor:X}})]})]}),t.jsxs("div",{className:"nice-touch-color-picker-controls",children:[o&&t.jsx("div",{className:"nice-touch-color-picker-preview",style:{backgroundColor:X}}),d&&t.jsx("input",{type:"text",className:"nice-touch-color-picker-input",value:D,onChange:Z,placeholder:"var(--nice-text, #000000)"})]}),a&&t.jsx("div",{className:"nice-touch-color-picker-alpha",children:t.jsx("input",{type:"range",min:"0",max:"100",value:w*100,onChange:v=>H(Number(v.target.value)/100),className:"nice-touch-color-picker-alpha-slider",style:{background:`linear-gradient(to right, transparent, ${X})`}})}),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((v,h)=>t.jsx("button",{type:"button",className:`nice-touch-color-picker-preset ${v.toLowerCase()===X.toLowerCase()?"nice-touch-color-picker-preset--selected":""}`,style:{backgroundColor:v},onClick:()=>ee(v),"aria-label":`Select color ${v}`},h))})]})]})}),zr={hslToRgb:Be,rgbToHsl:Ot,hexToRgb:Ut,rgbToHex:Xt,hexToHsl:ye,hslToHex:Pe,formatColor:Ue};function Wr(n,r){return Math.sqrt(Math.pow(r.x-n.x,2)+Math.pow(r.y-n.y,2))}function ft(n,r){const s=r.time-n.time||1;return Wr(n,r)/s}const _t=e.forwardRef(function({width:r="100%",height:s=200,strokeColor:c="var(--nice-text-primary, #1f2937)",strokeWidth:a=2,minWidth:o=.5,maxWidth:d=4,velocityFilterWeight:u=.7,backgroundColor:m="var(--nice-bg-primary, #ffffff)",showGuideline:N=!0,guidelineColor:y="var(--nice-border-color, #e5e7eb)",disabled:j=!1,penPressure:R=!0,haptic:f=!0,placeholder:b="Sign here",onChange:p,onBegin:C,onEnd:D,className:M="",...w},H){const A=e.useRef(null),E=e.useRef(null),[W,L]=e.useState(!0),[g,T]=e.useState(!1),S=e.useRef([]),Y=e.useRef([]),P=e.useRef([]),B=e.useRef(0),Q=e.useRef(a);e.useEffect(()=>{const h=A.current;if(!h)return;const x=h.getBoundingClientRect(),i=window.devicePixelRatio||1;h.width=x.width*i,h.height=x.height*i;const l=h.getContext("2d");l&&(l.scale(i,i),E.current=l,O())},[]);const U=e.useCallback(()=>{if(!(!f||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[f]),O=e.useCallback(()=>{const h=A.current,x=E.current;if(!h||!x)return;const i=h.getBoundingClientRect();x.fillStyle=m,x.fillRect(0,0,i.width,i.height),N&&(x.strokeStyle=y,x.lineWidth=1,x.setLineDash([5,5]),x.beginPath(),x.moveTo(20,i.height*.7),x.lineTo(i.width-20,i.height*.7),x.stroke(),x.setLineDash([]))},[m,N,y]),K=e.useCallback(()=>{O();const h=E.current;h&&Y.current.forEach(x=>{if(!(x.length<2)){h.strokeStyle=c,h.fillStyle=c,h.lineCap="round",h.lineJoin="round";for(let i=1;i<x.length;i++){const l=x[i-1],k=x[i],$=ft(l,k),q=Math.max(o,Math.min(d,d/($+1)));h.lineWidth=q,h.beginPath(),h.moveTo(l.x,l.y),h.lineTo(k.x,k.y),h.stroke()}}})},[O,c,o,d]),Z=e.useCallback(h=>Math.max(o,d/(h*10+1)),[o,d]),ee=e.useCallback(h=>{const x=E.current;x&&(x.fillStyle=c,x.beginPath(),x.arc(h.x,h.y,a/2,0,Math.PI*2),x.fill())},[c,a]),I=e.useCallback((h,x,i)=>{const l=E.current;l&&(l.strokeStyle=c,l.lineWidth=i,l.lineCap="round",l.lineJoin="round",l.beginPath(),l.moveTo(h.x,h.y),l.lineTo(x.x,x.y),l.stroke())},[c]),V=e.useCallback(h=>{const x=A.current;if(!x)return{x:0,y:0,time:Date.now()};const i=x.getBoundingClientRect();return{x:h.clientX-i.left,y:h.clientY-i.top,pressure:R?h.pressure:void 0,time:Date.now()}},[R]),F=e.useCallback(h=>{if(j)return;h.preventDefault(),h.currentTarget.setPointerCapture(h.pointerId),T(!0);const x=V(h);S.current=[x],B.current=0,Q.current=a,P.current=[],ee(x),C==null||C(),U()},[j,V,a,ee,C,U]),X=e.useCallback(h=>{if(!g||j)return;const x=V(h),i=S.current;if(i.length===0)return;const l=i[i.length-1],k=ft(l,x),$=u*k+(1-u)*B.current,q=Z($),_=(Q.current+q)/2,re=x.pressure!==void 0?_*Math.max(.5,x.pressure):_;I(l,x,re),i.push(x),B.current=$,Q.current=q},[g,j,V,u,Z,I]),v=e.useCallback(h=>{g&&(h.currentTarget.releasePointerCapture(h.pointerId),T(!1),S.current.length>0&&(Y.current.push([...S.current]),S.current=[],L(!1),p==null||p(!1)),D==null||D())},[g,p,D]);return e.useImperativeHandle(H,()=>({clear:()=>{Y.current=[],P.current=[],S.current=[],O(),L(!0),p==null||p(!0)},isEmpty:()=>W,toData:()=>[...Y.current],fromData:h=>{Y.current=h,P.current=[],L(h.length===0),K(),p==null||p(h.length===0)},toDataURL:(h="png",x=1)=>{const i=A.current;if(!i)return"";if(h==="svg"){const k=i.getBoundingClientRect();let $="";Y.current.forEach(_=>{if(_.length<2)return;let re=`M ${_[0].x} ${_[0].y}`;for(let ie=1;ie<_.length;ie++)re+=` L ${_[ie].x} ${_[ie].y}`;$+=`<path d="${re}" stroke="${c}" stroke-width="${a}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`});const q=`<svg xmlns="http://www.w3.org/2000/svg" width="${k.width}" height="${k.height}" viewBox="0 0 ${k.width} ${k.height}">${$}</svg>`;return`data:image/svg+xml;base64,${btoa(q)}`}if(h==="json")return`data:application/json;base64,${btoa(JSON.stringify(Y.current))}`;const l=h==="jpeg"?"image/jpeg":"image/png";return i.toDataURL(l,x)},toSVG:()=>{const h=A.current;if(!h)return"";const x=h.getBoundingClientRect();let i="";return Y.current.forEach(l=>{if(l.length<2)return;let k=`M ${l[0].x} ${l[0].y}`;for(let $=1;$<l.length;$++)k+=` L ${l[$].x} ${l[$].y}`;i+=`<path d="${k}" stroke="${c}" stroke-width="${a}" 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}">${i}</svg>`},toBlob:(h="png",x=1)=>new Promise(i=>{const l=A.current;if(!l){i(null);return}const k=h==="jpeg"?"image/jpeg":"image/png";l.toBlob(i,k,x)}),undo:()=>{if(Y.current.length===0)return;const h=Y.current.pop();h&&P.current.push(h);const x=Y.current.length===0;L(x),K(),p==null||p(x)},redo:()=>{if(P.current.length===0)return;const h=P.current.pop();h&&Y.current.push(h),L(!1),K(),p==null||p(!1)}}),[W,O,K,c,a,p]),t.jsxs("div",{className:`nice-signature-pad ${j?"nice-signature-pad--disabled":""} ${M}`,...w,children:[t.jsx("canvas",{ref:A,className:"nice-signature-pad-canvas",style:{width:r,height:s,backgroundColor:m,touchAction:"none"},onPointerDown:F,onPointerMove:X,onPointerUp:v,onPointerCancel:v,onPointerLeave:v}),W&&b&&t.jsx("div",{className:"nice-signature-pad-placeholder",children:b})]})}),Or=e.forwardRef(function({width:r="100%",height:s=300,backgroundColor:c="var(--nice-bg-primary, #ffffff)",strokeColor:a="var(--nice-text-primary, #1f2937)",strokeWidth:o=4,tool:d="pen",lineCap:u="round",opacity:m=1,penPressure:N=!0,haptic:y=!0,maxHistory:j=50,disabled:R=!1,onChange:f,onToolChange:b,className:p="",...C},D){const M=e.useRef(null),w=e.useRef(null),[H,A]=e.useState(!1),[E,W]=e.useState(d),L=e.useRef([]),g=e.useRef(-1),T=e.useRef(null),S=e.useRef(null),Y=e.useRef(null);e.useEffect(()=>{W(d)},[d]),e.useEffect(()=>{const v=M.current;if(!v)return;const h=v.getBoundingClientRect(),x=window.devicePixelRatio||1;v.width=h.width*x,v.height=h.height*x;const i=v.getContext("2d",{willReadFrequently:!0});i&&(i.scale(x,x),w.current=i,i.fillStyle=c,i.fillRect(0,0,h.width,h.height),P())},[c]);const P=e.useCallback(()=>{const v=M.current,h=w.current;if(!v||!h)return;const x=v.getBoundingClientRect(),i=h.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:i}),L.current.length>j&&L.current.shift(),g.current=L.current.length-1},[j]),B=e.useCallback(v=>{const h=w.current;if(!h||v<0||v>=L.current.length)return;const x=L.current[v];h.putImageData(x.imageData,0,0)},[]),Q=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[y]),U=e.useCallback(v=>{const h=M.current;if(!h)return{x:0,y:0};const x=h.getBoundingClientRect();return{x:v.clientX-x.left,y:v.clientY-x.top,pressure:N?v.pressure:void 0}},[N]),O=e.useCallback(()=>{const v=w.current;v&&(v.lineCap=u,v.lineJoin="round",v.globalAlpha=m,E==="eraser"?(v.globalCompositeOperation="destination-out",v.strokeStyle="var(--nice-overlay-90, rgba(0, 0, 0, 1))",v.lineWidth=o*2):E==="brush"?(v.globalCompositeOperation="source-over",v.strokeStyle=a,v.lineWidth=o):E==="marker"?(v.globalCompositeOperation="multiply",v.strokeStyle=a,v.lineWidth=o*1.5,v.globalAlpha=.5):(v.globalCompositeOperation="source-over",v.strokeStyle=a,v.lineWidth=o))},[E,a,o,u,m]),K=e.useCallback((v,h)=>{const x=w.current;x&&(O(),h.pressure!==void 0&&E!=="eraser"&&(x.lineWidth=o*Math.max(.3,h.pressure)),x.beginPath(),x.moveTo(v.x,v.y),x.lineTo(h.x,h.y),x.stroke())},[O,o,E]),Z=e.useCallback((v,h)=>{const x=w.current;if(!x||!Y.current)return;x.putImageData(Y.current,0,0),O();const i=h.x-v.x,l=h.y-v.y;if(x.beginPath(),E==="line")x.moveTo(v.x,v.y),x.lineTo(h.x,h.y),x.stroke();else if(E==="rectangle")x.strokeRect(v.x,v.y,i,l);else if(E==="circle"){const k=Math.sqrt(i*i+l*l);x.arc(v.x,v.y,k,0,Math.PI*2),x.stroke()}},[O,E]),ee=e.useCallback((v,h,x)=>{const i=M.current,l=w.current;if(!i||!l)return;const k=i.getBoundingClientRect(),$=l.getImageData(0,0,k.width,k.height),q=$.data,_=document.createElement("div");_.style.color=x,document.body.appendChild(_);const re=getComputedStyle(_).color;document.body.removeChild(_);const ie=re.match(/\d+/g);if(!ie)return;const[se,oe,ne]=ie.map(Number),te=(Math.floor(h)*k.width+Math.floor(v))*4,ae=q[te],z=q[te+1],G=q[te+2],J=q[te+3];if(ae===se&&z===oe&&G===ne)return;const ce=[[Math.floor(v),Math.floor(h)]],le=new Set;for(;ce.length>0;){const[ue,fe]=ce.pop(),he=(fe*k.width+ue)*4;if(ue<0||ue>=k.width||fe<0||fe>=k.height||le.has(he))continue;const Ae=q[he],Jt=q[he+1],Qt=q[he+2],Zt=q[he+3],je=30;Math.abs(Ae-ae)>je||Math.abs(Jt-z)>je||Math.abs(Qt-G)>je||Math.abs(Zt-J)>je||(le.add(he),q[he]=se,q[he+1]=oe,q[he+2]=ne,q[he+3]=255,ce.push([ue+1,fe],[ue-1,fe],[ue,fe+1],[ue,fe-1]))}l.putImageData($,0,0)},[]),I=e.useCallback(v=>{if(R)return;v.preventDefault(),v.currentTarget.setPointerCapture(v.pointerId);const h=U(v);if(E==="fill"){ee(h.x,h.y,a),P(),f==null||f(),Q();return}if(A(!0),T.current=h,S.current=h,E==="line"||E==="rectangle"||E==="circle"){const x=M.current,i=w.current;if(x&&i){const l=x.getBoundingClientRect();Y.current=i.getImageData(0,0,l.width,l.height)}}else{const x=w.current;x&&(O(),x.beginPath(),x.arc(h.x,h.y,o/2,0,Math.PI*2),x.fill())}Q()},[R,U,E,ee,a,P,f,Q,O,o]),V=e.useCallback(v=>{if(!H||R)return;const h=U(v);E==="line"||E==="rectangle"||E==="circle"?T.current&&Z(T.current,h):S.current&&K(S.current,h),S.current=h},[H,R,U,E,Z,K]),F=e.useCallback(v=>{H&&(v.currentTarget.releasePointerCapture(v.pointerId),A(!1),(E==="line"||E==="rectangle"||E==="circle")&&T.current&&S.current&&Z(T.current,S.current),Y.current=null,T.current=null,S.current=null,P(),f==null||f())},[H,E,Z,P,f]);e.useImperativeHandle(D,()=>({clear:()=>{const v=M.current,h=w.current;if(!v||!h)return;const x=v.getBoundingClientRect();h.fillStyle=c,h.globalCompositeOperation="source-over",h.fillRect(0,0,x.width,x.height),P(),f==null||f()},undo:()=>{g.current>0&&(g.current--,B(g.current),f==null||f())},redo:()=>{g.current<L.current.length-1&&(g.current++,B(g.current),f==null||f())},canUndo:()=>g.current>0,canRedo:()=>g.current<L.current.length-1,toDataURL:(v="png",h=1)=>{const x=M.current;if(!x)return"";const i=v==="jpeg"?"image/jpeg":"image/png";return x.toDataURL(i,h)},toBlob:(v="png",h=1)=>new Promise(x=>{const i=M.current;if(!i){x(null);return}const l=v==="jpeg"?"image/jpeg":"image/png";i.toBlob(x,l,h)}),fromDataURL:async v=>{const h=M.current,x=w.current;if(!(!h||!x))return new Promise(i=>{const l=new Image;l.onload=()=>{const k=h.getBoundingClientRect();x.drawImage(l,0,0,k.width,k.height),P(),i()},l.src=v})},fill:v=>{const h=M.current,x=w.current;if(!h||!x)return;const i=h.getBoundingClientRect();x.fillStyle=v,x.globalCompositeOperation="source-over",x.fillRect(0,0,i.width,i.height),P(),f==null||f()},getTool:()=>E,setTool:v=>{W(v),b==null||b(v)}}),[c,P,B,E,b,f]);const X=()=>{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}`,...C,children:t.jsx("canvas",{ref:M,className:"nice-touch-drawing-canvas",style:{width:r,height:s,cursor:X(),touchAction:"none"},onPointerDown:I,onPointerMove:V,onPointerUp:F,onPointerCancel:F,onPointerLeave:F})})}),Ur=["var(--nice-text-primary, #1f2937)","var(--nice-color-error, #ef4444)","var(--nice-warning, #f97316)","var(--nice-color-warning, #eab308)","var(--nice-color-success, #22c55e)","var(--nice-color-primary, #3b82f6)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-bg-primary, #ffffff)","var(--nice-text-primary, #000000)"],Xr={pen:"✏️",brush:"🖌️",marker:"🖍️",eraser:"🧹",fill:"🪣",line:"📏",rectangle:"⬜",circle:"⭕"};function Ve(n,r,s){const[c,a]=e.useState(r),o=n!==void 0;return[o?n:c,u=>{o||a(u),s==null||s(u)}]}const _r=e.forwardRef(function({tool:r,defaultTool:s="pen",onToolChange:c,color:a,defaultColor:o,onColorChange:d,strokeWidth:u,defaultStrokeWidth:m=4,onStrokeWidthChange:N,onUndo:y,onRedo:j,onClear:R,canUndo:f=!0,canRedo:b=!0,colors:p=Ur,className:C="",...D},M){const[w,H]=Ve(r,s,c),[A,E]=Ve(a,o??p[0],d),[W,L]=Ve(u,m,N),g=["pen","brush","marker","eraser","fill","line","rectangle","circle"];return t.jsxs("div",{ref:M,className:`nice-drawing-toolbar ${C}`,...D,children:[t.jsx("div",{className:"nice-drawing-toolbar-section",children:g.map(T=>t.jsx("button",{type:"button",className:`nice-drawing-tool-btn ${w===T?"active":""}`,onClick:()=>H(T),title:T,children:Xr[T]},T))}),t.jsx("div",{className:"nice-drawing-toolbar-divider"}),t.jsx("div",{className:"nice-drawing-toolbar-section nice-drawing-colors",children:p.map((T,S)=>t.jsx("button",{type:"button",className:`nice-drawing-color-btn ${A===T?"active":""}`,style:{backgroundColor:T,borderColor:T==="var(--nice-bg-primary, #ffffff)"?"var(--nice-border-color, #e5e7eb)":T},onClick:()=>E(T),title:T},S))}),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:[W,"px"]}),t.jsx("input",{type:"range",min:1,max:50,value:W,onChange:T=>L(Number(T.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:[y&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:y,disabled:!f,title:"Undo",children:"↩️"}),j&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:j,disabled:!b,title:"Redo",children:"↪️"}),R&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn danger",onClick:R,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},qr={value:"CapsLock",label:"⇪",type:"caps",width:1.75},Gr={value:"Tab",label:"⇥",type:"tab",width:1.5},ze=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"0"},{value:"-"},{value:"="}],Kr=[{value:"!"},{value:"@"},{value:"#"},{value:"$"},{value:"%"},{value:"^"},{value:"&"},{value:"*"},{value:"("},{value:")"}],Jr=[{value:"-"},{value:"_"},{value:"="},{value:"+"},{value:"["},{value:"]"},{value:"{"},{value:"}"},me],Qr=[{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"}],Xe=[[{value:"1"},{value:"2"},{value:"3"}],[{value:"4"},{value:"5"},{value:"6"}],[{value:"7"},{value:"8"},{value:"9"}],[{value:".",width:1},{value:"0"},me]],Zr=[[{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}]],es=[[{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]],ts=[[{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 ns(n,r,s,c,a){const o=$e[n]||$e.en,[d,u,m]=o.rows;if(r==="minimal")return Xe;if(s){const j=[ze.slice(0,10),Kr,Jr],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,...a?{label:a}:{}}),j.push(R),j}if(r==="compact"){const j=[d.map(f=>({value:f})),u.map(f=>({value:f})),[De,...m.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,...a?{label:a}:{}}),j.push(R),j}if(r==="standard"){const j=[ze.slice(0,10),d.map(f=>({value:f})),u.map(f=>({value:f})),[De,...m.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,...a?{label:a}:{}}),j.push(R),j}const N=[Qr,[...ze,me],[Gr,...d.map(j=>({value:j}))],[qr,...u.map(j=>({value:j})),{...Te,width:1.75,...a?{label:a}:{}}],[{...De,width:2.25},...m.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(b=>b.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:a,activeLanguage:o,onLanguageChange:d,value:u="",maxLength:m,theme:N="system",haptic:y=!0,sound:j=!1,onKeyPress:R,onChange:f,onSubmit:b,disabled:p=!1,showPreview:C=!1,previewPlaceholder:D="Type here...",masked:M=!1,showLanguageSwitcher:w,enterLabel:H,className:A="",...E},W){const L=e.useMemo(()=>a&&a.length>0?a:["en"],[a]),[g,T]=e.useState(L[0]),S=o??g,[Y,P]=e.useState(!1),[B,Q]=e.useState(!1),[U,O]=e.useState(!1),K=w??L.length>1,Z=e.useMemo(()=>r==="custom"&&s?s.rows:r!=="qwerty"?{numeric:Xe,numpad:Zr,phone:es,pin:ts}[r]||Xe:ns(S,c,U,K,H),[r,s,S,c,U,K,H]),ee=e.useCallback(()=>{const i=L.indexOf(S),l=L[(i+1)%L.length];T(l),d==null||d(l)},[L,S,d]),I=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[y]),V=e.useCallback(()=>{if(j)try{const i=new(window.AudioContext||window.webkitAudioContext),l=i.createOscillator(),k=i.createGain();l.connect(k),k.connect(i.destination),l.frequency.value=1e3,l.type="sine",k.gain.value=.1,l.start(),l.stop(i.currentTime+.05)}catch{}},[j]),F=e.useCallback(i=>{if(p)return;I(),V();let l=u;switch(i.type){case"backspace":l=u.slice(0,-1);break;case"enter":b==null||b(u);return;case"shift":P(k=>!k);return;case"caps":Q(k=>!k);return;case"tab":l=u+" ";break;case"lang":ee();return;case"fn":if(i.value==="123"||i.value==="ABC"||i.value==="#+="||i.value==="#+=")O(k=>!k);else if(i.value==="Clear"||i.value==="C")l="";else{R==null||R(i.value);return}return;case"space":l=u+" ";break;default:{let k=i.value;(Y||B)&&k.length===1&&(k=k.toUpperCase()),l=u+k,Y&&!B&&P(!1)}}m&&l.length>m||(R==null||R(i.value),f==null||f(l))},[p,u,m,Y,B,I,V,R,f,b,ee]),X=e.useMemo(()=>M?"•".repeat(u.length):u,[u,M]),v=Y||B,h=N==="system"?"":`nice-touch-keyboard--${N}`,x=$e[S];return t.jsxs("div",{ref:W,className:["nice-touch-keyboard",`nice-touch-keyboard--${c}`,h,p?"nice-touch-keyboard--disabled":"",A].filter(Boolean).join(" "),"data-layout":r,"data-language":S,dir:S==="ar"||S==="he"?"rtl":void 0,...E,children:[K&&L.length>1&&t.jsx("div",{className:"nice-touch-keyboard-langbar",children:L.map(i=>{const l=$e[i];return t.jsx("button",{type:"button",className:`nice-touch-keyboard-langbar__btn ${i===S?"active":""}`,onClick:()=>{T(i),d==null||d(i)},disabled:p,children:(l==null?void 0:l.nativeName)??i.toUpperCase()},i)})}),C&&t.jsxs("div",{className:"nice-touch-keyboard-preview",children:[X||t.jsx("span",{className:"nice-touch-keyboard-placeholder",children:D}),t.jsx("span",{className:"nice-touch-keyboard-cursor"})]}),t.jsx("div",{className:"nice-touch-keyboard-keys",children:Z.map((i,l)=>t.jsx("div",{className:"nice-touch-keyboard-row",children:i.map((k,$)=>{var ie;const q=k.type==="shift"&&Y||k.type==="caps"&&B||k.type==="lang"||k.value==="123"&&U||k.value==="ABC"&&!U||k.value==="#+="&&U;let _=k.label||k.value;v&&!k.type&&_.length===1&&(_=_.toUpperCase());const re=!k.type&&k.value.length===1&&((ie=x==null?void 0:x.accents)==null?void 0:ie[k.value.toLowerCase()]);return t.jsx("button",{type:"button",className:["nice-touch-keyboard-key",`nice-touch-keyboard-key--${k.type||"char"}`,q?"active":"",re?"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||_},$)})},l))}),t.jsxs("div",{className:"nice-touch-keyboard-status",children:[B&&t.jsx("span",{className:"nice-touch-keyboard-status__item",children:"CAPS"}),x&&t.jsx("span",{className:"nice-touch-keyboard-status__item",children:x.nativeName})]})]})}),rs=e.forwardRef(function(r,s){return t.jsx(He,{ref:s,layout:"pin",masked:!0,maxLength:r.maxLength||6,...r})}),ss=e.forwardRef(function(r,s){return t.jsx(He,{ref:s,layout:"numpad",...r})}),cs=e.forwardRef(function(r,s){return t.jsx(He,{ref:s,layout:"phone",...r})}),qt=e.createContext(null);function is(n,r=500){const s=e.useRef(void 0),c=e.useRef(null),a=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 m=Math.abs(u.clientX-c.current.x),N=Math.abs(u.clientY-c.current.y);(m>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:a,onPointerMove:o,onPointerUp:d,onPointerCancel:d,onPointerLeave:d}}const ht=({item:n,onSelect:r})=>{const s=e.useContext(qt),c=e.useRef(null),[a,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]),m=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":m?"menu":void 0,"aria-expanded":m?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}),m&&t.jsx("span",{className:"nice-touch-menu-item-arrow",children:"›"})]}),n.divider&&t.jsx("div",{className:"nice-touch-menu-divider",role:"separator"})]})},Gt=e.forwardRef(function({items:r,open:s,position:c,onClose:a,haptic:o=!0,className:d="",...u},m){var H;const N=e.useRef(null),[y,j]=e.useState(null),[R,f]=e.useState(null),[b,p]=e.useState(c);e.useEffect(()=>{if(!s||!N.current)return;const E=N.current.getBoundingClientRect(),W={width:window.innerWidth,height:window.innerHeight};let L=c.x,g=c.y;L+E.width>W.width-8&&(L=W.width-E.width-8),L<8&&(L=8),g+E.height>W.height-8&&(g=W.height-E.height-8),g<8&&(g=8),p({x:L,y:g})},[s,c]),e.useEffect(()=>{if(!s)return;const A=W=>{N.current&&!N.current.contains(W.target)&&a()},E=W=>{W.key==="Escape"&&a()};return document.addEventListener("mousedown",A),document.addEventListener("keydown",E),()=>{document.removeEventListener("mousedown",A),document.removeEventListener("keydown",E)}},[s,a]);const C=e.useCallback(()=>{if(!(!o||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[o]),D=e.useCallback(A=>{C(),a()},[C,a]),M={close:a,openSubmenu:(A,E)=>{j(A),f(E)},closeSubmenu:()=>{j(null),f(null)},activeSubmenu:y};if(!s)return null;const w=y?(H=r.find(A=>A.id===y))==null?void 0:H.children:null;return t.jsx(qt.Provider,{value:M,children:t.jsxs("div",{ref:N,className:`nice-touch-menu-popover ${d}`,style:{left:b.x,top:b.y},role:"menu",...u,children:[r.map(A=>t.jsx(ht,{item:A,onSelect:D},A.id)),w&&R&&t.jsx("div",{className:"nice-touch-menu-popover nice-touch-menu-submenu",style:{left:R.x-b.x,top:R.y-b.y},role:"menu",children:w.map(A=>t.jsx(ht,{item:A,onSelect:D},A.id))})]})})}),as=e.forwardRef(function({items:r,trigger:s,longPress:c=!0,longPressDelay:a=500,enableContextMenu:o=!1,enableClick:d=!1,haptic:u=!0,disabled:m=!1,onOpen:N,onClose:y,className:j="",...R},f){const[b,p]=e.useState(!1),[C,D]=e.useState({x:0,y:0}),M=e.useRef(null),w=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(20)}catch{}},[u]),H=e.useCallback((g,T)=>{m||(w(),D({x:g,y:T}),p(!0),N==null||N())},[m,w,N]),A=e.useCallback(()=>{p(!1),y==null||y()},[y]),E=is(g=>{g.preventDefault(),H(g.clientX,g.clientY)},a),W=e.useCallback(g=>{if(!(!d||m)&&(g.preventDefault(),g.stopPropagation(),M.current)){const T=M.current.getBoundingClientRect();H(T.left,T.bottom+4)}},[d,m,H]),L=e.useCallback(g=>{!o||m||(g.preventDefault(),H(g.clientX,g.clientY))},[o,m,H]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:g=>{M.current=g,typeof f=="function"?f(g):f&&(f.current=g)},className:`nice-touch-menu-trigger ${m?"disabled":""} ${j}`,onClick:W,onContextMenu:L,...c&&!m?E:{},...R,children:s}),t.jsx(Gt,{items:r,open:b,position:C,onClose:A,haptic:u})]})}),ls=e.forwardRef(function({items:r,open:s,onClose:c,title:a,cancelLabel:o="Cancel",haptic:d=!0,className:u="",...m},N){const y=e.useCallback(()=>{if(!(!d||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[d]),j=e.useCallback(b=>{var p;b.disabled||(y(),(p=b.onClick)==null||p.call(b),c())},[y,c]),R=e.useCallback(()=>{y(),c()},[y,c]),f=e.useCallback(b=>{b.target===b.currentTarget&&c()},[c]);return e.useEffect(()=>{if(!s)return;const b=p=>{p.key==="Escape"&&c()};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[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",...m,children:[t.jsxs("div",{className:"nice-action-sheet-content",children:[a&&t.jsx("div",{className:"nice-action-sheet-title",children:a}),r.map(b=>t.jsxs("button",{type:"button",className:`nice-action-sheet-item ${b.disabled?"disabled":""} ${b.danger?"danger":""}`,onClick:()=>j(b),disabled:b.disabled,children:[b.icon&&t.jsx("span",{className:"nice-action-sheet-item-icon",children:b.icon}),t.jsx("span",{className:"nice-action-sheet-item-label",children:b.label})]},b.id))]}),t.jsx("button",{type:"button",className:"nice-action-sheet-cancel",onClick:R,children:o})]})}):null});function os({row:n,rowIndex:r,rowKey:s,columns:c,swipeActionsLeft:a=[],swipeActionsRight:o=[],selectable:d,selected:u,onSelect:m,onClick:N,haptic:y,swipeThreshold:j=80}){const[R,f]=e.useState(0),[b,p]=e.useState(!1),C=e.useRef(0),D=e.useRef(0),M=e.useRef(null),w=a.length>0,H=o.length>0,A=e.useCallback(()=>{if(!(!y||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[y]),E=e.useCallback(S=>{!w&&!H||(C.current=S.touches[0].clientX,D.current=S.touches[0].clientX,p(!0))},[w,H]),W=e.useCallback(S=>{if(!b)return;D.current=S.touches[0].clientX;const Y=D.current-C.current;let P=Y;const B=w?j*a.length:0,Q=H?j*o.length:0;P>B&&(P=B),P<-Q&&(P=-Q),!w&&P>0&&(P=Y*.2),!H&&P<0&&(P=Y*.2),f(P)},[b,w,H,j,a.length,o.length]),L=e.useCallback(()=>{if(!b)return;p(!1);const S=j*.5;R>S&&w?(f(j*a.length),A()):R<-S&&H?(f(-j*o.length),A()):f(0)},[b,R,j,w,H,a.length,o.length,A]),g=e.useCallback(S=>{A(),S.onAction(n,r),f(0)},[n,r,A]),T=e.useCallback(()=>{Math.abs(R)>10||(d&&m?m():N&&N())},[R,d,m,N]);return e.useEffect(()=>{if(R===0)return;const S=Y=>{M.current&&!M.current.contains(Y.target)&&f(0)};return document.addEventListener("click",S),()=>document.removeEventListener("click",S)},[R]),t.jsxs("tr",{ref:M,className:`nice-touch-table-row ${u?"selected":""} ${b?"swiping":""}`,onTouchStart:E,onTouchMove:W,onTouchEnd:L,onTouchCancel:L,onClick:T,"data-row-key":s,children:[w&&t.jsx("div",{className:"nice-touch-table-actions nice-touch-table-actions--left",style:{width:j*a.length},children:a.map(S=>t.jsxs("button",{type:"button",className:"nice-touch-table-action",style:{backgroundColor:S.color||"var(--nice-color-primary, #3b82f6)",color:S.textColor||"var(--nice-bg-primary, #ffffff)",width:j},onClick:()=>g(S),children:[S.icon&&t.jsx("span",{className:"action-icon",children:S.icon}),t.jsx("span",{className:"action-label",children:S.label})]},S.id))}),t.jsxs("div",{className:"nice-touch-table-row-content",style:{transform:`translateX(${R}px)`,transition:b?"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:()=>m==null?void 0:m(),onClick:S=>S.stopPropagation()})}),c.map(S=>{const Y=typeof S.accessor=="function"?S.accessor(n):n[S.accessor],P=S.cell?S.cell(Y,n,r):Y;return t.jsx("td",{className:`nice-touch-table-cell ${S.sticky?"sticky":""}`,style:{width:S.width,minWidth:S.minWidth,textAlign:S.align},children:P},S.id)})]}),H&&t.jsx("div",{className:"nice-touch-table-actions nice-touch-table-actions--right",style:{width:j*o.length},children:o.map(S=>t.jsxs("button",{type:"button",className:"nice-touch-table-action",style:{backgroundColor:S.color||"var(--nice-color-error, #ef4444)",color:S.textColor||"var(--nice-bg-primary, #ffffff)",width:j},onClick:()=>g(S),children:[S.icon&&t.jsx("span",{className:"action-icon",children:S.icon}),t.jsx("span",{className:"action-label",children:S.label})]},S.id))})]})}const us=e.forwardRef(function({data:r,columns:s,rowKey:c,swipeActionsLeft:a,swipeActionsRight:o,selectable:d=!1,selectedKeys:u=[],onSelect:m,onRowClick:N,sortState:y,onSort:j,emptyContent:R="No data",loading:f=!1,haptic:b=!0,swipeThreshold:p=80,className:C="",...D},M){const w=e.useCallback(g=>typeof c=="function"?c(g):String(g[c]),[c]),H=e.useCallback(g=>{if(!g.sortable||!j)return;const T=(y==null?void 0:y.columnId)===g.id&&y.direction==="asc"?"desc":"asc";j({columnId:g.id,direction:T})},[y,j]),A=e.useCallback(()=>{m&&(u.length===r.length?m([]):m(r.map(g=>w(g))))},[r,u,m,w]),E=e.useCallback(g=>{if(!m)return;const T=u.includes(g)?u.filter(S=>S!==g):[...u,g];m(T)},[u,m]),W=r.length>0&&u.length===r.length,L=u.length>0&&u.length<r.length;return t.jsxs("div",{ref:M,className:`nice-touch-table-container ${f?"loading":""} ${C}`,...D,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:W,ref:g=>{g&&(g.indeterminate=L)},onChange:A})}),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:()=>H(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,T)=>{const S=w(g);return t.jsx(os,{row:g,rowIndex:T,rowKey:S,columns:s,swipeActionsLeft:a,swipeActionsRight:o,selectable:d,selected:u.includes(S),onSelect:()=>E(S),onClick:()=>N==null?void 0:N(g,T),haptic:b,swipeThreshold:p},S)})})]})}),f&&t.jsx("div",{className:"nice-touch-table-loading",children:t.jsx("div",{className:"nice-touch-table-spinner"})})]})}),Kt=e.createContext(null);function Ze(){const n=e.useContext(Kt);if(!n)throw new Error("useTouchForm must be used within NiceTouchForm");return n}function vt(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 ds=e.forwardRef(function({initialValues:r={},validation:s={},onSubmit:c,onChange:a,onError:o,enableNavigation:d=!0,haptic:u=!0,autoFocus:m=!1,validateOnBlur:N=!0,validateOnChange:y=!1,disabled:j=!1,children:R,className:f="",...b},p){const[C,D]=e.useState(r),[M,w]=e.useState([]),[H,A]=e.useState(new Set),[E,W]=e.useState(!1),L=e.useRef(new Map),g=e.useRef([]),T=e.useRef(null),S=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[u]),Y=e.useCallback((F,X)=>{const v=s[F];return v?vt(X,v):null},[s]),P=e.useCallback(()=>{const F=[];for(const[X,v]of Object.entries(s)){const h=vt(C[X],v);h&&F.push({field:X,message:h})}return F},[C,s]),B=e.useCallback((F,X)=>{if(D(v=>{const h={...v,[F]:X};return a==null||a(h),h}),y){const v=Y(F,X);w(h=>{const x=h.filter(i=>i.field!==F);return v?[...x,{field:F,message:v}]:x})}},[a,y,Y]),Q=e.useCallback(F=>{if(A(X=>new Set([...X,F])),N){const X=Y(F,C[F]);w(v=>{const h=v.filter(x=>x.field!==F);return X?[...h,{field:F,message:X}]:h})}},[N,Y,C]),U=e.useCallback(F=>{var v;const X=L.current.get(F);X&&((v=X.focus)==null||v.call(X),T.current=F)},[]),O=e.useCallback(()=>{if(!d)return;const F=g.current,X=T.current;if(!X){F.length>0&&U(F[0]);return}const v=F.indexOf(X);v<F.length-1&&(U(F[v+1]),S())},[d,U,S]),K=e.useCallback(()=>{if(!d)return;const F=g.current,X=T.current;if(!X)return;const v=F.indexOf(X);v>0&&(U(F[v-1]),S())},[d,U,S]),Z=e.useCallback((F,X)=>{L.current.set(F,X),X&&!g.current.includes(F)&&g.current.push(F)},[]),ee=e.useCallback(F=>{L.current.delete(F),g.current=g.current.filter(X=>X!==F)},[]),I=e.useCallback(async F=>{if(F.preventDefault(),j||E)return;const X=P();if(X.length>0){w(X),o==null||o(X),S();const v=X[0];v&&U(v.field);return}W(!0);try{await(c==null?void 0:c(C)),S()}catch(v){console.error("Form submission error:",v)}finally{W(!1)}},[j,E,P,o,c,C,S,U]);e.useEffect(()=>{m&&g.current.length>0&&setTimeout(()=>U(g.current[0]),100)},[m,U]);const V=e.useMemo(()=>({values:C,errors:M,touched:H,setFieldValue:B,setFieldTouched:Q,focusField:U,focusNext:O,focusPrev:K,registerField:Z,unregisterField:ee}),[C,M,H,B,Q,U,O,K,Z,ee]);return t.jsx(Kt.Provider,{value:V,children:t.jsx("form",{ref:p,className:`nice-touch-form ${j?"disabled":""} ${E?"submitting":""} ${f}`,onSubmit:I,noValidate:!0,...b,children:R})})}),fs=e.forwardRef(function({name:r,label:s,type:c="text",placeholder:a,helperText:o,disabled:d=!1,readOnly:u=!1,autoComplete:m,inputMode:N,iconLeft:y,iconRight:j,maxLength:R,onChange:f,required:b,className:p="",...C},D){const M=Ze(),w=e.useRef(null),[H,A]=e.useState(!1),E=M.values[r]??"",W=M.errors.find(B=>B.field===r),g=M.touched.has(r)&&W;e.useEffect(()=>(M.registerField(r,w.current),()=>M.unregisterField(r)),[r,M]);const T=e.useCallback(B=>{const Q=B.target.value;M.setFieldValue(r,Q),f==null||f(Q)},[r,M,f]),S=e.useCallback(()=>{A(!0)},[]),Y=e.useCallback(()=>{A(!1),M.setFieldTouched(r)},[r,M]),P=e.useCallback(B=>{B.key==="Enter"&&(B.preventDefault(),M.focusNext())},[M]);return t.jsxs("div",{ref:D,className:`nice-touch-field ${H?"focused":""} ${g?"error":""} ${d?"disabled":""} ${p}`,...C,children:[s&&t.jsxs("label",{className:"nice-touch-field-label",htmlFor:`field-${r}`,children:[s,b&&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:a,disabled:d,readOnly:u,autoComplete:m,inputMode:N,maxLength:R,onChange:T,onFocus:S,onBlur:Y,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:W.message}),!g&&o&&t.jsx("div",{id:`${r}-helper`,className:"nice-touch-field-helper",children:o})]})}),hs=e.forwardRef(function({loading:r=!1,disabled:s=!1,fullWidth:c=!0,children:a,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"}):a})}),vs=e.forwardRef(function({doneText:r="Done",showDone:s=!0,onDone:c,className:a="",...o},d){const u=Ze(),m=e.useCallback(()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),c==null||c()},[c]);return t.jsxs("div",{ref:d,className:`nice-touch-navbar ${a}`,...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:m,children:r})]})});exports.DEFAULT_BREAKPOINTS=Le;exports.DotsIndicator=nn;exports.DrawerIcons=jn;exports.EmojiIndicator=sn;exports.HAPTIC_PATTERNS=Je;exports.HapticPatternBuilder=Yt;exports.HeaderIcons=Vn;exports.HeroHeader=Un;exports.IOSHeader=Wn;exports.IOSIndicator=cn;exports.LineIndicator=rn;exports.MaterialHeader=On;exports.MaterialIndicator=an;exports.NiceBottomSheet=kt;exports.NiceBreakpointProvider=Dr;exports.NiceCalculatorKeyboard=ss;exports.NiceConfirmSheet=Cn;exports.NiceDateRangePicker=cr;exports.NiceDrawingToolbar=_r;exports.NiceFAB=Yr;exports.NiceGestures=Ee;exports.NiceHapticsProvider=br;exports.NiceHide=Cr;exports.NiceImageGallery=jt;exports.NiceInfiniteScroll=pn;exports.NiceMobileActionSheet=Sn;exports.NiceMobileCalendar=Ke;exports.NiceMobileDatePicker=Kn;exports.NiceMobileDraggable=or;exports.NiceMobileDrawer=Rt;exports.NiceMobileHeader=Ie;exports.NiceMobileModal=qe;exports.NiceMobilePicker=Ge;exports.NiceMobilePullToRefresh=_e;exports.NiceMobileTabs=In;exports.NiceMobileTimePicker=qn;exports.NiceMultiDatePicker=ir;exports.NicePINKeyboard=rs;exports.NicePhoneKeyboard=cs;exports.NicePickerColumn=$t;exports.NicePinchZoom=lr;exports.NicePullToRefresh=_e;exports.NiceShow=Sr;exports.NiceSignaturePad=_t;exports.NiceSwipeActions=wt;exports.NiceSwipeList=ln;exports.NiceSwipeable=ur;exports.NiceTouchActionSheet=ls;exports.NiceTouchButton=Qe;exports.NiceTouchColorPicker=Vr;exports.NiceTouchDrawing=Or;exports.NiceTouchField=fs;exports.NiceTouchForm=ds;exports.NiceTouchIconButton=Ar;exports.NiceTouchKeyboard=He;exports.NiceTouchMenu=as;exports.NiceTouchMenuPopover=Gt;exports.NiceTouchNavBar=vs;exports.NiceTouchSignaturePad=_t;exports.NiceTouchSlider=Fr;exports.NiceTouchSubmit=hs;exports.NiceTouchTable=us;exports.PullToRefreshDefaultIndicator=xt;exports.SwipeActionPresets=on;exports.SwipeGroupProvider=gt;exports.TabIcons=de;exports.TabPresets=En;exports.cancelVibration=pr;exports.colorUtils=zr;exports.createHapticPattern=Mr;exports.createMediaQuery=Pr;exports.generateNumberItems=we;exports.getCurrentBreakpoint=zt;exports.hapticFeedback=xr;exports.isMobileDevice=Ir;exports.isTouch=Er;exports.isVibrationSupported=pe;exports.responsive=$r;exports.useBreakpoint=ke;exports.useBreakpointContext=Rr;exports.useButtonHaptic=yr;exports.useCalendar=Lt;exports.useCollapsingHeader=Bn;exports.useDrawer=kn;exports.useGestures=Ht;exports.useGesturesContext=ar;exports.useHaptics=xe;exports.useHapticsContext=vr;exports.useImpactHaptic=Nr;exports.useInfiniteData=gn;exports.useInfiniteScroll=fn;exports.useMediaQuery=Vt;exports.useMobileBreakpoint=ke;exports.useMobileCalendar=Jn;exports.useMobileDrawer=wn;exports.useMobileHeader=Ln;exports.useMobileMediaQuery=Vt;exports.useMobileModal=Nn;exports.useMobilePicker=Xn;exports.useMobilePullToRefresh=mt;exports.useMobileTabs=Pn;exports.useModal=Mn;exports.useNotificationHaptic=jr;exports.usePullToRefresh=mt;exports.useSelectionHaptic=kr;exports.useSwipeGroup=yt;exports.useTabs=$n;exports.useToggleHaptic=wr;exports.useTouchForm=Ze;exports.useTouchSlider=Wt;exports.useVirtualList=yn;exports.useWheelPicker=_n;exports.vibrate=mr;exports.withHaptics=gr;
24
+ ${U?"nice-touch-slider--dragging":""}
25
+ ${B}
26
+ `,style:{"--thumb-size":`${x}px`,"--track-height":`${D}px`,...f?{"--track-color":f}:{},...m?{"--fill-color":m}:{}},...L,children:[M&&t.jsx("span",{className:"nice-touch-slider-min",children:w(c)}),t.jsxs("div",{ref:O,className:"nice-touch-slider-track-container",onPointerDown:F,onPointerMove:K,onPointerUp:v,onPointerCancel:v,children:[t.jsx("div",{className:"nice-touch-slider-track"}),t.jsx("div",{className:"nice-touch-slider-fill",style:S}),Q.length>0&&t.jsx("div",{className:"nice-touch-slider-marks",children:Q.map(i=>{const h=(i.value-c)/(a-c)*100,R=d==="horizontal"?{left:`${h}%`}:{bottom:`${h}%`};return t.jsxs("div",{className:"nice-touch-slider-mark",style:R,children:[t.jsx("span",{className:"nice-touch-slider-mark-dot"}),i.label&&t.jsx("span",{className:"nice-touch-slider-mark-label",children:i.label})]},i.value)})}),j.isRange?t.jsxs(t.Fragment,{children:[o(0,j.percentage[0]),o(1,j.percentage[1])]}):o(0,j.percentage)]}),M&&t.jsx("span",{className:"nice-touch-slider-max",children:w(a)})]})});function He(n,r,s){r/=100,s/=100;const c=(1-Math.abs(2*s-1))*r,a=c*(1-Math.abs(n/60%2-1)),l=s-c/2;let d=0,u=0,b=0;return n>=0&&n<60?(d=c,u=a,b=0):n>=60&&n<120?(d=a,u=c,b=0):n>=120&&n<180?(d=0,u=c,b=a):n>=180&&n<240?(d=0,u=a,b=c):n>=240&&n<300?(d=a,u=0,b=c):(d=c,u=0,b=a),{r:Math.round((d+l)*255),g:Math.round((u+l)*255),b:Math.round((b+l)*255)}}function Ut(n,r,s){n/=255,r/=255,s/=255;const c=Math.max(n,r,s),a=Math.min(n,r,s),l=(c+a)/2;let d=0,u=0;if(c!==a){const b=c-a;switch(u=l>.5?b/(2-c-a):b/(c+a),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(l*100)}}function Xt(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 _t(n,r,s){return"#"+[n,r,s].map(c=>c.toString(16).padStart(2,"0")).join("")}function we(n){const r=Xt(n);return Ut(r.r,r.g,r.b)}function $e(n,r,s){const c=He(n,r,s);return _t(c.r,c.g,c.b)}function Xe(n,r){switch(r){case"hsl":return`hsl(${n.h}, ${n.s}%, ${n.l}%)`;case"rgb":{const s=He(n.h,n.s,n.l);return`rgb(${s.r}, ${s.g}, ${s.b})`}case"hex":default:return $e(n.h,n.s,n.l)}}const zr=e.forwardRef(function({value:r,defaultValue:s="#6366f1",format:c="hex",showAlpha:a=!1,showPreview:l=!0,showInput:d=!0,presetColors:u,wheelSize:b=240,haptic:k=!0,onChange:p,presetLabel:w="Presets",className:M="",...f},m){const[x,D]=e.useState(()=>we(r||s)),[T,N]=e.useState(r||s),[y,H]=e.useState(1),B=e.useRef(null),I=e.useRef(null),W=e.useRef(!1),L=e.useRef(!1);e.useEffect(()=>{if(r){const v=we(r);D(v),N(r)}},[r]);const g=e.useCallback(()=>{if(!(!k||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[k]),j=e.useCallback(v=>{const C=Xe(v,c);N(c==="hex"?C:$e(v.h,v.s,v.l)),p==null||p(C)},[c,p]);e.useEffect(()=>{const v=B.current;if(!v)return;const C=v.getContext("2d");if(!C)return;const S=b,o=S/2,i=o-10,h=i-30;v.width=S,v.height=S;for(let R=0;R<360;R++){const V=(R-1)*Math.PI/180,q=(R+1)*Math.PI/180;C.beginPath(),C.arc(o,o,i,V,q),C.arc(o,o,h,q,V,!0),C.closePath(),C.fillStyle=`hsl(${R}, 100%, 50%)`,C.fill()}},[b]),e.useEffect(()=>{const v=I.current;if(!v)return;const C=v.getContext("2d");if(!C)return;const S=b*.5;v.width=S,v.height=S;const o=C.createImageData(S,S);for(let i=0;i<S;i++)for(let h=0;h<S;h++){const R=h/S*100,V=100-i/S*100,q=He(x.h,R,V),ne=(i*S+h)*4;o.data[ne]=q.r,o.data[ne+1]=q.g,o.data[ne+2]=q.b,o.data[ne+3]=255}C.putImageData(o,0,0)},[x.h,b]);const O=e.useCallback(v=>{const C=B.current;if(!C)return;const S=C.getBoundingClientRect(),o=v.clientX-S.left-S.width/2,i=v.clientY-S.top-S.height/2;let h=Math.atan2(i,o)*(180/Math.PI)+90;h<0&&(h+=360);const R={...x,h:Math.round(h)};D(R),j(R),g()},[x,j,g]),U=e.useCallback(v=>{const C=I.current;if(!C)return;const S=C.getBoundingClientRect(),o=Math.max(0,Math.min(S.width,v.clientX-S.left)),i=Math.max(0,Math.min(S.height,v.clientY-S.top)),h=Math.round(o/S.width*100),R=Math.round(100-i/S.height*100),V={...x,s:h,l:R};D(V),j(V),g()},[x,j,g]),E=e.useCallback(v=>{v.currentTarget.setPointerCapture(v.pointerId),W.current=!0,O(v)},[O]),$=e.useCallback(v=>{W.current&&O(v)},[O]),A=e.useCallback(v=>{v.currentTarget.releasePointerCapture(v.pointerId),W.current=!1},[]),Y=e.useCallback(v=>{v.currentTarget.setPointerCapture(v.pointerId),L.current=!0,U(v)},[U]),z=e.useCallback(v=>{L.current&&U(v)},[U]),G=e.useCallback(v=>{v.currentTarget.releasePointerCapture(v.pointerId),L.current=!1},[]),Q=e.useCallback(v=>{const C=v.target.value;if(N(C),/^#?[0-9a-f]{6}$/i.test(C)){const S=C.startsWith("#")?C:`#${C}`,o=we(S);D(o),p==null||p(Xe(o,c))}},[c,p]),ee=e.useCallback(v=>{const C=we(v);D(C),j(C),g()},[j,g]),P=e.useMemo(()=>{const v=b/2,C=v-25,S=(x.h-90)*Math.PI/180;return{x:v+C*Math.cos(S),y:v+C*Math.sin(S)}},[x.h,b]),X=b*.5,F=e.useMemo(()=>({x:x.s/100*X,y:(1-x.l/100)*X}),[x.s,x.l,X]),K=e.useMemo(()=>$e(x.h,x.s,x.l),[x]);return t.jsxs("div",{ref:m,className:`nice-touch-color-picker ${M}`,...f,children:[t.jsxs("div",{className:"nice-touch-color-picker-wheel-container",style:{width:b,height:b},children:[t.jsx("canvas",{ref:B,className:"nice-touch-color-picker-wheel",onPointerDown:E,onPointerMove:$,onPointerUp:A,onPointerCancel:A}),t.jsx("div",{className:"nice-touch-color-picker-hue-indicator",style:{left:P.x,top:P.y,backgroundColor:`hsl(${x.h}, 100%, 50%)`}}),t.jsxs("div",{className:"nice-touch-color-picker-sl-container",style:{width:X,height:X},children:[t.jsx("canvas",{ref:I,className:"nice-touch-color-picker-sl",onPointerDown:Y,onPointerMove:z,onPointerUp:G,onPointerCancel:G}),t.jsx("div",{className:"nice-touch-color-picker-sl-indicator",style:{left:F.x,top:F.y,backgroundColor:K}})]})]}),t.jsxs("div",{className:"nice-touch-color-picker-controls",children:[l&&t.jsx("div",{className:"nice-touch-color-picker-preview",style:{backgroundColor:K}}),d&&t.jsx("input",{type:"text",className:"nice-touch-color-picker-input",value:T,onChange:Q,placeholder:"#000000"})]}),a&&t.jsx("div",{className:"nice-touch-color-picker-alpha",children:t.jsx("input",{type:"range",min:"0",max:"100",value:y*100,onChange:v=>H(Number(v.target.value)/100),className:"nice-touch-color-picker-alpha-slider",style:{background:`linear-gradient(to right, transparent, ${K})`}})}),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:w}),t.jsx("div",{className:"nice-touch-color-picker-presets-grid",children:u.map((v,C)=>t.jsx("button",{type:"button",className:`nice-touch-color-picker-preset ${v.toLowerCase()===K.toLowerCase()?"nice-touch-color-picker-preset--selected":""}`,style:{backgroundColor:v},onClick:()=>ee(v),"aria-label":`Select color ${v}`},C))})]})]})}),Wr={hslToRgb:He,rgbToHsl:Ut,hexToRgb:Xt,rgbToHex:_t,hexToHsl:we,hslToHex:$e,formatColor:Xe};function pe(n,r){var d;const s=n.trim().match(/^var\(\s*([^,\s)]+)\s*(?:,\s*(.+))?\)$/);if(!s)return n;const c=(d=s[2])==null?void 0:d.trim();if(typeof document>"u"||typeof getComputedStyle>"u")return c?pe(c):n;const a=typeof Element<"u"&&r instanceof Element&&r.isConnected?r:document.documentElement,l=getComputedStyle(a).getPropertyValue(s[1]).trim();return l||(c?pe(c,r):n)}function Or(n,r){return Math.sqrt(Math.pow(r.x-n.x,2)+Math.pow(r.y-n.y,2))}function ht(n,r){const s=r.time-n.time||1;return Or(n,r)/s}const qt=e.forwardRef(function({width:r="100%",height:s=200,strokeColor:c="#1f2937",strokeWidth:a=2,minWidth:l=.5,maxWidth:d=4,velocityFilterWeight:u=.7,backgroundColor:b="#ffffff",showGuideline:k=!0,guidelineColor:p="var(--nice-border-color, #e5e7eb)",disabled:w=!1,penPressure:M=!0,haptic:f=!0,placeholder:m="Sign here",onChange:x,onBegin:D,onEnd:T,className:N="",...y},H){const B=e.useRef(null),I=e.useRef(null),W=e.useMemo(()=>pe(c,B.current),[c]),L=e.useMemo(()=>pe(b,B.current),[b]),g=e.useMemo(()=>pe(p,B.current),[p]),[j,O]=e.useState(!0),[U,E]=e.useState(!1),$=e.useRef([]),A=e.useRef([]),Y=e.useRef([]),z=e.useRef(0),G=e.useRef(a);e.useEffect(()=>{const i=B.current;if(!i)return;const h=i.getBoundingClientRect(),R=window.devicePixelRatio||1;i.width=h.width*R,i.height=h.height*R;const V=i.getContext("2d");V&&(V.scale(R,R),I.current=V,ee())},[]);const Q=e.useCallback(()=>{if(!(!f||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[f]),ee=e.useCallback(()=>{const i=B.current,h=I.current;if(!i||!h)return;const R=i.getBoundingClientRect();h.fillStyle=L,h.fillRect(0,0,R.width,R.height),k&&(h.strokeStyle=g,h.lineWidth=1,h.setLineDash([5,5]),h.beginPath(),h.moveTo(20,R.height*.7),h.lineTo(R.width-20,R.height*.7),h.stroke(),h.setLineDash([]))},[L,k,g]),P=e.useCallback(()=>{ee();const i=I.current;i&&A.current.forEach(h=>{if(!(h.length<2)){i.strokeStyle=W,i.fillStyle=W,i.lineCap="round",i.lineJoin="round";for(let R=1;R<h.length;R++){const V=h[R-1],q=h[R],ne=ht(V,q),ie=Math.max(l,Math.min(d,d/(ne+1)));i.lineWidth=ie,i.beginPath(),i.moveTo(V.x,V.y),i.lineTo(q.x,q.y),i.stroke()}}})},[ee,W,l,d]),X=e.useCallback(i=>Math.max(l,d/(i*10+1)),[l,d]),F=e.useCallback(i=>{const h=I.current;h&&(h.fillStyle=W,h.beginPath(),h.arc(i.x,i.y,a/2,0,Math.PI*2),h.fill())},[W,a]),K=e.useCallback((i,h,R)=>{const V=I.current;V&&(V.strokeStyle=W,V.lineWidth=R,V.lineCap="round",V.lineJoin="round",V.beginPath(),V.moveTo(i.x,i.y),V.lineTo(h.x,h.y),V.stroke())},[W]),v=e.useCallback(i=>{const h=B.current;if(!h)return{x:0,y:0,time:Date.now()};const R=h.getBoundingClientRect();return{x:i.clientX-R.left,y:i.clientY-R.top,pressure:M?i.pressure:void 0,time:Date.now()}},[M]),C=e.useCallback(i=>{if(w)return;i.preventDefault(),i.currentTarget.setPointerCapture(i.pointerId),E(!0);const h=v(i);$.current=[h],z.current=0,G.current=a,Y.current=[],F(h),D==null||D(),Q()},[w,v,a,F,D,Q]),S=e.useCallback(i=>{if(!U||w)return;const h=v(i),R=$.current;if(R.length===0)return;const V=R[R.length-1],q=ht(V,h),ne=u*q+(1-u)*z.current,ie=X(ne),re=(G.current+ie)/2,ae=h.pressure!==void 0?re*Math.max(.5,h.pressure):re;K(V,h,ae),R.push(h),z.current=ne,G.current=ie},[U,w,v,u,X,K]),o=e.useCallback(i=>{U&&(i.currentTarget.releasePointerCapture(i.pointerId),E(!1),$.current.length>0&&(A.current.push([...$.current]),$.current=[],O(!1),x==null||x(!1)),T==null||T())},[U,x,T]);return e.useImperativeHandle(H,()=>({clear:()=>{A.current=[],Y.current=[],$.current=[],ee(),O(!0),x==null||x(!0)},isEmpty:()=>j,toData:()=>[...A.current],fromData:i=>{A.current=i,Y.current=[],O(i.length===0),P(),x==null||x(i.length===0)},toDataURL:(i="png",h=1)=>{const R=B.current;if(!R)return"";if(i==="svg"){const q=R.getBoundingClientRect();let ne="";A.current.forEach(re=>{if(re.length<2)return;let ae=`M ${re[0].x} ${re[0].y}`;for(let te=1;te<re.length;te++)ae+=` L ${re[te].x} ${re[te].y}`;ne+=`<path d="${ae}" stroke="${W}" stroke-width="${a}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`});const ie=`<svg xmlns="http://www.w3.org/2000/svg" width="${q.width}" height="${q.height}" viewBox="0 0 ${q.width} ${q.height}">${ne}</svg>`;return`data:image/svg+xml;base64,${btoa(ie)}`}if(i==="json")return`data:application/json;base64,${btoa(JSON.stringify(A.current))}`;const V=i==="jpeg"?"image/jpeg":"image/png";return R.toDataURL(V,h)},toSVG:()=>{const i=B.current;if(!i)return"";const h=i.getBoundingClientRect();let R="";return A.current.forEach(V=>{if(V.length<2)return;let q=`M ${V[0].x} ${V[0].y}`;for(let ne=1;ne<V.length;ne++)q+=` L ${V[ne].x} ${V[ne].y}`;R+=`<path d="${q}" stroke="${W}" stroke-width="${a}" fill="none" stroke-linecap="round" stroke-linejoin="round"/>`}),`<svg xmlns="http://www.w3.org/2000/svg" width="${h.width}" height="${h.height}" viewBox="0 0 ${h.width} ${h.height}">${R}</svg>`},toBlob:(i="png",h=1)=>new Promise(R=>{const V=B.current;if(!V){R(null);return}const q=i==="jpeg"?"image/jpeg":"image/png";V.toBlob(R,q,h)}),undo:()=>{if(A.current.length===0)return;const i=A.current.pop();i&&Y.current.push(i);const h=A.current.length===0;O(h),P(),x==null||x(h)},redo:()=>{if(Y.current.length===0)return;const i=Y.current.pop();i&&A.current.push(i),O(!1),P(),x==null||x(!1)}}),[j,ee,P,W,a,x]),t.jsxs("div",{className:`nice-signature-pad ${w?"nice-signature-pad--disabled":""} ${N}`,...y,children:[t.jsx("canvas",{ref:B,className:"nice-signature-pad-canvas",style:{width:r,height:s,backgroundColor:L,touchAction:"none"},onPointerDown:C,onPointerMove:S,onPointerUp:o,onPointerCancel:o,onPointerLeave:o}),j&&m&&t.jsx("div",{className:"nice-signature-pad-placeholder",children:m})]})}),Ur=e.forwardRef(function({width:r="100%",height:s=300,backgroundColor:c="var(--nice-bg-primary, #ffffff)",strokeColor:a="var(--nice-text-primary, #1f2937)",strokeWidth:l=4,tool:d="pen",lineCap:u="round",opacity:b=1,penPressure:k=!0,haptic:p=!0,maxHistory:w=50,disabled:M=!1,onChange:f,onToolChange:m,className:x="",...D},T){const N=e.useRef(null),y=e.useRef(null),[H,B]=e.useState(!1),[I,W]=e.useState(d),L=e.useRef([]),g=e.useRef(-1),j=e.useRef(null),O=e.useRef(null),U=e.useRef(null);e.useEffect(()=>{W(d)},[d]),e.useEffect(()=>{const v=N.current;if(!v)return;const C=v.getBoundingClientRect(),S=window.devicePixelRatio||1;v.width=C.width*S,v.height=C.height*S;const o=v.getContext("2d",{willReadFrequently:!0});o&&(o.scale(S,S),y.current=o,o.fillStyle=c,o.fillRect(0,0,C.width,C.height),E())},[c]);const E=e.useCallback(()=>{const v=N.current,C=y.current;if(!v||!C)return;const S=v.getBoundingClientRect(),o=C.getImageData(0,0,S.width,S.height);g.current<L.current.length-1&&(L.current=L.current.slice(0,g.current+1)),L.current.push({type:"stroke",imageData:o}),L.current.length>w&&L.current.shift(),g.current=L.current.length-1},[w]),$=e.useCallback(v=>{const C=y.current;if(!C||v<0||v>=L.current.length)return;const S=L.current[v];C.putImageData(S.imageData,0,0)},[]),A=e.useCallback(()=>{if(!(!p||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(5)}catch{}},[p]),Y=e.useCallback(v=>{const C=N.current;if(!C)return{x:0,y:0};const S=C.getBoundingClientRect();return{x:v.clientX-S.left,y:v.clientY-S.top,pressure:k?v.pressure:void 0}},[k]),z=e.useCallback(()=>{const v=y.current;v&&(v.lineCap=u,v.lineJoin="round",v.globalAlpha=b,I==="eraser"?(v.globalCompositeOperation="destination-out",v.strokeStyle=pe("var(--nice-overlay-90, rgba(0, 0, 0, 1))",v.canvas),v.lineWidth=l*2):I==="brush"?(v.globalCompositeOperation="source-over",v.strokeStyle=a,v.lineWidth=l):I==="marker"?(v.globalCompositeOperation="multiply",v.strokeStyle=a,v.lineWidth=l*1.5,v.globalAlpha=.5):(v.globalCompositeOperation="source-over",v.strokeStyle=a,v.lineWidth=l))},[I,a,l,u,b]),G=e.useCallback((v,C)=>{const S=y.current;S&&(z(),C.pressure!==void 0&&I!=="eraser"&&(S.lineWidth=l*Math.max(.3,C.pressure)),S.beginPath(),S.moveTo(v.x,v.y),S.lineTo(C.x,C.y),S.stroke())},[z,l,I]),Q=e.useCallback((v,C)=>{const S=y.current;if(!S||!U.current)return;S.putImageData(U.current,0,0),z();const o=C.x-v.x,i=C.y-v.y;if(S.beginPath(),I==="line")S.moveTo(v.x,v.y),S.lineTo(C.x,C.y),S.stroke();else if(I==="rectangle")S.strokeRect(v.x,v.y,o,i);else if(I==="circle"){const h=Math.sqrt(o*o+i*i);S.arc(v.x,v.y,h,0,Math.PI*2),S.stroke()}},[z,I]),ee=e.useCallback((v,C,S)=>{const o=N.current,i=y.current;if(!o||!i)return;const h=o.getBoundingClientRect(),R=i.getImageData(0,0,h.width,h.height),V=R.data,q=document.createElement("div");q.style.color=S,document.body.appendChild(q);const ne=getComputedStyle(q).color;document.body.removeChild(q);const ie=ne.match(/\d+/g);if(!ie)return;const[re,ae,te]=ie.map(Number),se=(Math.floor(C)*h.width+Math.floor(v))*4,oe=V[se],_=V[se+1],J=V[se+2],Z=V[se+3];if(oe===re&&_===ae&&J===te)return;const ce=[[Math.floor(v),Math.floor(C)]],le=new Set;for(;ce.length>0;){const[ue,fe]=ce.pop(),he=(fe*h.width+ue)*4;if(ue<0||ue>=h.width||fe<0||fe>=h.height||le.has(he))continue;const Ye=V[he],Qt=V[he+1],Zt=V[he+2],en=V[he+3],Ne=30;Math.abs(Ye-oe)>Ne||Math.abs(Qt-_)>Ne||Math.abs(Zt-J)>Ne||Math.abs(en-Z)>Ne||(le.add(he),V[he]=re,V[he+1]=ae,V[he+2]=te,V[he+3]=255,ce.push([ue+1,fe],[ue-1,fe],[ue,fe+1],[ue,fe-1]))}i.putImageData(R,0,0)},[]),P=e.useCallback(v=>{if(M)return;v.preventDefault(),v.currentTarget.setPointerCapture(v.pointerId);const C=Y(v);if(I==="fill"){ee(C.x,C.y,a),E(),f==null||f(),A();return}if(B(!0),j.current=C,O.current=C,I==="line"||I==="rectangle"||I==="circle"){const S=N.current,o=y.current;if(S&&o){const i=S.getBoundingClientRect();U.current=o.getImageData(0,0,i.width,i.height)}}else{const S=y.current;S&&(z(),S.beginPath(),S.arc(C.x,C.y,l/2,0,Math.PI*2),S.fill())}A()},[M,Y,I,ee,a,E,f,A,z,l]),X=e.useCallback(v=>{if(!H||M)return;const C=Y(v);I==="line"||I==="rectangle"||I==="circle"?j.current&&Q(j.current,C):O.current&&G(O.current,C),O.current=C},[H,M,Y,I,Q,G]),F=e.useCallback(v=>{H&&(v.currentTarget.releasePointerCapture(v.pointerId),B(!1),(I==="line"||I==="rectangle"||I==="circle")&&j.current&&O.current&&Q(j.current,O.current),U.current=null,j.current=null,O.current=null,E(),f==null||f())},[H,I,Q,E,f]);e.useImperativeHandle(T,()=>({clear:()=>{const v=N.current,C=y.current;if(!v||!C)return;const S=v.getBoundingClientRect();C.fillStyle=c,C.globalCompositeOperation="source-over",C.fillRect(0,0,S.width,S.height),E(),f==null||f()},undo:()=>{g.current>0&&(g.current--,$(g.current),f==null||f())},redo:()=>{g.current<L.current.length-1&&(g.current++,$(g.current),f==null||f())},canUndo:()=>g.current>0,canRedo:()=>g.current<L.current.length-1,toDataURL:(v="png",C=1)=>{const S=N.current;if(!S)return"";const o=v==="jpeg"?"image/jpeg":"image/png";return S.toDataURL(o,C)},toBlob:(v="png",C=1)=>new Promise(S=>{const o=N.current;if(!o){S(null);return}const i=v==="jpeg"?"image/jpeg":"image/png";o.toBlob(S,i,C)}),fromDataURL:async v=>{const C=N.current,S=y.current;if(!(!C||!S))return new Promise(o=>{const i=new Image;i.onload=()=>{const h=C.getBoundingClientRect();S.drawImage(i,0,0,h.width,h.height),E(),o()},i.src=v})},fill:v=>{const C=N.current,S=y.current;if(!C||!S)return;const o=C.getBoundingClientRect();S.fillStyle=v,S.globalCompositeOperation="source-over",S.fillRect(0,0,o.width,o.height),E(),f==null||f()},getTool:()=>I,setTool:v=>{W(v),m==null||m(v)}}),[c,E,$,I,m,f]);const K=()=>{switch(I){case"eraser":return"cell";case"fill":return"crosshair";default:return"crosshair"}};return t.jsx("div",{className:`nice-touch-drawing ${M?"nice-touch-drawing--disabled":""} ${x}`,...D,children:t.jsx("canvas",{ref:N,className:"nice-touch-drawing-canvas",style:{width:r,height:s,cursor:K(),touchAction:"none"},onPointerDown:P,onPointerMove:X,onPointerUp:F,onPointerCancel:F,onPointerLeave:F})})}),Xr=["var(--nice-text-primary, #1f2937)","var(--nice-color-error, #ef4444)","var(--nice-warning, #f97316)","var(--nice-color-warning, #eab308)","var(--nice-color-success, #22c55e)","var(--nice-color-primary, #3b82f6)","var(--nice-color-accent, #8b5cf6)","var(--nice-color-accent-pink, #ec4899)","var(--nice-bg-primary, #ffffff)","var(--nice-text-primary, #000000)"],_r={pen:"Pen",brush:"Brush",marker:"Mark",eraser:"Erase",fill:"Fill",line:"Line",rectangle:"Rect",circle:"Circle"};function ze(n,r,s){const[c,a]=e.useState(r),l=n!==void 0;return[l?n:c,u=>{l||a(u),s==null||s(u)}]}const qr=e.forwardRef(function({tool:r,defaultTool:s="pen",onToolChange:c,color:a,defaultColor:l,onColorChange:d,strokeWidth:u,defaultStrokeWidth:b=4,onStrokeWidthChange:k,onUndo:p,onRedo:w,onClear:M,canUndo:f=!0,canRedo:m=!0,colors:x=Xr,className:D="",...T},N){const[y,H]=ze(r,s,c),[B,I]=ze(a,l??x[0],d),[W,L]=ze(u,b,k),g=["pen","brush","marker","eraser","fill","line","rectangle","circle"];return t.jsxs("div",{ref:N,className:`nice-drawing-toolbar ${D}`,...T,children:[t.jsx("div",{className:"nice-drawing-toolbar-section",children:g.map(j=>t.jsx("button",{type:"button",className:`nice-drawing-tool-btn ${y===j?"active":""}`,onClick:()=>H(j),title:j,"aria-label":j,children:_r[j]},j))}),t.jsx("div",{className:"nice-drawing-toolbar-divider"}),t.jsx("div",{className:"nice-drawing-toolbar-section nice-drawing-colors",children:x.map((j,O)=>t.jsx("button",{type:"button",className:`nice-drawing-color-btn ${B===j?"active":""}`,style:{backgroundColor:j,borderColor:j==="var(--nice-bg-primary, #ffffff)"?"var(--nice-border-color, #e5e7eb)":j},onClick:()=>I(j),title:j},O))}),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:[W,"px"]}),t.jsx("input",{type:"range",min:1,max:50,value:W,onChange:j=>L(Number(j.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:[p&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:p,disabled:!f,title:"Undo",children:"Undo"}),w&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn",onClick:w,disabled:!m,title:"Redo",children:"Redo"}),M&&t.jsx("button",{type:"button",className:"nice-drawing-action-btn danger",onClick:M,title:"Clear",children:"Clear"})]})]})}),Ie={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:[["/","'","ק","ר","א","ט","ו","ן","ם","פ"],["ש","ד","ג","כ","ע","י","ח","ל","ך","ף"],["ז","ס","ב","ה","נ","מ","צ","ת","ץ"]]}},be={value:"Backspace",label:"⌫",type:"backspace",width:1.5},Re={value:"Enter",label:"⏎",type:"enter",width:1.5},Ce={value:" ",label:"Space",type:"space",width:5},De={value:"Shift",label:"⇧",type:"shift",width:1.5},Gr={value:"CapsLock",label:"⇪",type:"caps",width:1.75},Kr={value:"Tab",label:"⇥",type:"tab",width:1.5},We=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"0"},{value:"-"},{value:"="}],Jr=[{value:"!"},{value:"@"},{value:"#"},{value:"$"},{value:"%"},{value:"^"},{value:"&"},{value:"*"},{value:"("},{value:")"}],Qr=[{value:"-"},{value:"_"},{value:"="},{value:"+"},{value:"["},{value:"]"},{value:"{"},{value:"}"},be],Zr=[{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"}],_e=[[{value:"1"},{value:"2"},{value:"3"}],[{value:"4"},{value:"5"},{value:"6"}],[{value:"7"},{value:"8"},{value:"9"}],[{value:".",width:1},{value:"0"},be]],es=[[{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"},be,{value:"=",type:"enter",width:2}]],ts=[[{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:"Call",type:"enter",width:1.5},be]],ns=[[{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"},be]];function rs(n,r,s,c,a){const l=Ie[n]||Ie.en,[d,u,b]=l.rows;if(r==="minimal")return _e;if(s){const w=[We.slice(0,10),Jr,Qr],M=[{value:"ABC",label:"ABC",type:"fn",width:1.5}];return c&&M.push({value:"Lang",label:"Lang",type:"lang",width:1}),M.push({value:",",width:1}),M.push({...Ce,width:c?3.5:4}),M.push({value:".",width:1}),M.push({...Re,...a?{label:a}:{}}),w.push(M),w}if(r==="compact"){const w=[d.map(f=>({value:f})),u.map(f=>({value:f})),[De,...b.map(f=>({value:f})),be]],M=[{value:"123",label:"123",type:"fn",width:1.5}];return c&&M.push({value:"Lang",label:"Lang",type:"lang",width:1}),M.push({value:",",width:1}),M.push({...Ce,width:c?3.5:4}),M.push({value:".",width:1}),M.push({...Re,...a?{label:a}:{}}),w.push(M),w}if(r==="standard"){const w=[We.slice(0,10),d.map(f=>({value:f})),u.map(f=>({value:f})),[De,...b.map(f=>({value:f})),be]],M=[{value:"#+=",label:"#+=",type:"fn",width:1.5}];return c&&M.push({value:"Lang",label:"Lang",type:"lang",width:1}),M.push({value:",",width:1}),M.push({...Ce,width:c?3:4}),M.push({value:".",width:1}),M.push({...Re,...a?{label:a}:{}}),w.push(M),w}const k=[Zr,[...We,be],[Kr,...d.map(w=>({value:w}))],[Gr,...u.map(w=>({value:w})),{...Re,width:1.75,...a?{label:a}:{}}],[{...De,width:2.25},...b.map(w=>({value:w})),{...De,width:2.25}]],p=[{value:"#+=",label:"#+=",type:"fn",width:1.5}];if(c&&p.push({value:"Lang",label:"Lang",type:"lang",width:1}),p.push({...Ce,width:c?6:7}),p.push({value:",",width:1}),p.push({value:".",width:1}),k.push(p),l.accents){const w=[];for(const[,M]of Object.entries(l.accents))for(const f of M)w.find(m=>m.value===f)||w.push({value:f});w.length>0&&k.push(w)}return k}const Ae=e.forwardRef(function({layout:r="qwerty",customLayout:s,mode:c="standard",languages:a,activeLanguage:l,onLanguageChange:d,value:u="",maxLength:b,theme:k="system",haptic:p=!0,sound:w=!1,onKeyPress:M,onChange:f,onSubmit:m,disabled:x=!1,showPreview:D=!1,previewPlaceholder:T="Type here...",masked:N=!1,showLanguageSwitcher:y,enterLabel:H,className:B="",...I},W){const L=e.useMemo(()=>a&&a.length>0?a:["en"],[a]),[g,j]=e.useState(L[0]),O=l??g,[U,E]=e.useState(!1),[$,A]=e.useState(!1),[Y,z]=e.useState(!1),G=y??L.length>1,Q=e.useMemo(()=>r==="custom"&&s?s.rows:r!=="qwerty"?{numeric:_e,numpad:es,phone:ts,pin:ns}[r]||_e:rs(O,c,Y,G,H),[r,s,O,c,Y,G,H]),ee=e.useCallback(()=>{const o=L.indexOf(O),i=L[(o+1)%L.length];j(i),d==null||d(i)},[L,O,d]),P=e.useCallback(()=>{if(!(!p||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[p]),X=e.useCallback(()=>{if(w)try{const o=new(window.AudioContext||window.webkitAudioContext),i=o.createOscillator(),h=o.createGain();i.connect(h),h.connect(o.destination),i.frequency.value=1e3,i.type="sine",h.gain.value=.1,i.start(),i.stop(o.currentTime+.05)}catch{}},[w]),F=e.useCallback(o=>{if(x)return;P(),X();let i=u;switch(o.type){case"backspace":i=u.slice(0,-1);break;case"enter":m==null||m(u);return;case"shift":E(h=>!h);return;case"caps":A(h=>!h);return;case"tab":i=u+" ";break;case"lang":ee();return;case"fn":if(o.value==="123"||o.value==="ABC"||o.value==="#+="||o.value==="#+=")z(h=>!h);else if(o.value==="Clear"||o.value==="C")i="";else{M==null||M(o.value);return}return;case"space":i=u+" ";break;default:{let h=o.value;(U||$)&&h.length===1&&(h=h.toUpperCase()),i=u+h,U&&!$&&E(!1)}}b&&i.length>b||(M==null||M(o.value),f==null||f(i))},[x,u,b,U,$,P,X,M,f,m,ee]),K=e.useMemo(()=>N?"•".repeat(u.length):u,[u,N]),v=U||$,C=k==="system"?"":`nice-touch-keyboard--${k}`,S=Ie[O];return t.jsxs("div",{ref:W,className:["nice-touch-keyboard",`nice-touch-keyboard--${c}`,C,x?"nice-touch-keyboard--disabled":"",B].filter(Boolean).join(" "),"data-layout":r,"data-language":O,dir:O==="ar"||O==="he"?"rtl":void 0,...I,children:[G&&L.length>1&&t.jsx("div",{className:"nice-touch-keyboard-langbar",children:L.map(o=>{const i=Ie[o];return t.jsx("button",{type:"button",className:`nice-touch-keyboard-langbar__btn ${o===O?"active":""}`,onClick:()=>{j(o),d==null||d(o)},disabled:x,children:(i==null?void 0:i.nativeName)??o.toUpperCase()},o)})}),D&&t.jsxs("div",{className:"nice-touch-keyboard-preview",children:[K||t.jsx("span",{className:"nice-touch-keyboard-placeholder",children:T}),t.jsx("span",{className:"nice-touch-keyboard-cursor"})]}),t.jsx("div",{className:"nice-touch-keyboard-keys",children:Q.map((o,i)=>t.jsx("div",{className:"nice-touch-keyboard-row",children:o.map((h,R)=>{var ie;const V=h.type==="shift"&&U||h.type==="caps"&&$||h.type==="lang"||h.value==="123"&&Y||h.value==="ABC"&&!Y||h.value==="#+="&&Y;let q=h.label||h.value;v&&!h.type&&q.length===1&&(q=q.toUpperCase());const ne=!h.type&&h.value.length===1&&((ie=S==null?void 0:S.accents)==null?void 0:ie[h.value.toLowerCase()]);return t.jsx("button",{type:"button",className:["nice-touch-keyboard-key",`nice-touch-keyboard-key--${h.type||"char"}`,V?"active":"",ne?"nice-touch-keyboard-key--has-accent":""].filter(Boolean).join(" "),style:{flex:h.width||1},onClick:()=>F(h),disabled:x,"aria-label":h.type==="backspace"?"Backspace":h.type==="enter"?"Enter":void 0,children:h.icon||q},R)})},i))}),t.jsxs("div",{className:"nice-touch-keyboard-status",children:[$&&t.jsx("span",{className:"nice-touch-keyboard-status__item",children:"CAPS"}),S&&t.jsx("span",{className:"nice-touch-keyboard-status__item",children:S.nativeName})]})]})}),ss=e.forwardRef(function(r,s){return t.jsx(Ae,{ref:s,layout:"pin",masked:!0,maxLength:r.maxLength||6,...r})}),cs=e.forwardRef(function(r,s){return t.jsx(Ae,{ref:s,layout:"numpad",...r})}),is=e.forwardRef(function(r,s){return t.jsx(Ae,{ref:s,layout:"phone",...r})}),Gt=e.createContext(null);function as(n,r=500){const s=e.useRef(void 0),c=e.useRef(null),a=e.useCallback(u=>{c.current={x:u.clientX,y:u.clientY},s.current=setTimeout(()=>{n(u)},r)},[n,r]),l=e.useCallback(u=>{if(!c.current)return;const b=Math.abs(u.clientX-c.current.x),k=Math.abs(u.clientY-c.current.y);(b>10||k>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:a,onPointerMove:l,onPointerUp:d,onPointerCancel:d,onPointerLeave:d}}const vt=({item:n,onSelect:r})=>{const s=e.useContext(Gt),c=e.useRef(null),[a,l]=e.useState(null),d=e.useCallback(()=>{var p;if(!n.disabled)if(n.children&&n.children.length>0){if(c.current){const w=c.current.getBoundingClientRect();s==null||s.openSubmenu(n.id,{x:w.right,y:w.top})}}else(p=n.onClick)==null||p.call(n),r(n)},[n,r,s]),u=e.useCallback(()=>{if(n.children&&n.children.length>0&&c.current){const p=c.current.getBoundingClientRect();s==null||s.openSubmenu(n.id,{x:p.right,y:p.top})}},[n,s]),b=n.children&&n.children.length>0,k=(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":""} ${k?"active":""}`,onClick:d,onPointerEnter:u,disabled:n.disabled,role:"menuitem","aria-haspopup":b?"menu":void 0,"aria-expanded":b?k: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","aria-hidden":"true"})]}),n.divider&&t.jsx("div",{className:"nice-touch-menu-divider",role:"separator"})]})},Kt=e.forwardRef(function({items:r,open:s,position:c,onClose:a,haptic:l=!0,className:d="",...u},b){var H;const k=e.useRef(null),[p,w]=e.useState(null),[M,f]=e.useState(null),[m,x]=e.useState(c);e.useEffect(()=>{if(!s||!k.current)return;const I=k.current.getBoundingClientRect(),W={width:window.innerWidth,height:window.innerHeight};let L=c.x,g=c.y;L+I.width>W.width-8&&(L=W.width-I.width-8),L<8&&(L=8),g+I.height>W.height-8&&(g=W.height-I.height-8),g<8&&(g=8),x({x:L,y:g})},[s,c]),e.useEffect(()=>{if(!s)return;const B=W=>{k.current&&!k.current.contains(W.target)&&a()},I=W=>{W.key==="Escape"&&a()};return document.addEventListener("mousedown",B),document.addEventListener("keydown",I),()=>{document.removeEventListener("mousedown",B),document.removeEventListener("keydown",I)}},[s,a]);const D=e.useCallback(()=>{if(!(!l||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[l]),T=e.useCallback(B=>{D(),a()},[D,a]),N={close:a,openSubmenu:(B,I)=>{w(B),f(I)},closeSubmenu:()=>{w(null),f(null)},activeSubmenu:p};if(!s)return null;const y=p?(H=r.find(B=>B.id===p))==null?void 0:H.children:null;return t.jsx(Gt.Provider,{value:N,children:t.jsxs("div",{ref:k,className:`nice-touch-menu-popover ${d}`,style:{left:m.x,top:m.y},role:"menu",...u,children:[r.map(B=>t.jsx(vt,{item:B,onSelect:T},B.id)),y&&M&&t.jsx("div",{className:"nice-touch-menu-popover nice-touch-menu-submenu",style:{left:M.x-m.x,top:M.y-m.y},role:"menu",children:y.map(B=>t.jsx(vt,{item:B,onSelect:T},B.id))})]})})}),ls=e.forwardRef(function({items:r,trigger:s,longPress:c=!0,longPressDelay:a=500,enableContextMenu:l=!1,enableClick:d=!1,haptic:u=!0,disabled:b=!1,onOpen:k,onClose:p,className:w="",...M},f){const[m,x]=e.useState(!1),[D,T]=e.useState({x:0,y:0}),N=e.useRef(null),y=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(20)}catch{}},[u]),H=e.useCallback((g,j)=>{b||(y(),T({x:g,y:j}),x(!0),k==null||k())},[b,y,k]),B=e.useCallback(()=>{x(!1),p==null||p()},[p]),I=as(g=>{g.preventDefault(),H(g.clientX,g.clientY)},a),W=e.useCallback(g=>{if(!(!d||b)&&(g.preventDefault(),g.stopPropagation(),N.current)){const j=N.current.getBoundingClientRect();H(j.left,j.bottom+4)}},[d,b,H]),L=e.useCallback(g=>{!l||b||(g.preventDefault(),H(g.clientX,g.clientY))},[l,b,H]);return t.jsxs(t.Fragment,{children:[t.jsx("div",{ref:g=>{N.current=g,typeof f=="function"?f(g):f&&(f.current=g)},className:`nice-touch-menu-trigger ${b?"disabled":""} ${w}`,onClick:W,onContextMenu:L,...c&&!b?I:{},...M,children:s}),t.jsx(Kt,{items:r,open:m,position:D,onClose:B,haptic:u})]})}),os=e.forwardRef(function({items:r,open:s,onClose:c,title:a,cancelLabel:l="Cancel",haptic:d=!0,className:u="",...b},k){const p=e.useCallback(()=>{if(!(!d||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[d]),w=e.useCallback(m=>{var x;m.disabled||(p(),(x=m.onClick)==null||x.call(m),c())},[p,c]),M=e.useCallback(()=>{p(),c()},[p,c]),f=e.useCallback(m=>{m.target===m.currentTarget&&c()},[c]);return e.useEffect(()=>{if(!s)return;const m=x=>{x.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:k,className:`nice-action-sheet ${u}`,role:"dialog","aria-modal":"true",...b,children:[t.jsxs("div",{className:"nice-action-sheet-content",children:[a&&t.jsx("div",{className:"nice-action-sheet-title",children:a}),r.map(m=>t.jsxs("button",{type:"button",className:`nice-action-sheet-item ${m.disabled?"disabled":""} ${m.danger?"danger":""}`,onClick:()=>w(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:M,children:l})]})}):null});function us({row:n,rowIndex:r,rowKey:s,columns:c,swipeActionsLeft:a=[],swipeActionsRight:l=[],selectable:d,selected:u,onSelect:b,onClick:k,haptic:p,swipeThreshold:w=80}){const[M,f]=e.useState(0),[m,x]=e.useState(!1),D=e.useRef(0),T=e.useRef(0),N=e.useRef(null),y=a.length>0,H=l.length>0,B=e.useCallback(()=>{if(!(!p||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[p]),I=e.useCallback(A=>{!y&&!H||(D.current=A.touches[0].clientX,T.current=A.touches[0].clientX,x(!0))},[y,H]),W=e.useCallback(A=>{if(!m)return;T.current=A.touches[0].clientX;const Y=T.current-D.current;let z=Y;const G=y?w*a.length:0,Q=H?w*l.length:0;z>G&&(z=G),z<-Q&&(z=-Q),!y&&z>0&&(z=Y*.2),!H&&z<0&&(z=Y*.2),f(z)},[m,y,H,w,a.length,l.length]),L=e.useCallback(()=>{if(!m)return;x(!1);const A=w*.5;M>A&&y?(f(w*a.length),B()):M<-A&&H?(f(-w*l.length),B()):f(0)},[m,M,w,y,H,a.length,l.length,B]),g=e.useCallback(A=>{B(),A.onAction(n,r),f(0)},[n,r,B]),j=e.useCallback(()=>{Math.abs(M)>10||(d&&b?b():k&&k())},[M,d,b,k]);e.useEffect(()=>{if(M===0)return;const A=Y=>{N.current&&!N.current.contains(Y.target)&&f(0)};return document.addEventListener("click",A),()=>document.removeEventListener("click",A)},[M]);const O={transform:M?`translateX(${M}px)`:void 0,transition:m?"none":"transform 0.2s ease-out"},U=M!==0||m,E=A=>{const Y=A==="left"?a:l;if(!Y.length||!U)return null;const z=A==="left"?"var(--nice-color-primary, #3b82f6)":"var(--nice-color-error, #ef4444)";return t.jsx("div",{className:`nice-touch-table-actions nice-touch-table-actions--${A}`,style:{width:w*Y.length},children:Y.map(G=>t.jsxs("button",{type:"button",className:"nice-touch-table-action",style:{backgroundColor:G.color||z,color:G.textColor||"var(--nice-text-on-primary, #ffffff)",width:w},onClick:Q=>{Q.stopPropagation(),g(G)},children:[G.icon&&t.jsx("span",{className:"action-icon",children:G.icon}),t.jsx("span",{className:"action-label",children:G.label})]},G.id))})},$=c.length-1;return t.jsxs("tr",{ref:N,className:`nice-touch-table-row ${u?"selected":""} ${m?"swiping":""}`,onTouchStart:I,onTouchMove:W,onTouchEnd:L,onTouchCancel:L,onClick:j,"data-row-key":s,children:[d&&t.jsxs("td",{className:"nice-touch-table-cell nice-touch-table-cell--checkbox nice-touch-table-cell--edge",style:O,children:[E("left"),t.jsx("input",{type:"checkbox",checked:u,onChange:()=>b==null?void 0:b(),onClick:A=>A.stopPropagation()})]}),c.map((A,Y)=>{const z=typeof A.accessor=="function"?A.accessor(n):n[A.accessor],G=A.cell?A.cell(z,n,r):z,Q=!d&&Y===0,ee=Y===$;return t.jsxs("td",{className:`nice-touch-table-cell ${A.sticky?"sticky":""} ${Q||ee?"nice-touch-table-cell--edge":""}`,style:{width:A.width,minWidth:A.minWidth,textAlign:A.align,...O},children:[Q&&E("left"),G,ee&&E("right")]},A.id)})]})}const ds=e.forwardRef(function({data:r,columns:s,rowKey:c,swipeActionsLeft:a,swipeActionsRight:l,selectable:d=!1,selectedKeys:u=[],onSelect:b,onRowClick:k,sortState:p,onSort:w,emptyContent:M="No data",loading:f=!1,haptic:m=!0,swipeThreshold:x=80,className:D="",...T},N){const y=e.useCallback(g=>typeof c=="function"?c(g):String(g[c]),[c]),H=e.useCallback(g=>{if(!g.sortable||!w)return;const j=(p==null?void 0:p.columnId)===g.id&&p.direction==="asc"?"desc":"asc";w({columnId:g.id,direction:j})},[p,w]),B=e.useCallback(()=>{b&&(u.length===r.length?b([]):b(r.map(g=>y(g))))},[r,u,b,y]),I=e.useCallback(g=>{if(!b)return;const j=u.includes(g)?u.filter(O=>O!==g):[...u,g];b(j)},[u,b]),W=r.length>0&&u.length===r.length,L=u.length>0&&u.length<r.length;return t.jsxs("div",{ref:N,className:`nice-touch-table-container ${f?"loading":""} ${D}`,...T,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:W,ref:g=>{g&&(g.indeterminate=L)},onChange:B})}),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:()=>H(g),children:t.jsxs("span",{className:"header-content",children:[g.header,g.sortable&&t.jsx("span",{className:"sort-indicator","aria-hidden":"true",children:(p==null?void 0:p.columnId)===g.id&&t.jsx("span",{className:`sort-mark sort-mark--${p.direction}`})})]})},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:M})}):r.map((g,j)=>{const O=y(g);return t.jsx(us,{row:g,rowIndex:j,rowKey:O,columns:s,swipeActionsLeft:a,swipeActionsRight:l,selectable:d,selected:u.includes(O),onSelect:()=>I(O),onClick:()=>k==null?void 0:k(g,j),haptic:m,swipeThreshold:x},O)})})]})}),f&&t.jsx("div",{className:"nice-touch-table-loading",children:t.jsx("div",{className:"nice-touch-table-spinner"})})]})}),Jt=e.createContext(null);function et(){const n=e.useContext(Jt);if(!n)throw new Error("useTouchForm must be used within NiceTouchForm");return n}function mt(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 fs=e.forwardRef(function({initialValues:r={},validation:s={},onSubmit:c,onChange:a,onError:l,enableNavigation:d=!0,haptic:u=!0,autoFocus:b=!1,validateOnBlur:k=!0,validateOnChange:p=!1,disabled:w=!1,children:M,className:f="",...m},x){const[D,T]=e.useState(r),[N,y]=e.useState([]),[H,B]=e.useState(new Set),[I,W]=e.useState(!1),L=e.useRef(new Map),g=e.useRef([]),j=e.useRef(null),O=e.useCallback(()=>{if(!(!u||typeof navigator>"u"||!("vibrate"in navigator)))try{navigator.vibrate(10)}catch{}},[u]),U=e.useCallback((F,K)=>{const v=s[F];return v?mt(K,v):null},[s]),E=e.useCallback(()=>{const F=[];for(const[K,v]of Object.entries(s)){const C=mt(D[K],v);C&&F.push({field:K,message:C})}return F},[D,s]),$=e.useCallback((F,K)=>{if(T(v=>{const C={...v,[F]:K};return a==null||a(C),C}),p){const v=U(F,K);y(C=>{const S=C.filter(o=>o.field!==F);return v?[...S,{field:F,message:v}]:S})}},[a,p,U]),A=e.useCallback(F=>{if(B(K=>new Set([...K,F])),k){const K=U(F,D[F]);y(v=>{const C=v.filter(S=>S.field!==F);return K?[...C,{field:F,message:K}]:C})}},[k,U,D]),Y=e.useCallback(F=>{var v;const K=L.current.get(F);K&&((v=K.focus)==null||v.call(K),j.current=F)},[]),z=e.useCallback(()=>{if(!d)return;const F=g.current,K=j.current;if(!K){F.length>0&&Y(F[0]);return}const v=F.indexOf(K);v<F.length-1&&(Y(F[v+1]),O())},[d,Y,O]),G=e.useCallback(()=>{if(!d)return;const F=g.current,K=j.current;if(!K)return;const v=F.indexOf(K);v>0&&(Y(F[v-1]),O())},[d,Y,O]),Q=e.useCallback((F,K)=>{L.current.set(F,K),K&&!g.current.includes(F)&&g.current.push(F)},[]),ee=e.useCallback(F=>{L.current.delete(F),g.current=g.current.filter(K=>K!==F)},[]),P=e.useCallback(async F=>{if(F.preventDefault(),w||I)return;const K=E();if(K.length>0){y(K),l==null||l(K),O();const v=K[0];v&&Y(v.field);return}W(!0);try{await(c==null?void 0:c(D)),O()}catch(v){console.error("Form submission error:",v)}finally{W(!1)}},[w,I,E,l,c,D,O,Y]);e.useEffect(()=>{b&&g.current.length>0&&setTimeout(()=>Y(g.current[0]),100)},[b,Y]);const X=e.useMemo(()=>({values:D,errors:N,touched:H,setFieldValue:$,setFieldTouched:A,focusField:Y,focusNext:z,focusPrev:G,registerField:Q,unregisterField:ee}),[D,N,H,$,A,Y,z,G,Q,ee]);return t.jsx(Jt.Provider,{value:X,children:t.jsx("form",{ref:x,className:`nice-touch-form ${w?"disabled":""} ${I?"submitting":""} ${f}`,onSubmit:P,noValidate:!0,...m,children:M})})}),hs=e.forwardRef(function({name:r,label:s,type:c="text",placeholder:a,helperText:l,disabled:d=!1,readOnly:u=!1,autoComplete:b,inputMode:k,iconLeft:p,iconRight:w,maxLength:M,onChange:f,required:m,className:x="",...D},T){const N=et(),y=e.useRef(null),[H,B]=e.useState(!1),I=N.values[r]??"",W=N.errors.find($=>$.field===r),g=N.touched.has(r)&&W;e.useEffect(()=>(N.registerField(r,y.current),()=>N.unregisterField(r)),[r,N]);const j=e.useCallback($=>{const A=$.target.value;N.setFieldValue(r,A),f==null||f(A)},[r,N,f]),O=e.useCallback(()=>{B(!0)},[]),U=e.useCallback(()=>{B(!1),N.setFieldTouched(r)},[r,N]),E=e.useCallback($=>{$.key==="Enter"&&($.preventDefault(),N.focusNext())},[N]);return t.jsxs("div",{ref:T,className:`nice-touch-field ${H?"focused":""} ${g?"error":""} ${d?"disabled":""} ${x}`,...D,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:[p&&t.jsx("span",{className:"nice-touch-field-icon left",children:p}),t.jsx("input",{ref:y,id:`field-${r}`,name:r,type:c,value:I,placeholder:a,disabled:d,readOnly:u,autoComplete:b,inputMode:k,maxLength:M,onChange:j,onFocus:O,onBlur:U,onKeyDown:E,className:"nice-touch-field-input","aria-invalid":g?"true":void 0,"aria-describedby":g?`${r}-error`:l?`${r}-helper`:void 0}),w&&t.jsx("span",{className:"nice-touch-field-icon right",children:w})]}),g&&t.jsx("div",{id:`${r}-error`,className:"nice-touch-field-error",role:"alert",children:W.message}),!g&&l&&t.jsx("div",{id:`${r}-helper`,className:"nice-touch-field-helper",children:l})]})}),vs=e.forwardRef(function({loading:r=!1,disabled:s=!1,fullWidth:c=!0,children:a,className:l="",...d},u){return t.jsx("button",{ref:u,type:"submit",className:`nice-touch-submit ${c?"full-width":""} ${r?"loading":""} ${l}`,disabled:s||r,...d,children:r?t.jsx("span",{className:"nice-touch-submit-spinner"}):a})}),ms=e.forwardRef(function({doneText:r="Done",showDone:s=!0,onDone:c,className:a="",...l},d){const u=et(),b=e.useCallback(()=>{document.activeElement instanceof HTMLElement&&document.activeElement.blur(),c==null||c()},[c]);return t.jsxs("div",{ref:d,className:`nice-touch-navbar ${a}`,...l,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("span",{className:"nice-touch-navbar-mark nice-touch-navbar-mark--prev","aria-hidden":"true"})}),t.jsx("button",{type:"button",onClick:u.focusNext,"aria-label":"Next field",children:t.jsx("span",{className:"nice-touch-navbar-mark nice-touch-navbar-mark--next","aria-hidden":"true"})})]}),s&&t.jsx("button",{type:"button",className:"nice-touch-navbar-done",onClick:b,children:r})]})});exports.DEFAULT_BREAKPOINTS=Be;exports.DotsIndicator=rn;exports.DrawerIcons=Nn;exports.EmojiIndicator=cn;exports.HAPTIC_PATTERNS=Qe;exports.HapticPatternBuilder=Ft;exports.HeaderIcons=zn;exports.HeroHeader=Xn;exports.IOSHeader=On;exports.IOSIndicator=an;exports.LineIndicator=sn;exports.MaterialHeader=Un;exports.MaterialIndicator=ln;exports.NiceBottomSheet=jt;exports.NiceBreakpointProvider=Dr;exports.NiceCalculatorKeyboard=cs;exports.NiceConfirmSheet=Pn;exports.NiceDateRangePicker=ir;exports.NiceDrawingToolbar=qr;exports.NiceFAB=Fr;exports.NiceGestures=Le;exports.NiceHapticsProvider=br;exports.NiceHide=Pr;exports.NiceImageGallery=Nt;exports.NiceInfiniteScroll=gn;exports.NiceMobileActionSheet=Sn;exports.NiceMobileCalendar=Je;exports.NiceMobileDatePicker=Jn;exports.NiceMobileDraggable=ur;exports.NiceMobileDrawer=Ct;exports.NiceMobileHeader=Ee;exports.NiceMobileModal=Ge;exports.NiceMobilePicker=Ke;exports.NiceMobilePullToRefresh=qe;exports.NiceMobileTabs=En;exports.NiceMobileTimePicker=Gn;exports.NiceMultiDatePicker=ar;exports.NicePINKeyboard=ss;exports.NicePhoneKeyboard=is;exports.NicePickerColumn=It;exports.NicePinchZoom=or;exports.NicePullToRefresh=qe;exports.NiceShow=Sr;exports.NiceSignaturePad=qt;exports.NiceSwipeActions=kt;exports.NiceSwipeList=on;exports.NiceSwipeable=dr;exports.NiceTouchActionSheet=os;exports.NiceTouchButton=Ze;exports.NiceTouchColorPicker=zr;exports.NiceTouchDrawing=Ur;exports.NiceTouchField=hs;exports.NiceTouchForm=fs;exports.NiceTouchIconButton=Yr;exports.NiceTouchKeyboard=Ae;exports.NiceTouchMenu=ls;exports.NiceTouchMenuPopover=Kt;exports.NiceTouchNavBar=ms;exports.NiceTouchSignaturePad=qt;exports.NiceTouchSlider=Vr;exports.NiceTouchSubmit=vs;exports.NiceTouchTable=ds;exports.PullToRefreshDefaultIndicator=pt;exports.SwipeActionPresets=un;exports.SwipeGroupProvider=yt;exports.TabIcons=de;exports.TabPresets=Ln;exports.cancelVibration=gr;exports.colorUtils=Wr;exports.createHapticPattern=Tr;exports.createMediaQuery=$r;exports.generateNumberItems=ke;exports.getCurrentBreakpoint=Wt;exports.hapticFeedback=pr;exports.isMobileDevice=Er;exports.isTouch=Lr;exports.isVibrationSupported=ge;exports.responsive=Ir;exports.useBreakpoint=je;exports.useBreakpointContext=Cr;exports.useButtonHaptic=wr;exports.useCalendar=Bt;exports.useCollapsingHeader=Hn;exports.useDrawer=jn;exports.useGestures=At;exports.useGesturesContext=lr;exports.useHaptics=xe;exports.useHapticsContext=mr;exports.useImpactHaptic=Mr;exports.useInfiniteData=yn;exports.useInfiniteScroll=hn;exports.useMediaQuery=zt;exports.useMobileBreakpoint=je;exports.useMobileCalendar=Qn;exports.useMobileDrawer=kn;exports.useMobileHeader=Bn;exports.useMobileMediaQuery=zt;exports.useMobileModal=Mn;exports.useMobilePicker=_n;exports.useMobilePullToRefresh=xt;exports.useMobileTabs=$n;exports.useModal=Tn;exports.useNotificationHaptic=Nr;exports.usePullToRefresh=xt;exports.useSelectionHaptic=jr;exports.useSwipeGroup=wt;exports.useTabs=In;exports.useToggleHaptic=kr;exports.useTouchForm=et;exports.useTouchSlider=Ot;exports.useVirtualList=wn;exports.useWheelPicker=qn;exports.vibrate=xr;exports.withHaptics=yr;