@nice2dev/ui-mobile 1.0.12 → 1.0.14

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,4 +1,4 @@
1
- "use strict";var Zt=Object.defineProperty;var en=(n,r,s)=>r in n?Zt(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s;var Ze=(n,r,s)=>en(n,typeof r!="symbol"?r+"":r,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),vt=e.createContext(null);function bt(){const n=e.useContext(vt);if(!n)throw new Error("usePullToRefresh must be used within NicePullToRefresh");return n}function Ne(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const mt=({state:n,progress:r,pullDistance:s,threshold:c})=>{const i=r*360,o=Math.min(1,r),d=()=>{switch(n){case"pulling":return t.jsxs("svg",{className:"ptr-icon ptr-icon-arrow",style:{transform:`rotate(${Math.min(i,180)}deg)`},width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("polyline",{points:"19 12 12 19 5 12"})]});case"ready":return t.jsxs("svg",{className:"ptr-icon ptr-icon-ready",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]});case"refreshing":return t.jsxs("svg",{className:"ptr-icon ptr-icon-spinner",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),t.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),t.jsx("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),t.jsx("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),t.jsx("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),t.jsx("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),t.jsx("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),t.jsx("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]});case"success":return t.jsx("svg",{className:"ptr-icon ptr-icon-success",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"20 6 9 17 4 12"})});case"error":return t.jsxs("svg",{className:"ptr-icon ptr-icon-error",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});default:return null}},u=()=>{switch(n){case"pulling":return"Pull down to refresh";case"ready":return"Release to refresh";case"refreshing":return"Refreshing...";case"success":return"Updated!";case"error":return"Failed to refresh";default:return""}};return t.jsxs("div",{className:`ptr-indicator ptr-indicator--${n}`,style:{opacity:n==="idle"?0:Math.max(.3,r),transform:`scale(${o})`},role:"status","aria-live":"polite",children:[t.jsx("div",{className:"ptr-indicator-icon",children:d()}),t.jsx("span",{className:"ptr-indicator-text",children:u()}),n==="pulling"&&t.jsx("div",{className:"ptr-progress-ring",children:t.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",children:[t.jsx("circle",{className:"ptr-progress-bg",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2"}),t.jsx("circle",{className:"ptr-progress-fill",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2",strokeDasharray:`${88*r} 88`,transform:"rotate(-90 16 16)"})]})})]})},Xe=e.forwardRef(({children:n,onRefresh:r,indicator:s,threshold:c=80,maxPull:i=150,resistance:o=.4,completionDuration:d=1e3,hapticFeedback:u=!0,disabled:b=!1,onPullStart:N,onPullProgress:y,onRefreshSuccess:j,onRefreshError:R,className:f="",style:m,ariaLabel:p="Pull to refresh"},S)=>{const[M,T]=e.useState("idle"),[w,A]=e.useState(0),Y=e.useRef(null),E=e.useRef(null),O=e.useRef(0),L=e.useRef(0),g=e.useRef(!1),D=e.useRef(!1),C=Math.min(1,w/c),B=M==="refreshing",P=e.useCallback(()=>w<=0?0:((F,V,h)=>{const v=F*(1-h);return Math.min(V,v+v*h/2)})(w,i,o),[w,i,o]),H=e.useCallback(async()=>{if(!(M==="refreshing"||b)){T("refreshing"),u&&Ne("medium");try{await r(),T("success"),u&&Ne("heavy"),j==null||j()}catch(z){T("error"),u&&Ne("light"),R==null||R(z instanceof Error?z:new Error("Refresh failed"))}setTimeout(()=>{T("idle"),A(0)},d)}},[M,b,u,r,j,R,d]),Z=e.useCallback(z=>{if(b||M==="refreshing")return;const F=E.current,V=(F==null?void 0:F.scrollTop)??0;V>0||(O.current=z.touches[0].clientY,L.current=V,D.current=!1)},[b,M]),_=e.useCallback(z=>{if(b||M==="refreshing")return;const F=E.current;if(((F==null?void 0:F.scrollTop)??0)>0&&!g.current)return;const v=z.touches[0].clientY-O.current;if(v<=0){g.current&&(g.current=!1,T("idle"),A(0));return}g.current||(g.current=!0,N==null||N(),T("pulling")),z.preventDefault(),A(v);const x=Math.min(1,v/c);y==null||y(x),v>=c?M!=="ready"&&(T("ready"),u&&!D.current&&(Ne("light"),D.current=!0)):M==="ready"&&(T("pulling"),D.current=!1)},[b,M,c,u,N,y]),W=e.useCallback(()=>{g.current&&(g.current=!1,M==="ready"?H():(T("idle"),A(0)))},[M,H]),K=e.useCallback(z=>{(z.key==="F5"||z.ctrlKey&&z.key==="r")&&(z.preventDefault(),H())},[H]),J=e.useCallback(z=>{Y.current=z,typeof S=="function"?S(z):S&&(S.current=z)},[S]),ee={state:M,progress:C,isRefreshing:B,triggerRefresh:H},$=P();return t.jsx(vt.Provider,{value:ee,children:t.jsxs("div",{ref:J,className:`nice-ptr ${f} nice-ptr--${M}`,style:m,onTouchStart:Z,onTouchMove:_,onTouchEnd:W,onKeyDown:K,tabIndex:0,role:"region","aria-label":p,"data-state":M,"data-disabled":b||void 0,children:[t.jsx("div",{className:"nice-ptr-indicator-wrapper",style:{height:$,opacity:M==="idle"?0:1},children:s?t.jsx(s,{state:M,progress:C,pullDistance:w,threshold:c}):t.jsx(mt,{state:M,progress:C,pullDistance:w,threshold:c})}),t.jsx("div",{ref:E,className:"nice-ptr-content",style:{transform:M==="refreshing"?`translateY(${c}px)`:`translateY(${$}px)`,transition:g.current?"none":"transform 0.3s cubic-bezier(0.23, 1, 0.32, 1)"},children:n})]})})});Xe.displayName="NicePullToRefresh";const tn=({state:n,progress:r})=>t.jsxs("div",{className:`ptr-dots ptr-dots--${n}`,children:[t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,r*3)}}),t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,(r-.33)*3)}}),t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,(r-.66)*3)}})]}),nn=({state:n,progress:r})=>t.jsx("div",{className:`ptr-line ptr-line--${n}`,children:t.jsx("div",{className:"ptr-line-fill",style:{width:`${r*100}%`}})}),rn=({state:n})=>{const r={idle:"",pulling:"👇",ready:"🔄",refreshing:"⏳",success:"✅",error:"❌"};return t.jsx("div",{className:`ptr-emoji ptr-emoji--${n}`,children:t.jsx("span",{className:"ptr-emoji-icon",children:r[n]})})},sn=({state:n,progress:r})=>t.jsx("div",{className:`ptr-ios ptr-ios--${n}`,children:t.jsx("div",{className:"ptr-ios-spinner",children:Array.from({length:12}).map((c,i)=>{const o=i/12*360,d=i/12*1,u=n==="refreshing"?void 0:Math.min(1,r*2-i*.08);return t.jsx("div",{className:"ptr-ios-bar",style:{transform:`rotate(${o}deg) translateY(-8px)`,animationDelay:`${d}s`,opacity:u}},i)})})}),cn=({state:n,progress:r})=>t.jsxs("div",{className:`ptr-material ptr-material--${n}`,children:[t.jsxs("svg",{className:"ptr-material-circle",viewBox:"0 0 36 36",width:"36",height:"36",children:[t.jsx("circle",{className:"ptr-material-bg",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3"}),t.jsx("circle",{className:"ptr-material-progress",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3",strokeDasharray:`${100*r} 100`,strokeLinecap:"round",transform:"rotate(-90 18 18)"})]}),(n==="success"||n==="error")&&t.jsx("span",{className:"ptr-material-icon",children:n==="success"?"✓":"!"})]}),xt=e.createContext(null),pt=({children:n})=>{const[r,s]=e.useState(null);return t.jsx(xt.Provider,{value:{activeItemId:r,setActiveItemId:s},children:n})};function gt(){return e.useContext(xt)}function Me(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const et=({action:n,width:r,progress:s,index:c,total:i,side:o,onTrigger:d})=>{const u=Math.min(1,s*2),b=o==="right"?(i-1-c)*.05:c*.05;return t.jsxs("button",{className:`nice-swipe-action nice-swipe-action--${o} ${n.destructive?"nice-swipe-action--destructive":""}`,style:{width:r,background:n.background||"var(--color-primary, #3b82f6)",color:n.color||"var(--bg-primary, #ffffff)",transform:`scale(${u})`,transitionDelay:`${b}s`},onClick:d,"aria-label":n.label,children:[n.icon&&t.jsx("span",{className:"nice-swipe-action-icon",children:n.icon}),t.jsx("span",{className:"nice-swipe-action-label",children:n.label})]})},yt=e.forwardRef(({children:n,leftActions:r=[],rightActions:s=[],actionWidth:c=72,threshold:i=.4,direction:o,exclusive:d=!0,onSwipeStart:u,onSwipeEnd:b,onAction:N,disabled:y=!1,className:j="",style:R,itemId:f,hapticFeedback:m=!0},p)=>{const S=gt(),[M,T]=e.useState(0),[w,A]=e.useState(null),[Y,E]=e.useState(!1),O=e.useRef(null),L=e.useRef(0),g=e.useRef(0),D=e.useRef(0),C=e.useRef(!1),B=e.useRef(null),P=e.useRef(!1),H=-(r.length*c),Z=s.length*c,_=(o==="left"||o==="both"||!o)&&r.length>0,W=(o==="right"||o==="both"||!o)&&s.length>0,K=Math.min(1,Math.abs(M)/Math.abs(H)),J=Math.min(1,M/Z),ee=e.useMemo(()=>f||`swipe-${Math.random().toString(36).substr(2,9)}`,[f]),$=e.useCallback(()=>{E(!0),T(0),A(null),setTimeout(()=>E(!1),300)},[]);e.useEffect(()=>{d&&S&&S.activeItemId!==null&&S.activeItemId!==ee&&w&&$()},[d,S,ee,w,$]);const z=e.useCallback(a=>{y||Y||(L.current=a.touches[0].clientX,g.current=a.touches[0].clientY,D.current=M,C.current=!1,B.current=null,P.current=!1)},[y,Y,M]),F=e.useCallback(a=>{if(y||Y)return;const l=a.touches[0].clientX,k=a.touches[0].clientY,I=l-L.current,G=k-g.current;if(!C.current){if(Math.abs(I)<Math.abs(G))return;C.current=!0,B.current=I<0?"left":"right",u==null||u(B.current),d&&S&&S.setActiveItemId(ee)}let X=D.current+I;if(!_&&X<0&&(X=Math.max(X,-30)*.3),!W&&X>0&&(X=Math.min(X,30)*.3),_&&X<H){const ne=H-X;X=H-ne*.3}if(W&&X>Z){const ne=X-Z;X=Z+ne*.3}const q=B.current==="left"?Math.abs(H)*i:Z*i,se=B.current==="left"?Math.abs(X):X;se>=q&&!P.current?(P.current=!0,m&&Me("light")):se<q&&P.current&&(P.current=!1),T(X),a.preventDefault()},[y,Y,_,W,H,Z,i,m,d,S,ee,u]),V=e.useCallback(()=>{if(!C.current)return;C.current=!1,E(!0);const a=Math.abs(H)*i,l=Z*i;let k=0,I=null;B.current==="left"&&_?Math.abs(M)>=a&&(k=H,I="left",m&&Me("medium")):B.current==="right"&&W&&M>=l&&(k=Z,I="right",m&&Me("medium")),(w==="left"&&M>0||w==="right"&&M<0)&&(k=0,I=null),T(k),A(I),b==null||b(I),setTimeout(()=>E(!1),300)},[M,H,Z,i,_,W,w,m,b]),h=e.useCallback((a,l)=>{a.onClick(),N==null||N(a,l),m&&Me("heavy"),$()},[N,m,$]),v=e.useCallback(a=>{a.key==="Escape"&&w&&$()},[w,$]),x=e.useCallback(a=>{O.current=a,typeof p=="function"?p(a):p&&(p.current=a)},[p]);return t.jsxs("div",{ref:x,className:`nice-swipe-container ${j} ${w?`nice-swipe-container--open-${w}`:""}`,style:R,onKeyDown:v,tabIndex:0,role:"listitem","aria-label":w?`Swipe actions ${w} visible`:"Swipe for actions","data-disabled":y||void 0,children:[s.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--left",style:{width:Z},children:s.map((a,l)=>t.jsx(et,{action:a,width:c,progress:J,index:l,total:s.length,side:"right",onTrigger:()=>h(a,"right")},a.id))}),t.jsx("div",{className:"nice-swipe-content",style:{transform:`translateX(${M}px)`,transition:Y?"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none"},onTouchStart:z,onTouchMove:F,onTouchEnd:V,children:n}),r.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--right",style:{width:Math.abs(H)},children:r.map((a,l)=>t.jsx(et,{action:a,width:c,progress:K,index:l,total:r.length,side:"left",onTrigger:()=>h(a,"left")},a.id))})]})});yt.displayName="NiceSwipeActions";const an=({children:n,className:r="",style:s})=>t.jsx(pt,{children:t.jsx("div",{className:`nice-swipe-list ${r}`,style:s,role:"list",children:n})}),ln={delete:n=>({id:"delete",label:"Delete",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"3 6 5 6 21 6"}),t.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),background:"var(--color-error, #ef4444)",destructive:!0,onClick:n}),edit:n=>({id:"edit",label:"Edit",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),t.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),background:"var(--color-primary, #3b82f6)",onClick:n}),archive:n=>({id:"archive",label:"Archive",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"21 8 21 21 3 21 3 8"}),t.jsx("rect",{x:"1",y:"3",width:"22",height:"5"}),t.jsx("line",{x1:"10",y1:"12",x2:"14",y2:"12"})]}),background:"var(--text-muted, #6b7280)",onClick:n}),star:n=>({id:"star",label:"Star",icon:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),background:"var(--color-warning, #eab308)",onClick:n}),share:n=>({id:"share",label:"Share",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"18",cy:"5",r:"3"}),t.jsx("circle",{cx:"6",cy:"12",r:"3"}),t.jsx("circle",{cx:"18",cy:"19",r:"3"}),t.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),t.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),background:"var(--color-success, #22c55e)",onClick:n}),pin:n=>({id:"pin",label:"Pin",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"22"}),t.jsx("path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"})]}),background:"var(--color-accent, #8b5cf6)",onClick:n}),mute:n=>({id:"mute",label:"Mute",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),t.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),t.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),background:"var(--text-muted, #64748b)",onClick:n}),reply:n=>({id:"reply",label:"Reply",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"9 17 4 12 9 7"}),t.jsx("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"})]}),background:"var(--color-info, #0ea5e9)",onClick:n})};function tt(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function on(n,r,s){return n==="full"?r*.95:n==="content"?Math.min(s,r*.9):r*n/100}const wt=e.forwardRef(({children:n,open:r,onClose:s,onSnapChange:c,snapPoints:i=[50,100],initialSnap:o=0,header:d,footer:u,showHandle:b=!0,showBackdrop:N=!0,closeOnBackdrop:y=!0,closeOnEscape:j=!0,dismissible:R=!0,velocityThreshold:f=.5,hapticFeedback:m=!0,handleColor:p,borderRadius:S=16,zIndex:M=1e3,className:T="",style:w,ariaLabel:A="Bottom sheet"},Y)=>{const[E,O]=e.useState(o),[L,g]=e.useState(0),[D,C]=e.useState(!1),[B,P]=e.useState(typeof window<"u"?window.innerHeight:800),[H,Z]=e.useState(400),_=e.useRef(null),W=e.useRef(null),K=e.useRef(0),J=e.useRef(0),ee=e.useRef(0),$=e.useRef(0),z=e.useRef(0),F=e.useRef(-1),V=i.map(q=>on(q,B,H)),h=V[E]??V[0];e.useImperativeHandle(Y,()=>({snapTo:q=>{q>=0&&q<i.length&&(O(q),g(0),c==null||c(q,V[q]))},close:()=>s(),getCurrentSnap:()=>E})),e.useEffect(()=>{const q=()=>{P(window.innerHeight)};return window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]),e.useEffect(()=>{if(W.current&&r){const q=W.current.scrollHeight;Z(q+60)}},[r,n]),e.useEffect(()=>{if(!r||!j)return;const q=se=>{se.key==="Escape"&&s()};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[r,j,s]),e.useEffect(()=>{if(r){const q=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=q}}},[r]);const v=e.useCallback(q=>{const se=B-h+q,ne=B-se;for(let ie=0;ie<V.length;ie++){const ae=V[ie];if(Math.abs(ne-ae)<20&&F.current!==ie){F.current=ie,m&&tt("light");break}}},[B,h,V,m]),x=e.useCallback((q,se)=>{if(se>f*2&&R&&q<V[0]*.5)return-1;if(se<-f)return V.length-1;if(se>f)return R&&q<V[0]*.7?-1:0;let ne=0,ie=Math.abs(q-V[0]);for(let ae=1;ae<V.length;ae++){const re=Math.abs(q-V[ae]);re<ie&&(ie=re,ne=ae)}return R&&q<V[0]*.5?-1:ne},[V,f,R]),a=e.useCallback(q=>{K.current=q.touches[0].clientY,J.current=L,ee.current=q.touches[0].clientY,$.current=Date.now(),z.current=0,F.current=-1,C(!0)},[L]),l=e.useCallback(q=>{if(!D)return;const se=q.touches[0].clientY,ne=se-K.current,ie=Date.now(),ae=ie-$.current;ae>0&&(z.current=(se-ee.current)/ae),ee.current=se,$.current=ie;let re=J.current+ne;const oe=h+50;if(re>oe){const Q=re-oe;re=oe+Q*.2}const U=-(B*.95-h);if(re<U){const Q=U-re;re=U-Q*.2}g(re),v(re),q.preventDefault()},[D,h,B,v]),k=e.useCallback(()=>{if(!D)return;C(!1);const q=h-L,se=x(q,z.current);if(se===-1)g(h+100),setTimeout(()=>{s(),g(0),O(o)},300);else{const ne=V[se];g(0),O(se),se!==E&&(c==null||c(se,ne),m&&tt("medium"))}},[D,h,L,x,E,V,s,c,o,m]),I=e.useCallback(()=>{y&&s()},[y,s]);if(!r)return null;const G=Math.max(0,h-L),X=Math.min(.5,G/B*.8);return t.jsxs("div",{className:`nice-bottom-sheet-container ${T}`,style:{zIndex:M},children:[N&&t.jsx("div",{className:"nice-bottom-sheet-backdrop",style:{opacity:X},onClick:I,"aria-hidden":"true"}),t.jsxs("div",{ref:_,className:`nice-bottom-sheet ${D?"nice-bottom-sheet--dragging":""}`,style:{...w,height:G,borderTopLeftRadius:S,borderTopRightRadius:S,transition:D?"none":"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},role:"dialog","aria-modal":"true","aria-label":A,children:[b&&t.jsx("div",{className:"nice-bottom-sheet-handle",onTouchStart:a,onTouchMove:l,onTouchEnd:k,children:t.jsx("div",{className:"nice-bottom-sheet-handle-bar",style:p?{backgroundColor:p}:void 0})}),d&&t.jsx("div",{className:"nice-bottom-sheet-header",children:d}),t.jsx("div",{ref:W,className:"nice-bottom-sheet-content",onTouchStart:a,onTouchMove:l,onTouchEnd:k,children:n}),u&&t.jsx("div",{className:"nice-bottom-sheet-footer",children:u})]})]})});wt.displayName="NiceBottomSheet";function un(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function nt(n,r){return Math.hypot(r.x-n.x,r.y-n.y)}function rt(n,r){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}const kt=e.forwardRef(({items:n,selectedIndex:r=0,onIndexChange:s,onClose:c,showClose:i=!0,showCounter:o=!0,showCaption:d=!0,showThumbnails:u=!1,enablePinchZoom:b=!0,enableDoubleTapZoom:N=!0,enableSwipe:y=!0,enableKeyboard:j=!0,minZoom:R=1,maxZoom:f=4,doubleTapZoom:m=2.5,swipeThreshold:p=50,loop:S=!0,hapticFeedback:M=!0,backgroundColor:T="var(--nice-overlay-95, rgba(0, 0, 0, 0.95))",zIndex:w=2e3,className:A="",style:Y},E)=>{const[O,L]=e.useState(r),[g,D]=e.useState(1),[C,B]=e.useState(0),[P,H]=e.useState(0),[Z,_]=e.useState(!1),[W,K]=e.useState({}),J=e.useRef(null),ee=e.useRef(null),$=e.useRef([]),z=e.useRef(0),F=e.useRef(1),V=e.useRef({x:0,y:0}),h=e.useRef(0),v=e.useRef({x:0,y:0}),x=e.useRef(!1),a=e.useRef(!1),l=e.useRef(null),k=n[O],I=e.useCallback(U=>{let Q=U;S?Q=(U%n.length+n.length)%n.length:Q=Math.max(0,Math.min(n.length-1,U)),Q!==O&&(_(!0),L(Q),D(1),B(0),H(0),s==null||s(Q,n[Q]),M&&un("light"),setTimeout(()=>_(!1),300))},[O,n,S,s,M]),G=e.useCallback(()=>I(O+1),[I,O]),X=e.useCallback(()=>I(O-1),[I,O]),q=e.useCallback((U,Q,te)=>{const ce=Math.max(R,Math.min(f,U));D(ce),ce<=1&&(B(0),H(0))},[R,f]),se=e.useCallback(()=>q(g*1.5),[g,q]),ne=e.useCallback(()=>q(g/1.5),[g,q]),ie=e.useCallback(()=>{D(1),B(0),H(0)},[]);e.useImperativeHandle(E,()=>({goTo:I,goNext:G,goPrev:X,zoomIn:se,zoomOut:ne,resetZoom:ie,close:()=>c==null?void 0:c()})),e.useEffect(()=>{if(!j)return;const U=Q=>{switch(Q.key){case"ArrowLeft":X();break;case"ArrowRight":G();break;case"ArrowUp":se();break;case"ArrowDown":ne();break;case"Escape":c==null||c();break;case"0":case"Home":ie();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[j,G,X,se,ne,ie,c]);const ae=e.useCallback(U=>{const Q=Array.from(U.touches).map(te=>({x:te.clientX,y:te.clientY,id:te.identifier}));if($.current=Q,v.current={x:Q[0].x,y:Q[0].y},a.current=!1,l.current=null,Q.length===2&&b)x.current=!0,z.current=nt(Q[0],Q[1]),F.current=g,V.current={x:C,y:P};else if(Q.length===1){const te=Date.now();te-h.current<300&&N?(g>1.1?ie():q(m,Q[0].x,Q[0].y),h.current=0):h.current=te,V.current={x:C,y:P}}},[g,C,P,b,N,m,ie,q]),re=e.useCallback(U=>{const Q=Array.from(U.touches).map(te=>({x:te.clientX,y:te.clientY,id:te.identifier}));if(Q.length===2&&x.current&&b){const ce=nt(Q[0],Q[1])/z.current,ue=F.current*ce;q(ue);const de=rt(Q[0],Q[1]),fe=rt($.current[0],$.current[1]||$.current[0]),he=de.x-fe.x,Ae=de.y-fe.y;B(V.current.x+he),H(V.current.y+Ae),U.preventDefault()}else if(Q.length===1){const te=Q[0].x-v.current.x,ce=Q[0].y-v.current.y;if(l.current||(Math.abs(te)>10||Math.abs(ce)>10)&&(l.current=Math.abs(te)>Math.abs(ce)?"horizontal":"vertical",a.current=!0),g>1.1){const ue=V.current.x+te,de=V.current.y+ce;B(ue),H(de)}U.preventDefault()}},[g,b,q]),oe=e.useCallback(U=>{if(x.current){x.current=!1;return}const Q=U.changedTouches[0],te=Q.clientX-v.current.x;Q.clientY-v.current.y,y&&g<=1.1&&l.current==="horizontal"&&(te>p?X():te<-p&&G()),g<=1.1&&(B(0),H(0)),a.current=!1,l.current=null},[g,y,p,G,X]);return e.useEffect(()=>{n.forEach((U,Q)=>{const te=new Image;te.onload=()=>{K(ce=>({...ce,[Q]:!0}))},te.src=U.src})},[n]),n.length===0?null:t.jsxs("div",{ref:J,className:`nice-image-gallery ${A}`,style:{...Y,backgroundColor:T,zIndex:w},role:"dialog","aria-modal":"true","aria-label":"Image gallery",children:[t.jsxs("div",{className:"nice-image-gallery-header",children:[o&&t.jsxs("span",{className:"nice-image-gallery-counter",children:[O+1," / ",n.length]}),t.jsxs("div",{className:"nice-image-gallery-actions",children:[t.jsx("button",{className:"nice-image-gallery-btn",onClick:ne,disabled:g<=R,"aria-label":"Zoom out",children:"−"}),t.jsx("button",{className:"nice-image-gallery-btn",onClick:se,disabled:g>=f,"aria-label":"Zoom in",children:"+"}),i&&t.jsx("button",{className:"nice-image-gallery-btn nice-image-gallery-close",onClick:c,"aria-label":"Close",children:"×"})]})]}),t.jsxs("div",{className:"nice-image-gallery-viewport",onTouchStart:ae,onTouchMove:re,onTouchEnd:oe,children:[t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--prev",onClick:X,disabled:!S&&O===0,"aria-label":"Previous image",children:"‹"}),t.jsxs("div",{className:"nice-image-gallery-image-container",children:[k.placeholder&&!W[O]&&t.jsx("div",{className:"nice-image-gallery-placeholder",style:{backgroundColor:k.placeholder}}),t.jsx("img",{ref:ee,src:k.src,alt:k.alt||k.title||"",className:`nice-image-gallery-image ${Z?"nice-image-gallery-image--animating":""}`,style:{transform:`scale(${g}) translate(${C/g}px, ${P/g}px)`,transition:x.current||a.current?"none":"transform 0.2s ease-out"},draggable:!1})]}),t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--next",onClick:G,disabled:!S&&O===n.length-1,"aria-label":"Next image",children:"›"})]}),d&&k.title&&t.jsxs("div",{className:"nice-image-gallery-caption",children:[t.jsx("h3",{children:k.title}),k.description&&t.jsx("p",{children:k.description})]}),u&&n.length>1&&t.jsx("div",{className:"nice-image-gallery-thumbnails",children:n.map((U,Q)=>t.jsx("button",{className:`nice-image-gallery-thumb ${Q===O?"nice-image-gallery-thumb--active":""}`,onClick:()=>I(Q),"aria-label":`Go to image ${Q+1}`,children:t.jsx("img",{src:U.thumbnail||U.src,alt:U.alt||"",loading:"lazy"})},Q))}),!u&&n.length>1&&n.length<=10&&t.jsx("div",{className:"nice-image-gallery-dots",children:n.map((U,Q)=>t.jsx("button",{className:`nice-image-gallery-dot ${Q===O?"nice-image-gallery-dot--active":""}`,onClick:()=>I(Q),"aria-label":`Go to image ${Q+1}`},Q))})]})});kt.displayName="NiceImageGallery";const jt=e.createContext(null);function dn(){const n=e.useContext(jt);if(!n)throw new Error("useInfiniteScroll must be used within NiceInfiniteScroll");return n}const st=()=>t.jsxs("div",{className:"nice-infinite-loading",children:[t.jsx("div",{className:"nice-infinite-spinner",children:t.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[t.jsx("circle",{className:"nice-infinite-spinner-track",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"3"}),t.jsx("circle",{className:"nice-infinite-spinner-fill",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"3",strokeDasharray:"60",strokeLinecap:"round"})]})}),t.jsx("span",{className:"nice-infinite-loading-text",children:"Loading..."})]}),fn=()=>t.jsxs("div",{className:"nice-infinite-end",children:[t.jsx("span",{className:"nice-infinite-end-line"}),t.jsx("span",{className:"nice-infinite-end-text",children:"You've reached the end"}),t.jsx("span",{className:"nice-infinite-end-line"})]}),hn=({message:n,onRetry:r})=>t.jsxs("div",{className:"nice-infinite-error",role:"alert",children:[t.jsxs("svg",{className:"nice-infinite-error-icon",viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),t.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),t.jsx("span",{className:"nice-infinite-error-text",children:n}),r&&t.jsx("button",{className:"nice-infinite-error-retry",onClick:r,"aria-label":"Retry loading",children:"Retry"})]}),vn=()=>t.jsxs("div",{className:"nice-infinite-empty",children:[t.jsx("svg",{className:"nice-infinite-empty-icon",viewBox:"0 0 24 24",width:"48",height:"48",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:t.jsx("path",{d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),t.jsx("p",{className:"nice-infinite-empty-text",children:"No items to display"})]}),bn=({visible:n,onClick:r})=>t.jsx("button",{className:`nice-infinite-scroll-top ${n?"nice-infinite-scroll-top--visible":""}`,onClick:r,"aria-label":"Scroll to top",children:t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"18 15 12 9 6 15"})})});function mn({items:n,renderItem:r,onLoadMore:s,hasMore:c,isLoading:i=!1,error:o=null,threshold:d=200,loadingIndicator:u,endIndicator:b,errorIndicator:N,onRetry:y,pullToRefresh:j=!1,onRefresh:R,direction:f="vertical",reverse:m=!1,initialScrollPosition:p="top",keyboardNav:S=!0,keyExtractor:M,emptyContent:T,header:w,footer:A,gap:Y=0,className:E="",style:O,ariaLabel:L="Scrollable list"},g){const[D,C]=e.useState("idle"),[B,P]=e.useState(!1),[H,Z]=e.useState(!1),_=e.useRef(null),W=e.useRef(null),K=e.useRef(!1),J=e.useRef(null);e.useEffect(()=>{o?C("error"):i?C("loading"):!c&&n.length>0?C("end"):C("idle")},[o,i,c,n.length]);const ee=e.useCallback((a,l)=>M?M(a,l):`item-${l}`,[M]),$=e.useCallback(async()=>{if(!(K.current||!c||o)){K.current=!0;try{await s()}finally{K.current=!1}}},[c,o,s]),z=e.useCallback(()=>{var a;(a=_.current)==null||a.scrollTo({top:0,behavior:"smooth"})},[]),F=e.useCallback(()=>{_.current&&_.current.scrollTo({top:_.current.scrollHeight,behavior:"smooth"})},[]);e.useEffect(()=>{if(!W.current)return;const a=l=>{const[k]=l;k.isIntersecting&&c&&!i&&!o&&$()};return J.current=new IntersectionObserver(a,{root:_.current,rootMargin:`${d}px`,threshold:.1}),J.current.observe(W.current),()=>{var l;(l=J.current)==null||l.disconnect()}},[c,i,o,d,$]),e.useEffect(()=>{const a=_.current;if(!a)return;const l=()=>{const k=f==="vertical"?a.scrollTop:a.scrollLeft;P(k>500)};return a.addEventListener("scroll",l,{passive:!0}),()=>a.removeEventListener("scroll",l)},[f]),e.useEffect(()=>{p==="bottom"&&_.current&&(_.current.scrollTop=_.current.scrollHeight)},[p]);const V=e.useCallback(a=>{S&&(a.key==="Home"?(a.preventDefault(),z()):a.key==="End"&&(a.preventDefault(),F()))},[S,z,F]);e.useCallback(async()=>{if(!(!R||H)){Z(!0);try{await R()}finally{Z(!1)}}},[R,H]);const h=e.useCallback(a=>{_.current=a,typeof g=="function"?g(a):g&&(g.current=a)},[g]),v=e.useMemo(()=>({status:D,loadMore:$,hasMore:c,itemCount:n.length,scrollToTop:z,scrollToBottom:F}),[D,$,c,n.length,z,F]),x=e.useMemo(()=>(m?[...n].reverse():n).map((l,k)=>t.jsx("div",{className:"nice-infinite-item","data-index":k,children:r(l,k)},ee(l,k))),[n,m,ee,r]);return n.length===0&&!i&&!o?t.jsx("div",{ref:h,className:`nice-infinite-container nice-infinite-container--empty ${E}`,style:O,role:"region","aria-label":L,children:T||t.jsx(vn,{})}):t.jsx(jt.Provider,{value:v,children:t.jsxs("div",{ref:h,className:`nice-infinite-container nice-infinite-container--${f} ${m?"nice-infinite-container--reverse":""} ${E}`,style:O,onKeyDown:V,tabIndex:0,role:"feed","aria-label":L,"aria-busy":i,children:[w&&t.jsx("div",{className:"nice-infinite-header",children:w}),j&&H&&t.jsx("div",{className:"nice-infinite-pull",children:u||t.jsx(st,{})}),t.jsx("div",{className:"nice-infinite-items",style:{gap:Y},children:x}),t.jsx("div",{ref:W,className:"nice-infinite-sentinel","aria-hidden":"true"}),D==="loading"&&(u||t.jsx(st,{})),D==="error"&&o&&(N||t.jsx(hn,{message:o,onRetry:y})),D==="end"&&(b||t.jsx(fn,{})),A&&t.jsx("div",{className:"nice-infinite-footer",children:A}),t.jsx(bn,{visible:B,onClick:z})]})})}const xn=e.forwardRef(mn);function pn(n){const{fetchPage:r,initialCursor:s,refetchOnFocus:c=!1}=n,[i,o]=e.useState([]),[d,u]=e.useState(s),[b,N]=e.useState(!1),[y,j]=e.useState(null),[R,f]=e.useState(!0),[m,p]=e.useState(!1),S=e.useCallback(async()=>{if(!(b||!R)){N(!0),j(null);try{const w=await r(d);o(A=>[...A,...w.items]),u(w.nextCursor),f(w.hasMore),p(!0)}catch(w){j(w instanceof Error?w.message:"Failed to load data")}finally{N(!1)}}},[r,d,b,R]),M=e.useCallback(async()=>{o([]),u(s),f(!0),j(null),N(!0);try{const w=await r(s);o(w.items),u(w.nextCursor),f(w.hasMore)}catch(w){j(w instanceof Error?w.message:"Failed to refresh data")}finally{N(!1)}},[r,s]),T=e.useCallback(()=>{o([]),u(s),f(!0),j(null),p(!1)},[s]);return e.useEffect(()=>{!m&&!b&&S()},[m,b,S]),e.useEffect(()=>{if(!c)return;const w=()=>{m&&M()};return window.addEventListener("focus",w),()=>window.removeEventListener("focus",w)},[c,m,M]),{items:i,isLoading:b,error:y,hasMore:R,loadMore:S,refresh:M,reset:T}}function gn(n){const{itemCount:r,itemHeight:s,overscan:c=5,containerRef:i}=n,[o,d]=e.useState(0),[u,b]=e.useState(0),N=e.useCallback(f=>typeof s=="function"?s(f):s,[s]),y=e.useMemo(()=>{let f=0;for(let m=0;m<r;m++)f+=N(m);return f},[r,N]),j=e.useMemo(()=>{const f=[];let m=0,p=-1,S=-1;for(let M=0;M<r;M++){const T=N(M),w=m+T;w>=o&&p===-1&&(p=M),m<=o+u&&(S=M),m=w}p=Math.max(0,p-c),S=Math.min(r-1,S+c),m=0;for(let M=0;M<r;M++){const T=N(M);M>=p&&M<=S&&f.push({index:M,start:m,size:T,end:m+T}),m+=T}return f},[r,N,o,u,c]);e.useEffect(()=>{const f=i.current;if(!f)return;b(f.clientHeight);const m=()=>{d(f.scrollTop)},p=()=>{b(f.clientHeight)};return f.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",p),()=>{f.removeEventListener("scroll",m),window.removeEventListener("resize",p)}},[i]);const R=e.useCallback(f=>{const m=i.current;if(!m)return;let p=0;for(let S=0;S<f&&S<r;S++)p+=N(S);m.scrollTo({top:p,behavior:"smooth"})},[i,r,N]);return{virtualItems:j,totalSize:y,scrollToIndex:R}}const Nt=e.createContext(null);function yn(){const n=e.useContext(Nt);if(!n)throw new Error("useMobileDrawer must be used within NiceMobileDrawer");return n}const Mt=({item:n,depth:r=0,onSelect:s,activeId:c})=>{const[i,o]=e.useState(!1),d=n.children&&n.children.length>0,u=c===n.id;if(n.divider)return t.jsx("div",{className:"nice-drawer-divider"});if(n.section)return t.jsx("div",{className:"nice-drawer-section",children:t.jsx("span",{className:"nice-drawer-section-label",children:n.section})});const b=()=>{n.disabled||(d?o(!i):(s(n),n.onClick&&n.onClick()))};return t.jsxs("div",{className:"nice-drawer-nav-item-wrapper",children:[t.jsxs("button",{className:`nice-drawer-nav-item nice-drawer-nav-item--depth-${r} ${u?"nice-drawer-nav-item--active":""} ${n.disabled?"nice-drawer-nav-item--disabled":""}`,onClick:b,disabled:n.disabled,"aria-expanded":d?i:void 0,"aria-current":u?"page":void 0,style:{paddingLeft:`${16+r*16}px`},children:[n.icon&&t.jsx("span",{className:"nice-drawer-nav-icon",children:n.icon}),t.jsx("span",{className:"nice-drawer-nav-label",children:n.label}),n.badge!==void 0&&t.jsx("span",{className:"nice-drawer-nav-badge",style:{background:n.badgeColor},children:n.badge}),d&&t.jsx("span",{className:`nice-drawer-nav-chevron ${i?"nice-drawer-nav-chevron--expanded":""}`,children:t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),d&&i&&t.jsx("div",{className:"nice-drawer-nav-children",children:n.children.map(N=>t.jsx(Mt,{item:N,depth:r+1,onSelect:s,activeId:c},N.id))})]})},Tt=e.forwardRef(({open:n,onClose:r,position:s="left",variant:c="overlay",size:i,children:o,navItems:d,header:u,footer:b,swipeToOpen:N=!0,swipeToClose:y=!0,edgeSwipeWidth:j=20,velocityThreshold:R=.3,showOverlay:f=!0,closeOnOverlayClick:m=!0,closeOnEscape:p=!0,disableBodyScroll:S=!0,overlayColor:M,zIndex:T=1e3,onNavSelect:w,activeNavId:A,className:Y="",style:E,ariaLabel:O="Navigation drawer"},L)=>{const[g,D]=e.useState(0),[C,B]=e.useState(!1),[P,H]=e.useState(A),Z=e.useRef(null),_=e.useRef({x:0,y:0}),W=e.useRef(0),K=e.useRef({x:0,y:0}),J=s==="left"||s==="right",$=i??(J?280:400);e.useEffect(()=>{A!==void 0&&H(A)},[A]),e.useEffect(()=>{if(S&&n){const l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}}},[n,S]),e.useEffect(()=>{if(!p||!n)return;const l=k=>{k.key==="Escape"&&r()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[p,n,r]),e.useEffect(()=>{if(!n||!Z.current)return;const l=Z.current,k=l.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),I=k[0],G=k[k.length-1],X=q=>{q.key==="Tab"&&(q.shiftKey&&document.activeElement===I?(q.preventDefault(),G==null||G.focus()):!q.shiftKey&&document.activeElement===G&&(q.preventDefault(),I==null||I.focus()))};return l.addEventListener("keydown",X),I==null||I.focus(),()=>l.removeEventListener("keydown",X)},[n]);const z=e.useCallback(()=>{let l=0;const k=g;if(!n)switch(s){case"left":l=-100;break;case"right":l=100;break;case"top":l=-100;break;case"bottom":l=100;break}return J?`translateX(calc(${l}% + ${k}px))`:`translateY(calc(${l}% + ${k}px))`},[n,s,g,J]),F=e.useCallback(l=>{if(!y&&n)return;const k=l.touches[0];_.current={x:k.clientX,y:k.clientY},K.current={x:k.clientX,y:k.clientY},W.current=Date.now()},[y,n]),V=e.useCallback(l=>{if(!y||!n)return;const k=l.touches[0],I=k.clientX-_.current.x,G=k.clientY-_.current.y;let X=!1,q=0;switch(s){case"left":X=I<0,q=Math.min(0,I);break;case"right":X=I>0,q=Math.max(0,I);break;case"top":X=G<0,q=Math.min(0,G);break;case"bottom":X=G>0,q=Math.max(0,G);break}X&&Math.abs(J?I:G)>10&&(B(!0),D(q),K.current={x:k.clientX,y:k.clientY},l.preventDefault())},[y,n,s,J]),h=e.useCallback(()=>{if(!C)return;const l=Date.now()-W.current,k=Math.abs(g),I=typeof $=="number"?$:280,G=k/l;(k>I*.3||G>R)&&r(),B(!1),D(0)},[C,g,$,R,J,r]);e.useEffect(()=>{if(!N||n)return;let l=0,k=0,I=!1;const G=q=>{const se=q.touches[0];l=se.clientX,k=se.clientY;const ne=window.innerWidth,ie=window.innerHeight;switch(s){case"left":I=l<j;break;case"right":I=l>ne-j;break;case"top":I=k<j;break;case"bottom":I=k>ie-j;break}},X=q=>{if(!I)return;const se=q.touches[0],ne=se.clientX-l,ie=se.clientY-k,ae=50;let re=!1;switch(s){case"left":re=ne>ae;break;case"right":re=ne<-ae;break;case"top":re=ie>ae;break;case"bottom":re=ie<-ae;break}re&&q.preventDefault()};return document.addEventListener("touchstart",G,{passive:!0}),document.addEventListener("touchmove",X,{passive:!1}),()=>{document.removeEventListener("touchstart",G),document.removeEventListener("touchmove",X)}},[N,n,s,j]);const v=e.useCallback(l=>{H(l.id),w==null||w(l),l.href&&r()},[w,r]),x=e.useCallback(l=>{Z.current=l,typeof L=="function"?L(l):L&&(L.current=l)},[L]),a=e.useMemo(()=>({isOpen:n,position:s,close:r,activeNavId:P,setActiveNavId:H}),[n,s,r,P]);return t.jsxs(Nt.Provider,{value:a,children:[f&&c!=="persistent"&&t.jsx("div",{className:`nice-drawer-overlay ${n?"nice-drawer-overlay--visible":""}`,style:{zIndex:T-1,background:M,opacity:C?1-Math.abs(g)/(typeof $=="number"?$:280):void 0},onClick:m?r:void 0,"aria-hidden":"true"}),t.jsxs("div",{ref:x,className:`nice-drawer nice-drawer--${s} nice-drawer--${c} ${n?"nice-drawer--open":""} ${C?"nice-drawer--dragging":""} ${Y}`,style:{...E,[J?"width":"height"]:$,zIndex:T,transform:z()},onTouchStart:F,onTouchMove:V,onTouchEnd:h,role:"dialog","aria-modal":c!=="persistent","aria-label":O,"aria-hidden":!n,children:[u&&t.jsxs("div",{className:"nice-drawer-header",children:[u,t.jsx("button",{className:"nice-drawer-close",onClick:r,"aria-label":"Close drawer",children:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),t.jsx("div",{className:"nice-drawer-content",children:d?t.jsx("nav",{className:"nice-drawer-nav","aria-label":"Main navigation",children:d.map(l=>t.jsx(Mt,{item:l,onSelect:v,activeId:P},l.id))}):o}),b&&t.jsx("div",{className:"nice-drawer-footer",children:b})]})]})});Tt.displayName="NiceMobileDrawer";function wn(n={}){const{defaultOpen:r=!1,onOpenChange:s}=n,[c,i]=e.useState(r),o=e.useCallback(()=>{i(!0),s==null||s(!0)},[s]),d=e.useCallback(()=>{i(!1),s==null||s(!1)},[s]),u=e.useCallback(()=>{i(N=>{const y=!N;return s==null||s(y),y})},[s]),b=e.useCallback(N=>{i(N),s==null||s(N)},[s]);return{isOpen:c,open:o,close:d,toggle:u,setOpen:b}}const kn={home:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),settings:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),user:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),search:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),inbox:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),t.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]}),heart:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),folder:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),help:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),t.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),logout:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),t.jsx("polyline",{points:"16 17 21 12 16 7"}),t.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})},Rt=e.createContext(null);function jn(){const n=e.useContext(Rt);if(!n)throw new Error("useMobileModal must be used within a NiceMobileModal");return n}function Nn(n={}){const{defaultOpen:r=!1,open:s,onOpenChange:c,preventDismiss:i=!1}=n,[o,d]=e.useState(r),u=s!==void 0,b=u?s:o,N=e.useCallback((f,m)=>{!f&&i&&m!=="close"||(u||d(f),c==null||c(f,m))},[u,c,i]),y=e.useCallback(()=>N(!0),[N]),j=e.useCallback(f=>N(!1,f),[N]),R=e.useCallback(()=>N(!b),[N,b]);return{open:b,openModal:y,closeModal:j,toggle:R,setOpen:f=>N(f)}}const Mn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});function Tn(n,r,s){return n==="content"?Math.min(s,r):n==="full"?r:n<=1?r*n:Math.min(n,r)}function Rn(n,r,s){return Math.min(Math.max(n,r),s)}const _e=e.forwardRef(function({open:r,onClose:s,title:c,children:i,footer:o,snapPoints:d=["content"],defaultSnapPoint:u=0,showHandle:b=!0,showClose:N=!0,showOverlay:y=!0,dismissOnDrag:j=!0,dismissOnOverlay:R=!0,dismissOnEscape:f=!0,preventDismiss:m=!1,onSnapChange:p,className:S="",overlayClassName:M="",headerClassName:T="",contentClassName:w="",footerClassName:A="",lockScroll:Y=!0,borderRadius:E=16,zIndex:O,style:L,...g},D){const B=`${e.useId()}-title`,P=e.useRef(null),H=e.useRef(null),Z=e.useRef(0),_=e.useRef(0),W=e.useRef(!1),[K,J]=e.useState(u),[ee,$]=e.useState(0),[z,F]=e.useState(400),[V,h]=e.useState(typeof window<"u"?window.innerHeight:800),[v,x]=e.useState(!1),a=d.map(U=>Tn(U,V,z));e.useEffect(()=>{if(typeof window>"u")return;const U=()=>{h(window.innerHeight)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),e.useEffect(()=>{if(!H.current||!r)return;const U=new ResizeObserver(Q=>{for(const te of Q){const ce=te.contentRect.height+100;F(Math.min(ce,V*.9))}});return U.observe(H.current),()=>U.disconnect()},[r,V]),e.useEffect(()=>{if(r){const U=a[u]||a[0]||V*.5;$(U),J(u)}},[r]),e.useEffect(()=>{if(r&&!v){const U=a[K]||a[0];$(U)}},[a.join(","),K,v,r]),e.useEffect(()=>{if(!Y||!r)return;const U=document.body.style.overflow,Q=document.body.style.paddingRight,te=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",te>0&&(document.body.style.paddingRight=`${te}px`),()=>{document.body.style.overflow=U,document.body.style.paddingRight=Q}},[r,Y]),e.useEffect(()=>{if(!r||!f||m)return;const U=Q=>{Q.key==="Escape"&&(s==null||s("escape"))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[r,f,m,s]),e.useEffect(()=>{if(!r||!P.current)return;const Q=P.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),te=Q[0],ce=Q[Q.length-1],ue=de=>{de.key==="Tab"&&(de.shiftKey?document.activeElement===te&&(de.preventDefault(),ce==null||ce.focus()):document.activeElement===ce&&(de.preventDefault(),te==null||te.focus()))};return document.addEventListener("keydown",ue),requestAnimationFrame(()=>{te==null||te.focus()}),()=>document.removeEventListener("keydown",ue)},[r]);const l=e.useCallback(U=>{m&&U!=="close"||s==null||s(U)},[m,s]),k=e.useCallback(()=>{R&&l("overlay")},[R,l]),I=e.useCallback((U,Q)=>{if(Q>.5&&j&&!m)return-1;if(Q<-.5)return a.length-1;let te=0,ce=Math.abs(a[0]-U);for(let ue=1;ue<a.length;ue++){const de=Math.abs(a[ue]-U);de<ce&&(ce=de,te=ue)}return te},[a,j,m]),G=e.useCallback(U=>{W.current=!0,Z.current=U,_.current=ee,x(!0)},[ee]),X=e.useCallback(U=>{if(!W.current)return;const Q=Z.current-U,te=Rn(_.current+Q,50,V);$(te)},[V]),q=e.useCallback((U,Q)=>{if(!W.current)return;W.current=!1,x(!1);const te=I(ee,Q);if(te===-1){l("drag");return}J(te),$(a[te]),p==null||p(te,d[te])},[ee,I,l,a,d,p]),se=U=>{G(U.touches[0].clientY)},ne=U=>{X(U.touches[0].clientY)},ie=U=>{const Q=U.changedTouches[0],te=(Z.current-Q.clientY)/(U.timeStamp-(U.timeStamp-200));q(Q.clientY,te>0?-te/1e3:te/1e3)},ae=U=>{U.preventDefault(),G(U.clientY);const Q=ce=>{X(ce.clientY)},te=ce=>{const ue=(Z.current-ce.clientY)/200;q(ce.clientY,ue>0?-ue/500:ue/500),document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",te)};document.addEventListener("mousemove",Q),document.addEventListener("mouseup",te)},re=e.useCallback(U=>{U<0||U>=a.length||(J(U),$(a[U]),p==null||p(U,d[U]))},[a,d,p]),oe={isOpen:r,snapPoints:d,currentSnapIndex:K,setSnapIndex:re,close:l};return r?t.jsxs(t.Fragment,{children:[y&&t.jsx("div",{className:`nice-mobile-modal-overlay nice-mobile-modal-overlay--visible ${M}`,onClick:k,"aria-hidden":"true",style:{zIndex:O?O-1:void 0}}),t.jsx(Rt.Provider,{value:oe,children:t.jsxs("div",{ref:U=>{P.current=U,typeof D=="function"?D(U):D&&(D.current=U)},role:"dialog","aria-modal":"true","aria-labelledby":c?B:void 0,className:`nice-modal-sheet ${v?"nice-modal-sheet--dragging":""} ${S}`,style:{height:ee,borderTopLeftRadius:E,borderTopRightRadius:E,zIndex:O,...L},...g,children:[b&&t.jsx("div",{className:"nice-modal-handle-area",onTouchStart:se,onTouchMove:ne,onTouchEnd:ie,onMouseDown:ae,children:t.jsx("div",{className:"nice-modal-handle"})}),(c||N)&&t.jsxs("div",{className:`nice-modal-header ${T}`,children:[c&&t.jsx("h2",{id:B,className:"nice-modal-title",children:c}),N&&!m&&t.jsx("button",{type:"button",className:"nice-modal-close",onClick:()=>l("close"),"aria-label":"Close modal",children:t.jsx(Mn,{})})]}),t.jsx("div",{ref:H,className:`nice-modal-content ${w}`,children:i}),o&&t.jsx("div",{className:`nice-modal-footer ${A}`,children:o})]})})]}):null}),Dn=e.forwardRef(function({actions:r,cancelLabel:s="Cancel",onClose:c,...i},o){return t.jsx(_e,{ref:o,onClose:c,showHandle:!0,showClose:!1,snapPoints:["content"],...i,children:t.jsxs("div",{className:"nice-action-sheet",children:[r.map(d=>t.jsxs("button",{type:"button",className:`nice-action-sheet-item ${d.destructive?"nice-action-sheet-item--destructive":""}`,disabled:d.disabled,onClick:()=>{var u;(u=d.onClick)==null||u.call(d),c==null||c("close")},children:[d.icon&&t.jsx("span",{className:"nice-action-sheet-icon",children:d.icon}),d.label]},d.id)),t.jsx("div",{className:"nice-action-sheet-divider"}),t.jsx("button",{type:"button",className:"nice-action-sheet-item nice-action-sheet-item--cancel",onClick:()=>c==null?void 0:c("close"),children:s})]})})}),Sn=e.forwardRef(function({title:r,message:s,confirmLabel:c="Confirm",cancelLabel:i="Cancel",confirmDestructive:o=!1,onConfirm:d,onCancel:u,onClose:b,...N},y){const j=()=>{d==null||d(),b==null||b("close")},R=()=>{u==null||u(),b==null||b("close")};return t.jsx(_e,{ref:y,title:r,onClose:b,showHandle:!0,snapPoints:["content"],footer:t.jsxs("div",{className:"nice-confirm-sheet-buttons",children:[t.jsx("button",{type:"button",className:"nice-confirm-sheet-btn nice-confirm-sheet-btn--cancel",onClick:R,children:i}),t.jsx("button",{type:"button",className:`nice-confirm-sheet-btn nice-confirm-sheet-btn--confirm ${o?"nice-confirm-sheet-btn--destructive":""}`,onClick:j,children:c})]}),...N,children:t.jsx("div",{className:"nice-confirm-sheet-message",children:s})})}),Dt=e.createContext(null);function Cn(){const n=e.useContext(Dt);if(!n)throw new Error("useMobileTabs must be used within a NiceMobileTabs");return n}function Pn(n){var j;const{tabs:r,defaultTab:s,activeTab:c,onChange:i}=n,[o,d]=e.useState(s||((j=r[0])==null?void 0:j.id)||""),u=c!==void 0,b=u?c:o,N=e.useCallback(R=>{const f=r.find(m=>m.id===R);!f||f.disabled||(u||d(R),i==null||i(R))},[r,u,i]),y=e.useCallback(R=>b===R,[b]);return{activeTab:b,setActiveTab:N,tabs:r,isActive:y}}const le={home:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),homeFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})}),search:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),plus:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),heart:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),heartFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})}),user:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),userFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})}),bell:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),t.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),bellFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"})}),cart:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"9",cy:"21",r:"1"}),t.jsx("circle",{cx:"20",cy:"21",r:"1"}),t.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]}),inbox:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),t.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]}),settings:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),more:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"19",cy:"12",r:"1"}),t.jsx("circle",{cx:"5",cy:"12",r:"1"})]})},ct=({content:n,variant:r="count",color:s})=>{if(n===void 0||n===!1)return null;if(n===!0||r==="dot")return t.jsx("span",{className:"nice-tab-badge nice-tab-badge--dot",style:s?{backgroundColor:s}:void 0});const c=typeof n=="number"&&n>99?"99+":n;return t.jsx("span",{className:"nice-tab-badge nice-tab-badge--count",style:s?{backgroundColor:s}:void 0,children:c})},it=({tab:n,isActive:r,showLabel:s,animation:c,activeColor:i,inactiveColor:o,onClick:d})=>{const u=e.useRef(null);e.useEffect(()=>{if(!u.current||c==="none")return;const y=u.current;c==="scale"&&r&&(y.style.transform="scale(1.2)",setTimeout(()=>{y.style.transform="scale(1)"},150))},[r,c]);const b=r&&n.activeIcon?n.activeIcon:n.icon,N={};return r&&i?N.color=i:!r&&o&&(N.color=o),n.href?t.jsxs("a",{href:n.href,className:`nice-tab-button ${r?"nice-tab-button--active":""} ${n.disabled?"nice-tab-button--disabled":""} ${n.className||""}`,style:N,"aria-current":r?"page":void 0,onClick:y=>{var j;if(n.disabled){y.preventDefault();return}(j=n.onClick)==null||j.call(n),d()},children:[t.jsx("span",{ref:u,className:"nice-tab-icon",children:b}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(ct,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]}):t.jsxs("button",{type:"button",className:`nice-tab-button ${r?"nice-tab-button--active":""} ${n.disabled?"nice-tab-button--disabled":""} ${n.className||""}`,style:N,disabled:n.disabled,"aria-pressed":r,onClick:()=>{var y;(y=n.onClick)==null||y.call(n),d()},children:[t.jsx("span",{ref:u,className:"nice-tab-icon",children:b}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(ct,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]})},$n=e.forwardRef(function({tabs:r,activeTab:s,defaultTab:c,onChange:i,showLabels:o=!0,showAllLabels:d=!0,position:u="bottom",variant:b="default",haptic:N=!0,animation:y="scale",maxTabs:j,moreLabel:R="More",moreIcon:f=le.more,safeArea:m=!0,activeColor:p,inactiveColor:S,backgroundColor:M,hideOnScroll:T="none",lockScroll:w=!0,className:A="",style:Y,...E},O){var ee;const[L,g]=e.useState(c||((ee=r[0])==null?void 0:ee.id)||""),[D,C]=e.useState(!1),B=e.useRef(0),P=s!==void 0,H=P?s:L;e.useEffect(()=>{if(T==="none"||typeof window>"u")return;const $=()=>{const z=window.scrollY,F=z>B.current?"down":"up";F===T&&z>50?C(!0):F!==T&&C(!1),B.current=z};return window.addEventListener("scroll",$,{passive:!0}),()=>window.removeEventListener("scroll",$)},[T]);const Z=e.useCallback($=>{const z=r.find(F=>F.id===$);!z||z.disabled||(N&&"vibrate"in navigator&&navigator.vibrate(10),P||g($),i==null||i($))},[r,N,P,i]),_=j&&r.length>j?r.slice(0,j-1):r,W=j&&r.length>j?r.slice(j-1):[],K={activeTab:H,setActiveTab:Z,tabs:r},J={...Y};return M&&(J.backgroundColor=M),t.jsx(Dt.Provider,{value:K,children:t.jsxs("nav",{ref:O,className:`nice-mobile-tabs nice-mobile-tabs--${u} nice-mobile-tabs--${b} ${m?"nice-mobile-tabs--safe-area":""} ${D?"nice-mobile-tabs--hidden":""} ${A}`,style:J,role:"tablist","aria-label":"Main navigation",...E,children:[_.map($=>{const z=$.id===H,F=d||o&&z;return t.jsx(it,{tab:$,isActive:z,showLabel:F,animation:y,activeColor:p,inactiveColor:S,onClick:()=>Z($.id)},$.id)}),W.length>0&&t.jsx(it,{tab:{id:"__more__",label:R,icon:f,badge:W.some($=>$.badge)?!0:void 0},isActive:W.some($=>$.id===H),showLabel:d||o,animation:y,activeColor:p,inactiveColor:S,onClick:()=>{console.log("Open more menu",W)}})]})})}),In={basic:[{id:"home",label:"Home",icon:le.home,activeIcon:le.homeFilled},{id:"search",label:"Search",icon:le.search},{id:"notifications",label:"Alerts",icon:le.bell,activeIcon:le.bellFilled},{id:"profile",label:"Profile",icon:le.user,activeIcon:le.userFilled}],social:[{id:"feed",label:"Feed",icon:le.home,activeIcon:le.homeFilled},{id:"discover",label:"Discover",icon:le.search},{id:"create",label:"Create",icon:le.plus},{id:"activity",label:"Activity",icon:le.heart,activeIcon:le.heartFilled},{id:"profile",label:"Profile",icon:le.user,activeIcon:le.userFilled}],ecommerce:[{id:"shop",label:"Shop",icon:le.home,activeIcon:le.homeFilled},{id:"search",label:"Search",icon:le.search},{id:"cart",label:"Cart",icon:le.cart},{id:"favorites",label:"Wishlist",icon:le.heart,activeIcon:le.heartFilled},{id:"account",label:"Account",icon:le.user,activeIcon:le.userFilled}],messaging:[{id:"chats",label:"Chats",icon:le.inbox},{id:"calls",label:"Calls",icon:le.bell},{id:"contacts",label:"Contacts",icon:le.user,activeIcon:le.userFilled},{id:"settings",label:"Settings",icon:le.settings}]},St=e.createContext(null);function En(){const n=e.useContext(St);if(!n)throw new Error("useMobileHeader must be used within a NiceMobileHeader");return n}function Ln(n={}){const{collapsedHeight:r=56,expandedHeight:s=200,scrollElement:c,mode:i="scroll",threshold:o=0}=n,[d,u]=e.useState(0),[b,N]=e.useState(!0),y=e.useRef(null),j=e.useRef(0),R=e.useRef(!1),f=s-r,m=s-d*f,p=d>=1;e.useEffect(()=>{const T=c||y.current||window,w=()=>{R.current||(R.current=!0,requestAnimationFrame(()=>{const A=T===window?window.scrollY:T.scrollTop,Y=A-j.current;if(i==="scroll"||i==="exitUntilCollapsed"){const E=Math.min(1,Math.max(0,(A-o)/f));u(E)}if(i==="enterAlways"){Y>5&&A>o?N(!1):Y<-5&&N(!0);const E=Math.min(1,Math.max(0,A/f));u(E)}j.current=A,R.current=!1}))};return T.addEventListener("scroll",w,{passive:!0}),w(),()=>T.removeEventListener("scroll",w)},[c,i,o,f]);const S=e.useCallback(()=>{u(0),N(!0)},[]),M=e.useCallback(()=>{u(1)},[]);return{progress:d,height:m,isCollapsed:p,isVisible:b,scrollRef:y,expand:S,collapse:M}}const Bn=()=>t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"15 18 9 12 15 6"})}),Hn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),An=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),Yn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"12",cy:"5",r:"1"}),t.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Fn={back:t.jsx(Bn,{}),menu:t.jsx(Hn,{}),search:t.jsx(An,{}),more:t.jsx(Yn,{})},Vn=({action:n})=>t.jsxs("button",{type:"button",className:`nice-header-action ${n.disabled?"nice-header-action--disabled":""}`,onClick:n.onClick,disabled:n.disabled,"aria-label":n.label,title:n.label,children:[n.icon,n.badge!==void 0&&n.badge!==!1&&t.jsx("span",{className:`nice-header-badge ${n.badge===!0?"nice-header-badge--dot":""}`,children:n.badge!==!0&&n.badge})]}),Ie=e.forwardRef(function({title:r,largeTitle:s,subtitle:c,leftAction:i,rightActions:o=[],background:d,mode:u="scroll",variant:b="default",collapsedHeight:N=56,expandedHeight:y=s||d?140:56,parallax:j=!1,parallaxSpeed:R=.5,showShadow:f=!0,sticky:m=!0,zIndex:p=100,scrollElement:S,onCollapseChange:M,safeArea:T=!0,backgroundColor:w,textColor:A,showBorder:Y=!1,collapsedContent:E,expandedContent:O,className:L="",style:g,children:D,...C},B){const[P,H]=e.useState(0),[Z,_]=e.useState(!0),W=e.useRef(null),K=e.useRef(0),J=e.useRef(!1),ee=y-N,$=y-P*ee,z=P>=.9;e.useEffect(()=>{const l=S||window,k=()=>{J.current||(J.current=!0,requestAnimationFrame(()=>{const I=l===window?window.scrollY:l.scrollTop,G=I-K.current;if(u==="scroll"||u==="exitUntilCollapsed"){const X=Math.min(1,Math.max(0,I/ee));H(X),M&&Math.abs(X-P)>.05&&M(X>=.9,X)}if(u==="enterAlways"){G>5&&I>N?_(!1):G<-5&&_(!0);const X=Math.min(1,Math.max(0,I/ee));H(X)}K.current=I,J.current=!1}))};return l.addEventListener("scroll",k,{passive:!0}),k(),()=>l.removeEventListener("scroll",k)},[S,u,ee,N,M,P]);const F=1-P*2,V=P>.5?(P-.5)*2:0,h=1-P,v=j?`translateY(${P*ee*R}px) scale(${1+P*.1})`:void 0,x={height:u==="pin"?N:$,zIndex:p,...g};w&&(x.backgroundColor=w),A&&(x.color=A);const a={progress:P,isCollapsed:z,height:$,expandedHeight:y,collapsedHeight:N};return t.jsxs(St.Provider,{value:a,children:[t.jsxs("header",{ref:l=>{W.current=l,typeof B=="function"?B(l):B&&(B.current=l)},className:`
1
+ "use strict";var Zt=Object.defineProperty;var en=(n,r,s)=>r in n?Zt(n,r,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[r]=s;var Ze=(n,r,s)=>en(n,typeof r!="symbol"?r+"":r,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),e=require("react"),vt=e.createContext(null);function bt(){const n=e.useContext(vt);if(!n)throw new Error("usePullToRefresh must be used within NicePullToRefresh");return n}function Ne(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const mt=({state:n,progress:r,pullDistance:s,threshold:c})=>{const i=r*360,o=Math.min(1,r),d=()=>{switch(n){case"pulling":return t.jsxs("svg",{className:"ptr-icon ptr-icon-arrow",style:{transform:`rotate(${Math.min(i,180)}deg)`},width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("polyline",{points:"19 12 12 19 5 12"})]});case"ready":return t.jsxs("svg",{className:"ptr-icon ptr-icon-ready",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"23 4 23 10 17 10"}),t.jsx("path",{d:"M20.49 15a9 9 0 1 1-2.12-9.36L23 10"})]});case"refreshing":return t.jsxs("svg",{className:"ptr-icon ptr-icon-spinner",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"2",x2:"12",y2:"6"}),t.jsx("line",{x1:"12",y1:"18",x2:"12",y2:"22"}),t.jsx("line",{x1:"4.93",y1:"4.93",x2:"7.76",y2:"7.76"}),t.jsx("line",{x1:"16.24",y1:"16.24",x2:"19.07",y2:"19.07"}),t.jsx("line",{x1:"2",y1:"12",x2:"6",y2:"12"}),t.jsx("line",{x1:"18",y1:"12",x2:"22",y2:"12"}),t.jsx("line",{x1:"4.93",y1:"19.07",x2:"7.76",y2:"16.24"}),t.jsx("line",{x1:"16.24",y1:"7.76",x2:"19.07",y2:"4.93"})]});case"success":return t.jsx("svg",{className:"ptr-icon ptr-icon-success",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"20 6 9 17 4 12"})});case"error":return t.jsxs("svg",{className:"ptr-icon ptr-icon-error",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});default:return null}},u=()=>{switch(n){case"pulling":return"Pull down to refresh";case"ready":return"Release to refresh";case"refreshing":return"Refreshing...";case"success":return"Updated!";case"error":return"Failed to refresh";default:return""}};return t.jsxs("div",{className:`ptr-indicator ptr-indicator--${n}`,style:{opacity:n==="idle"?0:Math.max(.3,r),transform:`scale(${o})`},role:"status","aria-live":"polite",children:[t.jsx("div",{className:"ptr-indicator-icon",children:d()}),t.jsx("span",{className:"ptr-indicator-text",children:u()}),n==="pulling"&&t.jsx("div",{className:"ptr-progress-ring",children:t.jsxs("svg",{width:"32",height:"32",viewBox:"0 0 32 32",children:[t.jsx("circle",{className:"ptr-progress-bg",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2"}),t.jsx("circle",{className:"ptr-progress-fill",cx:"16",cy:"16",r:"14",fill:"none",strokeWidth:"2",strokeDasharray:`${88*r} 88`,transform:"rotate(-90 16 16)"})]})})]})},Xe=e.forwardRef(({children:n,onRefresh:r,indicator:s,threshold:c=80,maxPull:i=150,resistance:o=.4,completionDuration:d=1e3,hapticFeedback:u=!0,disabled:b=!1,onPullStart:N,onPullProgress:y,onRefreshSuccess:j,onRefreshError:R,className:f="",style:m,ariaLabel:p="Pull to refresh"},S)=>{const[M,T]=e.useState("idle"),[w,A]=e.useState(0),Y=e.useRef(null),E=e.useRef(null),O=e.useRef(0),L=e.useRef(0),g=e.useRef(!1),D=e.useRef(!1),C=Math.min(1,w/c),B=M==="refreshing",P=e.useCallback(()=>w<=0?0:((F,V,h)=>{const v=F*(1-h);return Math.min(V,v+v*h/2)})(w,i,o),[w,i,o]),H=e.useCallback(async()=>{if(!(M==="refreshing"||b)){T("refreshing"),u&&Ne("medium");try{await r(),T("success"),u&&Ne("heavy"),j==null||j()}catch(z){T("error"),u&&Ne("light"),R==null||R(z instanceof Error?z:new Error("Refresh failed"))}setTimeout(()=>{T("idle"),A(0)},d)}},[M,b,u,r,j,R,d]),Z=e.useCallback(z=>{if(b||M==="refreshing")return;const F=E.current,V=(F==null?void 0:F.scrollTop)??0;V>0||(O.current=z.touches[0].clientY,L.current=V,D.current=!1)},[b,M]),_=e.useCallback(z=>{if(b||M==="refreshing")return;const F=E.current;if(((F==null?void 0:F.scrollTop)??0)>0&&!g.current)return;const v=z.touches[0].clientY-O.current;if(v<=0){g.current&&(g.current=!1,T("idle"),A(0));return}g.current||(g.current=!0,N==null||N(),T("pulling")),z.preventDefault(),A(v);const x=Math.min(1,v/c);y==null||y(x),v>=c?M!=="ready"&&(T("ready"),u&&!D.current&&(Ne("light"),D.current=!0)):M==="ready"&&(T("pulling"),D.current=!1)},[b,M,c,u,N,y]),W=e.useCallback(()=>{g.current&&(g.current=!1,M==="ready"?H():(T("idle"),A(0)))},[M,H]),K=e.useCallback(z=>{(z.key==="F5"||z.ctrlKey&&z.key==="r")&&(z.preventDefault(),H())},[H]),J=e.useCallback(z=>{Y.current=z,typeof S=="function"?S(z):S&&(S.current=z)},[S]),ee={state:M,progress:C,isRefreshing:B,triggerRefresh:H},$=P();return t.jsx(vt.Provider,{value:ee,children:t.jsxs("div",{ref:J,className:`nice-ptr ${f} nice-ptr--${M}`,style:m,onTouchStart:Z,onTouchMove:_,onTouchEnd:W,onKeyDown:K,tabIndex:0,role:"region","aria-label":p,"data-state":M,"data-disabled":b||void 0,children:[t.jsx("div",{className:"nice-ptr-indicator-wrapper",style:{height:$,opacity:M==="idle"?0:1},children:s?t.jsx(s,{state:M,progress:C,pullDistance:w,threshold:c}):t.jsx(mt,{state:M,progress:C,pullDistance:w,threshold:c})}),t.jsx("div",{ref:E,className:"nice-ptr-content",style:{transform:M==="refreshing"?`translateY(${c}px)`:`translateY(${$}px)`,transition:g.current?"none":"transform 0.3s cubic-bezier(0.23, 1, 0.32, 1)"},children:n})]})})});Xe.displayName="NicePullToRefresh";const tn=({state:n,progress:r})=>t.jsxs("div",{className:`ptr-dots ptr-dots--${n}`,children:[t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,r*3)}}),t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,(r-.33)*3)}}),t.jsx("span",{className:"ptr-dot",style:{opacity:Math.min(1,(r-.66)*3)}})]}),nn=({state:n,progress:r})=>t.jsx("div",{className:`ptr-line ptr-line--${n}`,children:t.jsx("div",{className:"ptr-line-fill",style:{width:`${r*100}%`}})}),rn=({state:n})=>{const r={idle:"",pulling:"👇",ready:"🔄",refreshing:"⏳",success:"✅",error:"❌"};return t.jsx("div",{className:`ptr-emoji ptr-emoji--${n}`,children:t.jsx("span",{className:"ptr-emoji-icon",children:r[n]})})},sn=({state:n,progress:r})=>t.jsx("div",{className:`ptr-ios ptr-ios--${n}`,children:t.jsx("div",{className:"ptr-ios-spinner",children:Array.from({length:12}).map((c,i)=>{const o=i/12*360,d=i/12*1,u=n==="refreshing"?void 0:Math.min(1,r*2-i*.08);return t.jsx("div",{className:"ptr-ios-bar",style:{transform:`rotate(${o}deg) translateY(-8px)`,animationDelay:`${d}s`,opacity:u}},i)})})}),cn=({state:n,progress:r})=>t.jsxs("div",{className:`ptr-material ptr-material--${n}`,children:[t.jsxs("svg",{className:"ptr-material-circle",viewBox:"0 0 36 36",width:"36",height:"36",children:[t.jsx("circle",{className:"ptr-material-bg",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3"}),t.jsx("circle",{className:"ptr-material-progress",cx:"18",cy:"18",r:"16",fill:"none",strokeWidth:"3",strokeDasharray:`${100*r} 100`,strokeLinecap:"round",transform:"rotate(-90 18 18)"})]}),(n==="success"||n==="error")&&t.jsx("span",{className:"ptr-material-icon",children:n==="success"?"✓":"!"})]}),xt=e.createContext(null),pt=({children:n})=>{const[r,s]=e.useState(null);return t.jsx(xt.Provider,{value:{activeItemId:r,setActiveItemId:s},children:n})};function gt(){return e.useContext(xt)}function Me(n="medium"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}const et=({action:n,width:r,progress:s,index:c,total:i,side:o,onTrigger:d})=>{const u=Math.min(1,s*2),b=o==="right"?(i-1-c)*.05:c*.05;return t.jsxs("button",{className:`nice-swipe-action nice-swipe-action--${o} ${n.destructive?"nice-swipe-action--destructive":""}`,style:{width:r,background:n.background||"var(--color-primary, #3b82f6)",color:n.color||"var(--bg-primary, #ffffff)",transform:`scale(${u})`,transitionDelay:`${b}s`},onClick:d,"aria-label":n.label,children:[n.icon&&t.jsx("span",{className:"nice-swipe-action-icon",children:n.icon}),t.jsx("span",{className:"nice-swipe-action-label",children:n.label})]})},yt=e.forwardRef(({children:n,leftActions:r=[],rightActions:s=[],actionWidth:c=72,threshold:i=.4,direction:o,exclusive:d=!0,onSwipeStart:u,onSwipeEnd:b,onAction:N,disabled:y=!1,className:j="",style:R,itemId:f,hapticFeedback:m=!0},p)=>{const S=gt(),[M,T]=e.useState(0),[w,A]=e.useState(null),[Y,E]=e.useState(!1),O=e.useRef(null),L=e.useRef(0),g=e.useRef(0),D=e.useRef(0),C=e.useRef(!1),B=e.useRef(null),P=e.useRef(!1),H=-(r.length*c),Z=s.length*c,_=(o==="left"||o==="both"||!o)&&r.length>0,W=(o==="right"||o==="both"||!o)&&s.length>0,K=Math.min(1,Math.abs(M)/Math.abs(H)),J=Math.min(1,M/Z),ee=e.useMemo(()=>f||`swipe-${Math.random().toString(36).substr(2,9)}`,[f]),$=e.useCallback(()=>{E(!0),T(0),A(null),setTimeout(()=>E(!1),300)},[]);e.useEffect(()=>{d&&S&&S.activeItemId!==null&&S.activeItemId!==ee&&w&&$()},[d,S,ee,w,$]);const z=e.useCallback(a=>{y||Y||(L.current=a.touches[0].clientX,g.current=a.touches[0].clientY,D.current=M,C.current=!1,B.current=null,P.current=!1)},[y,Y,M]),F=e.useCallback(a=>{if(y||Y)return;const l=a.touches[0].clientX,k=a.touches[0].clientY,I=l-L.current,G=k-g.current;if(!C.current){if(Math.abs(I)<Math.abs(G))return;C.current=!0,B.current=I<0?"left":"right",u==null||u(B.current),d&&S&&S.setActiveItemId(ee)}let X=D.current+I;if(!_&&X<0&&(X=Math.max(X,-30)*.3),!W&&X>0&&(X=Math.min(X,30)*.3),_&&X<H){const ne=H-X;X=H-ne*.3}if(W&&X>Z){const ne=X-Z;X=Z+ne*.3}const q=B.current==="left"?Math.abs(H)*i:Z*i,se=B.current==="left"?Math.abs(X):X;se>=q&&!P.current?(P.current=!0,m&&Me("light")):se<q&&P.current&&(P.current=!1),T(X),a.preventDefault()},[y,Y,_,W,H,Z,i,m,d,S,ee,u]),V=e.useCallback(()=>{if(!C.current)return;C.current=!1,E(!0);const a=Math.abs(H)*i,l=Z*i;let k=0,I=null;B.current==="left"&&_?Math.abs(M)>=a&&(k=H,I="left",m&&Me("medium")):B.current==="right"&&W&&M>=l&&(k=Z,I="right",m&&Me("medium")),(w==="left"&&M>0||w==="right"&&M<0)&&(k=0,I=null),T(k),A(I),b==null||b(I),setTimeout(()=>E(!1),300)},[M,H,Z,i,_,W,w,m,b]),h=e.useCallback((a,l)=>{a.onClick(),N==null||N(a,l),m&&Me("heavy"),$()},[N,m,$]),v=e.useCallback(a=>{a.key==="Escape"&&w&&$()},[w,$]),x=e.useCallback(a=>{O.current=a,typeof p=="function"?p(a):p&&(p.current=a)},[p]);return t.jsxs("div",{ref:x,className:`nice-swipe-container ${j} ${w?`nice-swipe-container--open-${w}`:""}`,style:R,onKeyDown:v,tabIndex:0,role:"listitem","aria-label":w?`Swipe actions ${w} visible`:"Swipe for actions","data-disabled":y||void 0,children:[s.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--left",style:{width:Z},children:s.map((a,l)=>t.jsx(et,{action:a,width:c,progress:J,index:l,total:s.length,side:"right",onTrigger:()=>h(a,"right")},a.id))}),t.jsx("div",{className:"nice-swipe-content",style:{transform:`translateX(${M}px)`,transition:Y?"transform 0.3s cubic-bezier(0.4, 0, 0.2, 1)":"none"},onTouchStart:z,onTouchMove:F,onTouchEnd:V,children:n}),r.length>0&&t.jsx("div",{className:"nice-swipe-actions nice-swipe-actions--right",style:{width:Math.abs(H)},children:r.map((a,l)=>t.jsx(et,{action:a,width:c,progress:K,index:l,total:r.length,side:"left",onTrigger:()=>h(a,"left")},a.id))})]})});yt.displayName="NiceSwipeActions";const an=({children:n,className:r="",style:s})=>t.jsx(pt,{children:t.jsx("div",{className:`nice-swipe-list ${r}`,style:s,role:"list",children:n})}),ln={delete:n=>({id:"delete",label:"Delete",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"3 6 5 6 21 6"}),t.jsx("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]}),background:"var(--color-error, #ef4444)",destructive:!0,onClick:n}),edit:n=>({id:"edit",label:"Edit",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7"}),t.jsx("path",{d:"M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z"})]}),background:"var(--color-primary, #3b82f6)",onClick:n}),archive:n=>({id:"archive",label:"Archive",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"21 8 21 21 3 21 3 8"}),t.jsx("rect",{x:"1",y:"3",width:"22",height:"5"}),t.jsx("line",{x1:"10",y1:"12",x2:"14",y2:"12"})]}),background:"var(--text-muted, #6b7280)",onClick:n}),star:n=>({id:"star",label:"Star",icon:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polygon",{points:"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2"})}),background:"var(--color-warning, #eab308)",onClick:n}),share:n=>({id:"share",label:"Share",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"18",cy:"5",r:"3"}),t.jsx("circle",{cx:"6",cy:"12",r:"3"}),t.jsx("circle",{cx:"18",cy:"19",r:"3"}),t.jsx("line",{x1:"8.59",y1:"13.51",x2:"15.42",y2:"17.49"}),t.jsx("line",{x1:"15.41",y1:"6.51",x2:"8.59",y2:"10.49"})]}),background:"var(--color-success, #22c55e)",onClick:n}),pin:n=>({id:"pin",label:"Pin",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"12",y1:"17",x2:"12",y2:"22"}),t.jsx("path",{d:"M5 17h14v-1.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V6h1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4h1v4.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24Z"})]}),background:"var(--color-accent, #8b5cf6)",onClick:n}),mute:n=>({id:"mute",label:"Mute",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M11 5L6 9H2v6h4l5 4V5z"}),t.jsx("line",{x1:"23",y1:"9",x2:"17",y2:"15"}),t.jsx("line",{x1:"17",y1:"9",x2:"23",y2:"15"})]}),background:"var(--text-muted, #64748b)",onClick:n}),reply:n=>({id:"reply",label:"Reply",icon:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"9 17 4 12 9 7"}),t.jsx("path",{d:"M20 18v-2a4 4 0 0 0-4-4H4"})]}),background:"var(--color-info, #0ea5e9)",onClick:n})};function tt(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function on(n,r,s){return n==="full"?r*.95:n==="content"?Math.min(s,r*.9):r*n/100}const wt=e.forwardRef(({children:n,open:r,onClose:s,onSnapChange:c,snapPoints:i=[50,100],initialSnap:o=0,header:d,footer:u,showHandle:b=!0,showBackdrop:N=!0,closeOnBackdrop:y=!0,closeOnEscape:j=!0,dismissible:R=!0,velocityThreshold:f=.5,hapticFeedback:m=!0,handleColor:p,borderRadius:S=16,zIndex:M=1e3,className:T="",style:w,ariaLabel:A="Bottom sheet"},Y)=>{const[E,O]=e.useState(o),[L,g]=e.useState(0),[D,C]=e.useState(!1),[B,P]=e.useState(typeof window<"u"?window.innerHeight:800),[H,Z]=e.useState(400),_=e.useRef(null),W=e.useRef(null),K=e.useRef(0),J=e.useRef(0),ee=e.useRef(0),$=e.useRef(0),z=e.useRef(0),F=e.useRef(-1),V=i.map(q=>on(q,B,H)),h=V[E]??V[0];e.useImperativeHandle(Y,()=>({snapTo:q=>{q>=0&&q<i.length&&(O(q),g(0),c==null||c(q,V[q]))},close:()=>s(),getCurrentSnap:()=>E})),e.useEffect(()=>{const q=()=>{P(window.innerHeight)};return window.addEventListener("resize",q),()=>window.removeEventListener("resize",q)},[]),e.useEffect(()=>{if(W.current&&r){const q=W.current.scrollHeight;Z(q+60)}},[r,n]),e.useEffect(()=>{if(!r||!j)return;const q=se=>{se.key==="Escape"&&s()};return document.addEventListener("keydown",q),()=>document.removeEventListener("keydown",q)},[r,j,s]),e.useEffect(()=>{if(r){const q=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=q}}},[r]);const v=e.useCallback(q=>{const se=B-h+q,ne=B-se;for(let ie=0;ie<V.length;ie++){const ae=V[ie];if(Math.abs(ne-ae)<20&&F.current!==ie){F.current=ie,m&&tt("light");break}}},[B,h,V,m]),x=e.useCallback((q,se)=>{if(se>f*2&&R&&q<V[0]*.5)return-1;if(se<-f)return V.length-1;if(se>f)return R&&q<V[0]*.7?-1:0;let ne=0,ie=Math.abs(q-V[0]);for(let ae=1;ae<V.length;ae++){const re=Math.abs(q-V[ae]);re<ie&&(ie=re,ne=ae)}return R&&q<V[0]*.5?-1:ne},[V,f,R]),a=e.useCallback(q=>{K.current=q.touches[0].clientY,J.current=L,ee.current=q.touches[0].clientY,$.current=Date.now(),z.current=0,F.current=-1,C(!0)},[L]),l=e.useCallback(q=>{if(!D)return;const se=q.touches[0].clientY,ne=se-K.current,ie=Date.now(),ae=ie-$.current;ae>0&&(z.current=(se-ee.current)/ae),ee.current=se,$.current=ie;let re=J.current+ne;const oe=h+50;if(re>oe){const Q=re-oe;re=oe+Q*.2}const U=-(B*.95-h);if(re<U){const Q=U-re;re=U-Q*.2}g(re),v(re),q.preventDefault()},[D,h,B,v]),k=e.useCallback(()=>{if(!D)return;C(!1);const q=h-L,se=x(q,z.current);if(se===-1)g(h+100),setTimeout(()=>{s(),g(0),O(o)},300);else{const ne=V[se];g(0),O(se),se!==E&&(c==null||c(se,ne),m&&tt("medium"))}},[D,h,L,x,E,V,s,c,o,m]),I=e.useCallback(()=>{y&&s()},[y,s]);if(!r)return null;const G=Math.max(0,h-L),X=Math.min(.5,G/B*.8);return t.jsxs("div",{className:`nice-bottom-sheet-container ${T}`,style:{zIndex:M},children:[N&&t.jsx("div",{className:"nice-bottom-sheet-backdrop",style:{opacity:X},onClick:I,"aria-hidden":"true"}),t.jsxs("div",{ref:_,className:`nice-bottom-sheet ${D?"nice-bottom-sheet--dragging":""}`,style:{...w,height:G,borderTopLeftRadius:S,borderTopRightRadius:S,transition:D?"none":"height 0.3s cubic-bezier(0.4, 0, 0.2, 1)"},role:"dialog","aria-modal":"true","aria-label":A,children:[b&&t.jsx("div",{className:"nice-bottom-sheet-handle",onTouchStart:a,onTouchMove:l,onTouchEnd:k,children:t.jsx("div",{className:"nice-bottom-sheet-handle-bar",style:p?{backgroundColor:p}:void 0})}),d&&t.jsx("div",{className:"nice-bottom-sheet-header",children:d}),t.jsx("div",{ref:W,className:"nice-bottom-sheet-content",onTouchStart:a,onTouchMove:l,onTouchEnd:k,children:n}),u&&t.jsx("div",{className:"nice-bottom-sheet-footer",children:u})]})]})});wt.displayName="NiceBottomSheet";function un(n="light"){if(typeof navigator<"u"&&"vibrate"in navigator){const r={light:10,medium:25,heavy:50};navigator.vibrate(r[n])}}function nt(n,r){return Math.hypot(r.x-n.x,r.y-n.y)}function rt(n,r){return{x:(n.x+r.x)/2,y:(n.y+r.y)/2}}const kt=e.forwardRef(({items:n,selectedIndex:r=0,onIndexChange:s,onClose:c,showClose:i=!0,showCounter:o=!0,showCaption:d=!0,showThumbnails:u=!1,enablePinchZoom:b=!0,enableDoubleTapZoom:N=!0,enableSwipe:y=!0,enableKeyboard:j=!0,minZoom:R=1,maxZoom:f=4,doubleTapZoom:m=2.5,swipeThreshold:p=50,loop:S=!0,hapticFeedback:M=!0,backgroundColor:T="var(--nice-overlay-95, rgba(0, 0, 0, 0.95))",zIndex:w=2e3,className:A="",style:Y},E)=>{const[O,L]=e.useState(r),[g,D]=e.useState(1),[C,B]=e.useState(0),[P,H]=e.useState(0),[Z,_]=e.useState(!1),[W,K]=e.useState({}),J=e.useRef(null),ee=e.useRef(null),$=e.useRef([]),z=e.useRef(0),F=e.useRef(1),V=e.useRef({x:0,y:0}),h=e.useRef(0),v=e.useRef({x:0,y:0}),x=e.useRef(!1),a=e.useRef(!1),l=e.useRef(null),k=n[O],I=e.useCallback(U=>{let Q=U;S?Q=(U%n.length+n.length)%n.length:Q=Math.max(0,Math.min(n.length-1,U)),Q!==O&&(_(!0),L(Q),D(1),B(0),H(0),s==null||s(Q,n[Q]),M&&un("light"),setTimeout(()=>_(!1),300))},[O,n,S,s,M]),G=e.useCallback(()=>I(O+1),[I,O]),X=e.useCallback(()=>I(O-1),[I,O]),q=e.useCallback((U,Q,te)=>{const ce=Math.max(R,Math.min(f,U));D(ce),ce<=1&&(B(0),H(0))},[R,f]),se=e.useCallback(()=>q(g*1.5),[g,q]),ne=e.useCallback(()=>q(g/1.5),[g,q]),ie=e.useCallback(()=>{D(1),B(0),H(0)},[]);e.useImperativeHandle(E,()=>({goTo:I,goNext:G,goPrev:X,zoomIn:se,zoomOut:ne,resetZoom:ie,close:()=>c==null?void 0:c()})),e.useEffect(()=>{if(!j)return;const U=Q=>{switch(Q.key){case"ArrowLeft":X();break;case"ArrowRight":G();break;case"ArrowUp":se();break;case"ArrowDown":ne();break;case"Escape":c==null||c();break;case"0":case"Home":ie();break}};return window.addEventListener("keydown",U),()=>window.removeEventListener("keydown",U)},[j,G,X,se,ne,ie,c]);const ae=e.useCallback(U=>{const Q=Array.from(U.touches).map(te=>({x:te.clientX,y:te.clientY,id:te.identifier}));if($.current=Q,v.current={x:Q[0].x,y:Q[0].y},a.current=!1,l.current=null,Q.length===2&&b)x.current=!0,z.current=nt(Q[0],Q[1]),F.current=g,V.current={x:C,y:P};else if(Q.length===1){const te=Date.now();te-h.current<300&&N?(g>1.1?ie():q(m,Q[0].x,Q[0].y),h.current=0):h.current=te,V.current={x:C,y:P}}},[g,C,P,b,N,m,ie,q]),re=e.useCallback(U=>{const Q=Array.from(U.touches).map(te=>({x:te.clientX,y:te.clientY,id:te.identifier}));if(Q.length===2&&x.current&&b){const ce=nt(Q[0],Q[1])/z.current,ue=F.current*ce;q(ue);const de=rt(Q[0],Q[1]),fe=rt($.current[0],$.current[1]||$.current[0]),he=de.x-fe.x,Ae=de.y-fe.y;B(V.current.x+he),H(V.current.y+Ae),U.preventDefault()}else if(Q.length===1){const te=Q[0].x-v.current.x,ce=Q[0].y-v.current.y;if(l.current||(Math.abs(te)>10||Math.abs(ce)>10)&&(l.current=Math.abs(te)>Math.abs(ce)?"horizontal":"vertical",a.current=!0),g>1.1){const ue=V.current.x+te,de=V.current.y+ce;B(ue),H(de)}U.preventDefault()}},[g,b,q]),oe=e.useCallback(U=>{if(x.current){x.current=!1;return}const Q=U.changedTouches[0],te=Q.clientX-v.current.x;Q.clientY-v.current.y,y&&g<=1.1&&l.current==="horizontal"&&(te>p?X():te<-p&&G()),g<=1.1&&(B(0),H(0)),a.current=!1,l.current=null},[g,y,p,G,X]);return e.useEffect(()=>{n.forEach((U,Q)=>{const te=new Image;te.onload=()=>{K(ce=>({...ce,[Q]:!0}))},te.src=U.src})},[n]),n.length===0?null:t.jsxs("div",{ref:J,className:`nice-image-gallery ${A}`,style:{...Y,backgroundColor:T,zIndex:w},role:"dialog","aria-modal":"true","aria-label":"Image gallery",children:[t.jsxs("div",{className:"nice-image-gallery-header",children:[o&&t.jsxs("span",{className:"nice-image-gallery-counter",children:[O+1," / ",n.length]}),t.jsxs("div",{className:"nice-image-gallery-actions",children:[t.jsx("button",{className:"nice-image-gallery-btn",onClick:ne,disabled:g<=R,"aria-label":"Zoom out",children:"−"}),t.jsx("button",{className:"nice-image-gallery-btn",onClick:se,disabled:g>=f,"aria-label":"Zoom in",children:"+"}),i&&t.jsx("button",{className:"nice-image-gallery-btn nice-image-gallery-close",onClick:c,"aria-label":"Close",children:"×"})]})]}),t.jsxs("div",{className:"nice-image-gallery-viewport",onTouchStart:ae,onTouchMove:re,onTouchEnd:oe,children:[t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--prev",onClick:X,disabled:!S&&O===0,"aria-label":"Previous image",children:"‹"}),t.jsxs("div",{className:"nice-image-gallery-image-container",children:[k.placeholder&&!W[O]&&t.jsx("div",{className:"nice-image-gallery-placeholder",style:{backgroundColor:k.placeholder}}),t.jsx("img",{ref:ee,src:k.src,alt:k.alt||k.title||"",className:`nice-image-gallery-image ${Z?"nice-image-gallery-image--animating":""}`,style:{transform:`scale(${g}) translate(${C/g}px, ${P/g}px)`,transition:x.current||a.current?"none":"transform 0.2s ease-out"},draggable:!1})]}),t.jsx("button",{className:"nice-image-gallery-nav nice-image-gallery-nav--next",onClick:G,disabled:!S&&O===n.length-1,"aria-label":"Next image",children:"›"})]}),d&&k.title&&t.jsxs("div",{className:"nice-image-gallery-caption",children:[t.jsx("h3",{children:k.title}),k.description&&t.jsx("p",{children:k.description})]}),u&&n.length>1&&t.jsx("div",{className:"nice-image-gallery-thumbnails",children:n.map((U,Q)=>t.jsx("button",{className:`nice-image-gallery-thumb ${Q===O?"nice-image-gallery-thumb--active":""}`,onClick:()=>I(Q),"aria-label":`Go to image ${Q+1}`,children:t.jsx("img",{src:U.thumbnail||U.src,alt:U.alt||"",loading:"lazy"})},Q))}),!u&&n.length>1&&n.length<=10&&t.jsx("div",{className:"nice-image-gallery-dots",children:n.map((U,Q)=>t.jsx("button",{className:`nice-image-gallery-dot ${Q===O?"nice-image-gallery-dot--active":""}`,onClick:()=>I(Q),"aria-label":`Go to image ${Q+1}`},Q))})]})});kt.displayName="NiceImageGallery";const jt=e.createContext(null);function dn(){const n=e.useContext(jt);if(!n)throw new Error("useInfiniteScroll must be used within NiceInfiniteScroll");return n}const st=()=>t.jsxs("div",{className:"nice-infinite-loading",children:[t.jsx("div",{className:"nice-infinite-spinner",children:t.jsxs("svg",{viewBox:"0 0 24 24",width:"24",height:"24",children:[t.jsx("circle",{className:"nice-infinite-spinner-track",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"3"}),t.jsx("circle",{className:"nice-infinite-spinner-fill",cx:"12",cy:"12",r:"10",fill:"none",strokeWidth:"3",strokeDasharray:"60",strokeLinecap:"round"})]})}),t.jsx("span",{className:"nice-infinite-loading-text",children:"Loading..."})]}),fn=()=>t.jsxs("div",{className:"nice-infinite-end",children:[t.jsx("span",{className:"nice-infinite-end-line"}),t.jsx("span",{className:"nice-infinite-end-text",children:"You've reached the end"}),t.jsx("span",{className:"nice-infinite-end-line"})]}),hn=({message:n,onRetry:r})=>t.jsxs("div",{className:"nice-infinite-error",role:"alert",children:[t.jsxs("svg",{className:"nice-infinite-error-icon",viewBox:"0 0 24 24",width:"24",height:"24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("line",{x1:"12",y1:"8",x2:"12",y2:"12"}),t.jsx("line",{x1:"12",y1:"16",x2:"12.01",y2:"16"})]}),t.jsx("span",{className:"nice-infinite-error-text",children:n}),r&&t.jsx("button",{className:"nice-infinite-error-retry",onClick:r,"aria-label":"Retry loading",children:"Retry"})]}),vn=()=>t.jsxs("div",{className:"nice-infinite-empty",children:[t.jsx("svg",{className:"nice-infinite-empty-icon",viewBox:"0 0 24 24",width:"48",height:"48",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:t.jsx("path",{d:"M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"})}),t.jsx("p",{className:"nice-infinite-empty-text",children:"No items to display"})]}),bn=({visible:n,onClick:r})=>t.jsx("button",{className:`nice-infinite-scroll-top ${n?"nice-infinite-scroll-top--visible":""}`,onClick:r,"aria-label":"Scroll to top",children:t.jsx("svg",{viewBox:"0 0 24 24",width:"20",height:"20",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"18 15 12 9 6 15"})})});function mn({items:n,renderItem:r,onLoadMore:s,hasMore:c,isLoading:i=!1,error:o=null,threshold:d=200,loadingIndicator:u,endIndicator:b,errorIndicator:N,onRetry:y,pullToRefresh:j=!1,onRefresh:R,direction:f="vertical",reverse:m=!1,initialScrollPosition:p="top",keyboardNav:S=!0,keyExtractor:M,emptyContent:T,header:w,footer:A,gap:Y=0,className:E="",style:O,ariaLabel:L="Scrollable list"},g){const[D,C]=e.useState("idle"),[B,P]=e.useState(!1),[H,Z]=e.useState(!1),_=e.useRef(null),W=e.useRef(null),K=e.useRef(!1),J=e.useRef(null);e.useEffect(()=>{o?C("error"):i?C("loading"):!c&&n.length>0?C("end"):C("idle")},[o,i,c,n.length]);const ee=e.useCallback((a,l)=>M?M(a,l):`item-${l}`,[M]),$=e.useCallback(async()=>{if(!(K.current||!c||o)){K.current=!0;try{await s()}finally{K.current=!1}}},[c,o,s]),z=e.useCallback(()=>{var a;(a=_.current)==null||a.scrollTo({top:0,behavior:"smooth"})},[]),F=e.useCallback(()=>{_.current&&_.current.scrollTo({top:_.current.scrollHeight,behavior:"smooth"})},[]);e.useEffect(()=>{if(!W.current)return;const a=l=>{const[k]=l;k.isIntersecting&&c&&!i&&!o&&$()};return J.current=new IntersectionObserver(a,{root:_.current,rootMargin:`${d}px`,threshold:.1}),J.current.observe(W.current),()=>{var l;(l=J.current)==null||l.disconnect()}},[c,i,o,d,$]),e.useEffect(()=>{const a=_.current;if(!a)return;const l=()=>{const k=f==="vertical"?a.scrollTop:a.scrollLeft;P(k>500)};return a.addEventListener("scroll",l,{passive:!0}),()=>a.removeEventListener("scroll",l)},[f]),e.useEffect(()=>{p==="bottom"&&_.current&&(_.current.scrollTop=_.current.scrollHeight)},[p]);const V=e.useCallback(a=>{S&&(a.key==="Home"?(a.preventDefault(),z()):a.key==="End"&&(a.preventDefault(),F()))},[S,z,F]);e.useCallback(async()=>{if(!(!R||H)){Z(!0);try{await R()}finally{Z(!1)}}},[R,H]);const h=e.useCallback(a=>{_.current=a,typeof g=="function"?g(a):g&&(g.current=a)},[g]),v=e.useMemo(()=>({status:D,loadMore:$,hasMore:c,itemCount:n.length,scrollToTop:z,scrollToBottom:F}),[D,$,c,n.length,z,F]),x=e.useMemo(()=>(m?[...n].reverse():n).map((l,k)=>t.jsx("div",{className:"nice-infinite-item","data-index":k,children:r(l,k)},ee(l,k))),[n,m,ee,r]);return n.length===0&&!i&&!o?t.jsx("div",{ref:h,className:`nice-infinite-container nice-infinite-container--empty ${E}`,style:O,role:"region","aria-label":L,children:T||t.jsx(vn,{})}):t.jsx(jt.Provider,{value:v,children:t.jsxs("div",{ref:h,className:`nice-infinite-container nice-infinite-container--${f} ${m?"nice-infinite-container--reverse":""} ${E}`,style:O,onKeyDown:V,tabIndex:0,role:"feed","aria-label":L,"aria-busy":i,children:[w&&t.jsx("div",{className:"nice-infinite-header",children:w}),j&&H&&t.jsx("div",{className:"nice-infinite-pull",children:u||t.jsx(st,{})}),t.jsx("div",{className:"nice-infinite-items",style:{gap:Y},children:x}),t.jsx("div",{ref:W,className:"nice-infinite-sentinel","aria-hidden":"true"}),D==="loading"&&(u||t.jsx(st,{})),D==="error"&&o&&(N||t.jsx(hn,{message:o,onRetry:y})),D==="end"&&(b||t.jsx(fn,{})),A&&t.jsx("div",{className:"nice-infinite-footer",children:A}),t.jsx(bn,{visible:B,onClick:z})]})})}const xn=e.forwardRef(mn);function pn(n){const{fetchPage:r,initialCursor:s,refetchOnFocus:c=!1}=n,[i,o]=e.useState([]),[d,u]=e.useState(s),[b,N]=e.useState(!1),[y,j]=e.useState(null),[R,f]=e.useState(!0),[m,p]=e.useState(!1),S=e.useCallback(async()=>{if(!(b||!R)){N(!0),j(null);try{const w=await r(d);o(A=>[...A,...w.items]),u(w.nextCursor),f(w.hasMore),p(!0)}catch(w){j(w instanceof Error?w.message:"Failed to load data")}finally{N(!1)}}},[r,d,b,R]),M=e.useCallback(async()=>{o([]),u(s),f(!0),j(null),N(!0);try{const w=await r(s);o(w.items),u(w.nextCursor),f(w.hasMore)}catch(w){j(w instanceof Error?w.message:"Failed to refresh data")}finally{N(!1)}},[r,s]),T=e.useCallback(()=>{o([]),u(s),f(!0),j(null),p(!1)},[s]);return e.useEffect(()=>{!m&&!b&&S()},[m,b,S]),e.useEffect(()=>{if(!c)return;const w=()=>{m&&M()};return window.addEventListener("focus",w),()=>window.removeEventListener("focus",w)},[c,m,M]),{items:i,isLoading:b,error:y,hasMore:R,loadMore:S,refresh:M,reset:T}}function gn(n){const{itemCount:r,itemHeight:s,overscan:c=5,containerRef:i}=n,[o,d]=e.useState(0),[u,b]=e.useState(0),N=e.useCallback(f=>typeof s=="function"?s(f):s,[s]),y=e.useMemo(()=>{let f=0;for(let m=0;m<r;m++)f+=N(m);return f},[r,N]),j=e.useMemo(()=>{const f=[];let m=0,p=-1,S=-1;for(let M=0;M<r;M++){const T=N(M),w=m+T;w>=o&&p===-1&&(p=M),m<=o+u&&(S=M),m=w}p=Math.max(0,p-c),S=Math.min(r-1,S+c),m=0;for(let M=0;M<r;M++){const T=N(M);M>=p&&M<=S&&f.push({index:M,start:m,size:T,end:m+T}),m+=T}return f},[r,N,o,u,c]);e.useEffect(()=>{const f=i.current;if(!f)return;b(f.clientHeight);const m=()=>{d(f.scrollTop)},p=()=>{b(f.clientHeight)};return f.addEventListener("scroll",m,{passive:!0}),window.addEventListener("resize",p),()=>{f.removeEventListener("scroll",m),window.removeEventListener("resize",p)}},[i]);const R=e.useCallback(f=>{const m=i.current;if(!m)return;let p=0;for(let S=0;S<f&&S<r;S++)p+=N(S);m.scrollTo({top:p,behavior:"smooth"})},[i,r,N]);return{virtualItems:j,totalSize:y,scrollToIndex:R}}const Nt=e.createContext(null);function yn(){const n=e.useContext(Nt);if(!n)throw new Error("useMobileDrawer must be used within NiceMobileDrawer");return n}const Mt=({item:n,depth:r=0,onSelect:s,activeId:c})=>{const[i,o]=e.useState(!1),d=n.children&&n.children.length>0,u=c===n.id;if(n.divider)return t.jsx("div",{className:"nice-drawer-divider"});if(n.section)return t.jsx("div",{className:"nice-drawer-section",children:t.jsx("span",{className:"nice-drawer-section-label",children:n.section})});const b=()=>{n.disabled||(d?o(!i):(s(n),n.onClick&&n.onClick()))};return t.jsxs("div",{className:"nice-drawer-nav-item-wrapper",children:[t.jsxs("button",{className:`nice-drawer-nav-item nice-drawer-nav-item--depth-${r} ${u?"nice-drawer-nav-item--active":""} ${n.disabled?"nice-drawer-nav-item--disabled":""}`,onClick:b,disabled:n.disabled,"aria-expanded":d?i:void 0,"aria-current":u?"page":void 0,style:{paddingLeft:`${16+r*16}px`},children:[n.icon&&t.jsx("span",{className:"nice-drawer-nav-icon",children:n.icon}),t.jsx("span",{className:"nice-drawer-nav-label",children:n.label}),n.badge!==void 0&&t.jsx("span",{className:"nice-drawer-nav-badge",style:{background:n.badgeColor},children:n.badge}),d&&t.jsx("span",{className:`nice-drawer-nav-chevron ${i?"nice-drawer-nav-chevron--expanded":""}`,children:t.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("polyline",{points:"6 9 12 15 18 9"})})})]}),d&&i&&t.jsx("div",{className:"nice-drawer-nav-children",children:n.children.map(N=>t.jsx(Mt,{item:N,depth:r+1,onSelect:s,activeId:c},N.id))})]})},Tt=e.forwardRef(({open:n,onClose:r,position:s="left",variant:c="overlay",size:i,children:o,navItems:d,header:u,footer:b,swipeToOpen:N=!0,swipeToClose:y=!0,edgeSwipeWidth:j=20,velocityThreshold:R=.3,showOverlay:f=!0,closeOnOverlayClick:m=!0,closeOnEscape:p=!0,disableBodyScroll:S=!0,overlayColor:M,zIndex:T=1e3,onNavSelect:w,activeNavId:A,className:Y="",style:E,ariaLabel:O="Navigation drawer"},L)=>{const[g,D]=e.useState(0),[C,B]=e.useState(!1),[P,H]=e.useState(A),Z=e.useRef(null),_=e.useRef({x:0,y:0}),W=e.useRef(0),K=e.useRef({x:0,y:0}),J=s==="left"||s==="right",$=i??(J?280:400);e.useEffect(()=>{A!==void 0&&H(A)},[A]),e.useEffect(()=>{if(S&&n){const l=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=l}}},[n,S]),e.useEffect(()=>{if(!p||!n)return;const l=k=>{k.key==="Escape"&&r()};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[p,n,r]),e.useEffect(()=>{if(!n||!Z.current)return;const l=Z.current,k=l.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),I=k[0],G=k[k.length-1],X=q=>{q.key==="Tab"&&(q.shiftKey&&document.activeElement===I?(q.preventDefault(),G==null||G.focus()):!q.shiftKey&&document.activeElement===G&&(q.preventDefault(),I==null||I.focus()))};return l.addEventListener("keydown",X),I==null||I.focus(),()=>l.removeEventListener("keydown",X)},[n]);const z=e.useCallback(()=>{let l=0;const k=g;if(!n)switch(s){case"left":l=-100;break;case"right":l=100;break;case"top":l=-100;break;case"bottom":l=100;break}return J?`translateX(calc(${l}% + ${k}px))`:`translateY(calc(${l}% + ${k}px))`},[n,s,g,J]),F=e.useCallback(l=>{if(!y&&n)return;const k=l.touches[0];_.current={x:k.clientX,y:k.clientY},K.current={x:k.clientX,y:k.clientY},W.current=Date.now()},[y,n]),V=e.useCallback(l=>{if(!y||!n)return;const k=l.touches[0],I=k.clientX-_.current.x,G=k.clientY-_.current.y;let X=!1,q=0;switch(s){case"left":X=I<0,q=Math.min(0,I);break;case"right":X=I>0,q=Math.max(0,I);break;case"top":X=G<0,q=Math.min(0,G);break;case"bottom":X=G>0,q=Math.max(0,G);break}X&&Math.abs(J?I:G)>10&&(B(!0),D(q),K.current={x:k.clientX,y:k.clientY},l.preventDefault())},[y,n,s,J]),h=e.useCallback(()=>{if(!C)return;const l=Date.now()-W.current,k=Math.abs(g),I=typeof $=="number"?$:280,G=k/l;(k>I*.3||G>R)&&r(),B(!1),D(0)},[C,g,$,R,J,r]);e.useEffect(()=>{if(!N||n)return;let l=0,k=0,I=!1;const G=q=>{const se=q.touches[0];l=se.clientX,k=se.clientY;const ne=window.innerWidth,ie=window.innerHeight;switch(s){case"left":I=l<j;break;case"right":I=l>ne-j;break;case"top":I=k<j;break;case"bottom":I=k>ie-j;break}},X=q=>{if(!I)return;const se=q.touches[0],ne=se.clientX-l,ie=se.clientY-k,ae=50;let re=!1;switch(s){case"left":re=ne>ae;break;case"right":re=ne<-ae;break;case"top":re=ie>ae;break;case"bottom":re=ie<-ae;break}re&&q.preventDefault()};return document.addEventListener("touchstart",G,{passive:!0}),document.addEventListener("touchmove",X,{passive:!1}),()=>{document.removeEventListener("touchstart",G),document.removeEventListener("touchmove",X)}},[N,n,s,j]);const v=e.useCallback(l=>{H(l.id),w==null||w(l),l.href&&r()},[w,r]),x=e.useCallback(l=>{Z.current=l,typeof L=="function"?L(l):L&&(L.current=l)},[L]),a=e.useMemo(()=>({isOpen:n,position:s,close:r,activeNavId:P,setActiveNavId:H}),[n,s,r,P]);return t.jsxs(Nt.Provider,{value:a,children:[f&&c!=="persistent"&&t.jsx("div",{className:`nice-drawer-overlay ${n?"nice-drawer-overlay--visible":""}`,style:{zIndex:T-1,background:M,opacity:C?1-Math.abs(g)/(typeof $=="number"?$:280):void 0},onClick:m?r:void 0,"aria-hidden":"true"}),t.jsxs("div",{ref:x,className:`nice-drawer nice-drawer--${s} nice-drawer--${c} ${n?"nice-drawer--open":""} ${C?"nice-drawer--dragging":""} ${Y}`,style:{...E,[J?"width":"height"]:$,zIndex:T,transform:z()},onTouchStart:F,onTouchMove:V,onTouchEnd:h,role:"dialog","aria-modal":c!=="persistent","aria-label":O,"aria-hidden":!n,children:[u&&t.jsxs("div",{className:"nice-drawer-header",children:[u,t.jsx("button",{className:"nice-drawer-close",onClick:r,"aria-label":"Close drawer",children:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]}),t.jsx("div",{className:"nice-drawer-content",children:d?t.jsx("nav",{className:"nice-drawer-nav","aria-label":"Main navigation",children:d.map(l=>t.jsx(Mt,{item:l,onSelect:v,activeId:P},l.id))}):o}),b&&t.jsx("div",{className:"nice-drawer-footer",children:b})]})]})});Tt.displayName="NiceMobileDrawer";function wn(n={}){const{defaultOpen:r=!1,onOpenChange:s}=n,[c,i]=e.useState(r),o=e.useCallback(()=>{i(!0),s==null||s(!0)},[s]),d=e.useCallback(()=>{i(!1),s==null||s(!1)},[s]),u=e.useCallback(()=>{i(N=>{const y=!N;return s==null||s(y),y})},[s]),b=e.useCallback(N=>{i(N),s==null||s(N)},[s]);return{isOpen:c,open:o,close:d,toggle:u,setOpen:b}}const kn={home:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),settings:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),user:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),search:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),inbox:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),t.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]}),heart:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),folder:t.jsx("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:t.jsx("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),help:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10"}),t.jsx("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),t.jsx("line",{x1:"12",y1:"17",x2:"12.01",y2:"17"})]}),logout:t.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[t.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),t.jsx("polyline",{points:"16 17 21 12 16 7"}),t.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})},Rt=e.createContext(null);function jn(){const n=e.useContext(Rt);if(!n)throw new Error("useMobileModal must be used within a NiceMobileModal");return n}function Nn(n={}){const{defaultOpen:r=!1,open:s,onOpenChange:c,preventDismiss:i=!1}=n,[o,d]=e.useState(r),u=s!==void 0,b=u?s:o,N=e.useCallback((f,m)=>{!f&&i&&m!=="close"||(u||d(f),c==null||c(f,m))},[u,c,i]),y=e.useCallback(()=>N(!0),[N]),j=e.useCallback(f=>N(!1,f),[N]),R=e.useCallback(()=>N(!b),[N,b]);return{open:b,openModal:y,closeModal:j,toggle:R,setOpen:f=>N(f)}}const Mn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),t.jsx("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]});function Tn(n,r,s){return n==="content"?Math.min(s,r):n==="full"?r:n<=1?r*n:Math.min(n,r)}function Rn(n,r,s){return Math.min(Math.max(n,r),s)}const _e=e.forwardRef(function({open:r,onClose:s,title:c,children:i,footer:o,snapPoints:d=["content"],defaultSnapPoint:u=0,showHandle:b=!0,showClose:N=!0,showOverlay:y=!0,dismissOnDrag:j=!0,dismissOnOverlay:R=!0,dismissOnEscape:f=!0,preventDismiss:m=!1,onSnapChange:p,className:S="",overlayClassName:M="",headerClassName:T="",contentClassName:w="",footerClassName:A="",lockScroll:Y=!0,borderRadius:E=16,zIndex:O,style:L,...g},D){const B=`${e.useId()}-title`,P=e.useRef(null),H=e.useRef(null),Z=e.useRef(0),_=e.useRef(0),W=e.useRef(!1),[K,J]=e.useState(u),[ee,$]=e.useState(0),[z,F]=e.useState(400),[V,h]=e.useState(typeof window<"u"?window.innerHeight:800),[v,x]=e.useState(!1),a=d.map(U=>Tn(U,V,z));e.useEffect(()=>{if(typeof window>"u")return;const U=()=>{h(window.innerHeight)};return window.addEventListener("resize",U),()=>window.removeEventListener("resize",U)},[]),e.useEffect(()=>{if(!H.current||!r)return;const U=new ResizeObserver(Q=>{for(const te of Q){const ce=te.contentRect.height+100;F(Math.min(ce,V*.9))}});return U.observe(H.current),()=>U.disconnect()},[r,V]),e.useEffect(()=>{if(r){const U=a[u]||a[0]||V*.5;$(U),J(u)}},[r]),e.useEffect(()=>{if(r&&!v){const U=a[K]||a[0];$(U)}},[a.join(","),K,v,r]),e.useEffect(()=>{if(!Y||!r)return;const U=document.body.style.overflow,Q=document.body.style.paddingRight,te=window.innerWidth-document.documentElement.clientWidth;return document.body.style.overflow="hidden",te>0&&(document.body.style.paddingRight=`${te}px`),()=>{document.body.style.overflow=U,document.body.style.paddingRight=Q}},[r,Y]),e.useEffect(()=>{if(!r||!f||m)return;const U=Q=>{Q.key==="Escape"&&(s==null||s("escape"))};return document.addEventListener("keydown",U),()=>document.removeEventListener("keydown",U)},[r,f,m,s]),e.useEffect(()=>{if(!r||!P.current)return;const Q=P.current.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])'),te=Q[0],ce=Q[Q.length-1],ue=de=>{de.key==="Tab"&&(de.shiftKey?document.activeElement===te&&(de.preventDefault(),ce==null||ce.focus()):document.activeElement===ce&&(de.preventDefault(),te==null||te.focus()))};return document.addEventListener("keydown",ue),requestAnimationFrame(()=>{te==null||te.focus()}),()=>document.removeEventListener("keydown",ue)},[r]);const l=e.useCallback(U=>{m&&U!=="close"||s==null||s(U)},[m,s]),k=e.useCallback(()=>{R&&l("overlay")},[R,l]),I=e.useCallback((U,Q)=>{if(Q>.5&&j&&!m)return-1;if(Q<-.5)return a.length-1;let te=0,ce=Math.abs(a[0]-U);for(let ue=1;ue<a.length;ue++){const de=Math.abs(a[ue]-U);de<ce&&(ce=de,te=ue)}return te},[a,j,m]),G=e.useCallback(U=>{W.current=!0,Z.current=U,_.current=ee,x(!0)},[ee]),X=e.useCallback(U=>{if(!W.current)return;const Q=Z.current-U,te=Rn(_.current+Q,50,V);$(te)},[V]),q=e.useCallback((U,Q)=>{if(!W.current)return;W.current=!1,x(!1);const te=I(ee,Q);if(te===-1){l("drag");return}J(te),$(a[te]),p==null||p(te,d[te])},[ee,I,l,a,d,p]),se=U=>{G(U.touches[0].clientY)},ne=U=>{X(U.touches[0].clientY)},ie=U=>{const Q=U.changedTouches[0],te=(Z.current-Q.clientY)/(U.timeStamp-(U.timeStamp-200));q(Q.clientY,te>0?-te/1e3:te/1e3)},ae=U=>{U.preventDefault(),G(U.clientY);const Q=ce=>{X(ce.clientY)},te=ce=>{const ue=(Z.current-ce.clientY)/200;q(ce.clientY,ue>0?-ue/500:ue/500),document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",te)};document.addEventListener("mousemove",Q),document.addEventListener("mouseup",te)},re=e.useCallback(U=>{U<0||U>=a.length||(J(U),$(a[U]),p==null||p(U,d[U]))},[a,d,p]),oe={isOpen:r,snapPoints:d,currentSnapIndex:K,setSnapIndex:re,close:l};return r?t.jsxs(t.Fragment,{children:[y&&t.jsx("div",{className:`nice-mobile-modal-overlay nice-mobile-modal-overlay--visible ${M}`,onClick:k,"aria-hidden":"true",style:{zIndex:O?O-1:void 0}}),t.jsx(Rt.Provider,{value:oe,children:t.jsxs("div",{ref:U=>{P.current=U,typeof D=="function"?D(U):D&&(D.current=U)},role:"dialog","aria-modal":"true","aria-labelledby":c?B:void 0,className:`nice-modal-sheet ${v?"nice-modal-sheet--dragging":""} ${S}`,style:{height:ee,borderTopLeftRadius:E,borderTopRightRadius:E,zIndex:O,...L},...g,children:[b&&t.jsx("div",{className:"nice-modal-handle-area",onTouchStart:se,onTouchMove:ne,onTouchEnd:ie,onMouseDown:ae,children:t.jsx("div",{className:"nice-modal-handle"})}),(c||N)&&t.jsxs("div",{className:`nice-modal-header ${T}`,children:[c&&t.jsx("h2",{id:B,className:"nice-modal-title",children:c}),N&&!m&&t.jsx("button",{type:"button",className:"nice-modal-close",onClick:()=>l("close"),"aria-label":"Close modal",children:t.jsx(Mn,{})})]}),t.jsx("div",{ref:H,className:`nice-modal-content ${w}`,children:i}),o&&t.jsx("div",{className:`nice-modal-footer ${A}`,children:o})]})})]}):null}),Dn=e.forwardRef(function({actions:r,cancelLabel:s="Cancel",onClose:c,...i},o){return t.jsx(_e,{ref:o,onClose:c,showHandle:!0,showClose:!1,snapPoints:["content"],...i,children:t.jsxs("div",{className:"nice-action-sheet",children:[r.map(d=>t.jsxs("button",{type:"button",className:`nice-action-sheet-item ${d.destructive?"nice-action-sheet-item--destructive":""}`,disabled:d.disabled,onClick:()=>{var u;(u=d.onClick)==null||u.call(d),c==null||c("close")},children:[d.icon&&t.jsx("span",{className:"nice-action-sheet-icon",children:d.icon}),d.label]},d.id)),t.jsx("div",{className:"nice-action-sheet-divider"}),t.jsx("button",{type:"button",className:"nice-action-sheet-item nice-action-sheet-item--cancel",onClick:()=>c==null?void 0:c("close"),children:s})]})})}),Sn=e.forwardRef(function({title:r,message:s,confirmLabel:c="Confirm",cancelLabel:i="Cancel",confirmDestructive:o=!1,onConfirm:d,onCancel:u,onClose:b,...N},y){const j=()=>{d==null||d(),b==null||b("close")},R=()=>{u==null||u(),b==null||b("close")};return t.jsx(_e,{ref:y,title:r,onClose:b,showHandle:!0,snapPoints:["content"],footer:t.jsxs("div",{className:"nice-confirm-sheet-buttons",children:[t.jsx("button",{type:"button",className:"nice-confirm-sheet-btn nice-confirm-sheet-btn--cancel",onClick:R,children:i}),t.jsx("button",{type:"button",className:`nice-confirm-sheet-btn nice-confirm-sheet-btn--confirm ${o?"nice-confirm-sheet-btn--destructive":""}`,onClick:j,children:c})]}),...N,children:t.jsx("div",{className:"nice-confirm-sheet-message",children:s})})}),Dt=e.createContext(null);function Cn(){const n=e.useContext(Dt);if(!n)throw new Error("useMobileTabs must be used within a NiceMobileTabs");return n}function Pn(n){var j;const{tabs:r,defaultTab:s,activeTab:c,onChange:i}=n,[o,d]=e.useState(s||((j=r[0])==null?void 0:j.id)||""),u=c!==void 0,b=u?c:o,N=e.useCallback(R=>{const f=r.find(m=>m.id===R);!f||f.disabled||(u||d(R),i==null||i(R))},[r,u,i]),y=e.useCallback(R=>b===R,[b]);return{activeTab:b,setActiveTab:N,tabs:r,isActive:y}}const le={home:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"}),t.jsx("polyline",{points:"9 22 9 12 15 12 15 22"})]}),homeFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"})}),search:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),plus:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),t.jsx("line",{x1:"5",y1:"12",x2:"19",y2:"12"})]}),heart:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("path",{d:"M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"})}),heartFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"})}),user:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"}),t.jsx("circle",{cx:"12",cy:"7",r:"4"})]}),userFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 12c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm0 2c-2.67 0-8 1.34-8 4v2h16v-2c0-2.66-5.33-4-8-4z"})}),bell:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("path",{d:"M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9"}),t.jsx("path",{d:"M13.73 21a2 2 0 0 1-3.46 0"})]}),bellFilled:t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"currentColor",children:t.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.89 2 2 2zm6-6v-5c0-3.07-1.64-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.63 5.36 6 7.92 6 11v5l-2 2v1h16v-1l-2-2z"})}),cart:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"9",cy:"21",r:"1"}),t.jsx("circle",{cx:"20",cy:"21",r:"1"}),t.jsx("path",{d:"M1 1h4l2.68 13.39a2 2 0 0 0 2 1.61h9.72a2 2 0 0 0 2-1.61L23 6H6"})]}),inbox:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),t.jsx("path",{d:"M5.45 5.11L2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z"})]}),settings:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"3"}),t.jsx("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"})]}),more:t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"19",cy:"12",r:"1"}),t.jsx("circle",{cx:"5",cy:"12",r:"1"})]})},ct=({content:n,variant:r="count",color:s})=>{if(n===void 0||n===!1)return null;if(n===!0||r==="dot")return t.jsx("span",{className:"nice-tab-badge nice-tab-badge--dot",style:s?{backgroundColor:s}:void 0});const c=typeof n=="number"&&n>99?"99+":n;return t.jsx("span",{className:"nice-tab-badge nice-tab-badge--count",style:s?{backgroundColor:s}:void 0,children:c})},it=({tab:n,isActive:r,showLabel:s,animation:c,activeColor:i,inactiveColor:o,onClick:d})=>{const u=e.useRef(null);e.useEffect(()=>{if(!u.current||c==="none")return;const y=u.current;c==="scale"&&r&&(y.style.transform="scale(1.2)",setTimeout(()=>{y.style.transform="scale(1)"},150))},[r,c]);const b=r&&n.activeIcon?n.activeIcon:n.icon,N={};return r&&i?N.color=i:!r&&o&&(N.color=o),n.href?t.jsxs("a",{href:n.href,className:`nice-tab-button ${r?"nice-tab-button--active":""} ${n.disabled?"nice-tab-button--disabled":""} ${n.className||""}`,style:N,"aria-current":r?"page":void 0,onClick:y=>{var j;if(n.disabled){y.preventDefault();return}(j=n.onClick)==null||j.call(n),d()},children:[t.jsx("span",{ref:u,className:"nice-tab-icon",children:b}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(ct,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]}):t.jsxs("button",{type:"button",className:`nice-tab-button ${r?"nice-tab-button--active":""} ${n.disabled?"nice-tab-button--disabled":""} ${n.className||""}`,style:N,disabled:n.disabled,"aria-pressed":r,onClick:()=>{var y;(y=n.onClick)==null||y.call(n),d()},children:[t.jsx("span",{ref:u,className:"nice-tab-icon",children:b}),s&&t.jsx("span",{className:"nice-tab-label",children:n.label}),t.jsx(ct,{content:n.badge,variant:n.badgeVariant,color:n.badgeColor})]})},$n=e.forwardRef(function({tabs:r,activeTab:s,defaultTab:c,onChange:i,showLabels:o=!0,showAllLabels:d=!0,position:u="bottom",variant:b="default",haptic:N=!0,animation:y="scale",maxTabs:j,moreLabel:R="More",moreIcon:f=le.more,safeArea:m=!0,activeColor:p,inactiveColor:S,backgroundColor:M,hideOnScroll:T="none",lockScroll:w=!0,className:A="",style:Y,...E},O){var ee;const[L,g]=e.useState(c||((ee=r[0])==null?void 0:ee.id)||""),[D,C]=e.useState(!1),B=e.useRef(0),P=s!==void 0,H=P?s:L;e.useEffect(()=>{if(T==="none"||typeof window>"u")return;const $=()=>{const z=window.scrollY,F=z>B.current?"down":"up";F===T&&z>50?C(!0):F!==T&&C(!1),B.current=z};return window.addEventListener("scroll",$,{passive:!0}),()=>window.removeEventListener("scroll",$)},[T]);const Z=e.useCallback($=>{const z=r.find(F=>F.id===$);!z||z.disabled||(N&&"vibrate"in navigator&&navigator.vibrate(10),P||g($),i==null||i($))},[r,N,P,i]),_=j&&r.length>j?r.slice(0,j-1):r,W=j&&r.length>j?r.slice(j-1):[],K={activeTab:H,setActiveTab:Z,tabs:r},J={...Y};return M&&(J.backgroundColor=M),t.jsx(Dt.Provider,{value:K,children:t.jsxs("nav",{ref:O,className:`nice-mobile-tabs nice-mobile-tabs--${u} nice-mobile-tabs--${b} ${m?"nice-mobile-tabs--safe-area":""} ${D?"nice-mobile-tabs--hidden":""} ${A}`,style:J,role:"tablist","aria-label":"Main navigation",...E,children:[_.map($=>{const z=$.id===H,F=d||o&&z;return t.jsx(it,{tab:$,isActive:z,showLabel:F,animation:y,activeColor:p,inactiveColor:S,onClick:()=>Z($.id)},$.id)}),W.length>0&&t.jsx(it,{tab:{id:"__more__",label:R,icon:f,badge:W.some($=>$.badge)?!0:void 0},isActive:W.some($=>$.id===H),showLabel:d||o,animation:y,activeColor:p,inactiveColor:S,onClick:()=>{console.log("Open more menu",W)}})]})})}),In={basic:[{id:"home",label:"Home",icon:le.home,activeIcon:le.homeFilled},{id:"search",label:"Search",icon:le.search},{id:"notifications",label:"Alerts",icon:le.bell,activeIcon:le.bellFilled},{id:"profile",label:"Profile",icon:le.user,activeIcon:le.userFilled}],social:[{id:"feed",label:"Feed",icon:le.home,activeIcon:le.homeFilled},{id:"discover",label:"Discover",icon:le.search},{id:"create",label:"Create",icon:le.plus},{id:"activity",label:"Activity",icon:le.heart,activeIcon:le.heartFilled},{id:"profile",label:"Profile",icon:le.user,activeIcon:le.userFilled}],ecommerce:[{id:"shop",label:"Shop",icon:le.home,activeIcon:le.homeFilled},{id:"search",label:"Search",icon:le.search},{id:"cart",label:"Cart",icon:le.cart},{id:"favorites",label:"Wishlist",icon:le.heart,activeIcon:le.heartFilled},{id:"account",label:"Account",icon:le.user,activeIcon:le.userFilled}],messaging:[{id:"chats",label:"Chats",icon:le.inbox},{id:"calls",label:"Calls",icon:le.bell},{id:"contacts",label:"Contacts",icon:le.user,activeIcon:le.userFilled},{id:"settings",label:"Settings",icon:le.settings}]},St=e.createContext(null);function En(){const n=e.useContext(St);if(!n)throw new Error("useMobileHeader must be used within a NiceMobileHeader");return n}function Ln(n={}){const{collapsedHeight:r=56,expandedHeight:s=200,scrollElement:c,mode:i="scroll",threshold:o=0}=n,[d,u]=e.useState(0),[b,N]=e.useState(!0),y=e.useRef(null),j=e.useRef(0),R=e.useRef(!1),f=s-r,m=s-d*f,p=d>=1;e.useEffect(()=>{const T=c||y.current||window,w=()=>{R.current||(R.current=!0,requestAnimationFrame(()=>{const A=T===window?window.scrollY:T.scrollTop,Y=A-j.current;if(i==="scroll"||i==="exitUntilCollapsed"){const E=Math.min(1,Math.max(0,(A-o)/f));u(E)}if(i==="enterAlways"){Y>5&&A>o?N(!1):Y<-5&&N(!0);const E=f>0?Math.min(1,Math.max(0,A/f)):0;u(E)}j.current=A,R.current=!1}))};return T.addEventListener("scroll",w,{passive:!0}),w(),()=>T.removeEventListener("scroll",w)},[c,i,o,f]);const S=e.useCallback(()=>{u(0),N(!0)},[]),M=e.useCallback(()=>{u(1)},[]);return{progress:d,height:m,isCollapsed:p,isVisible:b,scrollRef:y,expand:S,collapse:M}}const Bn=()=>t.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:t.jsx("polyline",{points:"15 18 9 12 15 6"})}),Hn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("line",{x1:"3",y1:"12",x2:"21",y2:"12"}),t.jsx("line",{x1:"3",y1:"6",x2:"21",y2:"6"}),t.jsx("line",{x1:"3",y1:"18",x2:"21",y2:"18"})]}),An=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"11",cy:"11",r:"8"}),t.jsx("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),Yn=()=>t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[t.jsx("circle",{cx:"12",cy:"12",r:"1"}),t.jsx("circle",{cx:"12",cy:"5",r:"1"}),t.jsx("circle",{cx:"12",cy:"19",r:"1"})]}),Fn={back:t.jsx(Bn,{}),menu:t.jsx(Hn,{}),search:t.jsx(An,{}),more:t.jsx(Yn,{})},Vn=({action:n})=>t.jsxs("button",{type:"button",className:`nice-header-action ${n.disabled?"nice-header-action--disabled":""}`,onClick:n.onClick,disabled:n.disabled,"aria-label":n.label,title:n.label,children:[n.icon,n.badge!==void 0&&n.badge!==!1&&t.jsx("span",{className:`nice-header-badge ${n.badge===!0?"nice-header-badge--dot":""}`,children:n.badge!==!0&&n.badge})]}),Ie=e.forwardRef(function({title:r,largeTitle:s,subtitle:c,leftAction:i,rightActions:o=[],background:d,mode:u="scroll",variant:b="default",collapsedHeight:N=56,expandedHeight:y=s||d?140:56,parallax:j=!1,parallaxSpeed:R=.5,showShadow:f=!0,sticky:m=!0,zIndex:p=100,scrollElement:S,onCollapseChange:M,safeArea:T=!0,backgroundColor:w,textColor:A,showBorder:Y=!1,collapsedContent:E,expandedContent:O,className:L="",style:g,children:D,...C},B){const[P,H]=e.useState(0),[Z,_]=e.useState(!0),W=e.useRef(null),K=e.useRef(0),J=e.useRef(!1),ee=y-N,$=y-P*ee,z=P>=.9;e.useEffect(()=>{const l=S||window,k=()=>{J.current||(J.current=!0,requestAnimationFrame(()=>{const I=l===window?window.scrollY:l.scrollTop,G=I-K.current;if(u==="scroll"||u==="exitUntilCollapsed"){const X=ee>0?Math.min(1,Math.max(0,I/ee)):0;H(X),M&&Math.abs(X-P)>.05&&M(X>=.9,X)}if(u==="enterAlways"){G>5&&I>N?_(!1):G<-5&&_(!0);const X=ee>0?Math.min(1,Math.max(0,I/ee)):0;H(X)}K.current=I,J.current=!1}))};return l.addEventListener("scroll",k,{passive:!0}),k(),()=>l.removeEventListener("scroll",k)},[S,u,ee,N,M,P]);const F=1-P*2,V=P>.5?(P-.5)*2:0,h=1-P,v=j?`translateY(${P*ee*R}px) scale(${1+P*.1})`:void 0,x={height:u==="pin"?N:$,zIndex:p,...g};w&&(x.backgroundColor=w),A&&(x.color=A);const a={progress:P,isCollapsed:z,height:$,expandedHeight:y,collapsedHeight:N};return t.jsxs(St.Provider,{value:a,children:[t.jsxs("header",{ref:l=>{W.current=l,typeof B=="function"?B(l):B&&(B.current=l)},className:`
2
2
  nice-mobile-header
3
3
  nice-mobile-header--${b}
4
4
  ${m?"nice-mobile-header--sticky":""}
package/dist/index.mjs CHANGED
@@ -2858,7 +2858,7 @@ function Pr(e = {}) {
2858
2858
  }
2859
2859
  if (i === "enterAlways") {
2860
2860
  V > 5 && z > o ? M(!1) : V < -5 && M(!0);
2861
- const B = Math.min(1, Math.max(0, z / h));
2861
+ const B = h > 0 ? Math.min(1, Math.max(0, z / h)) : 0;
2862
2862
  l(B);
2863
2863
  }
2864
2864
  k.current = z, $.current = !1;
@@ -3005,12 +3005,12 @@ const vn = () => /* @__PURE__ */ n(
3005
3005
  ee.current || (ee.current = !0, requestAnimationFrame(() => {
3006
3006
  const E = s === window ? window.scrollY : s.scrollTop, Q = E - Z.current;
3007
3007
  if (l === "scroll" || l === "exitUntilCollapsed") {
3008
- const C = Math.min(1, Math.max(0, E / re));
3008
+ const C = re > 0 ? Math.min(1, Math.max(0, E / re)) : 0;
3009
3009
  F(C), T && Math.abs(C - S) > 0.05 && T(C >= 0.9, C);
3010
3010
  }
3011
3011
  if (l === "enterAlways") {
3012
3012
  Q > 5 && E > M ? G(!1) : Q < -5 && G(!0);
3013
- const C = Math.min(1, Math.max(0, E / re));
3013
+ const C = re > 0 ? Math.min(1, Math.max(0, E / re)) : 0;
3014
3014
  F(C);
3015
3015
  }
3016
3016
  Z.current = E, ee.current = !1;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice2dev/ui-mobile",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "Nice2Dev UI Mobile - Touch-first React components: BottomSheet, MobileTabs, TouchKeyboard, SwipeActions, Gestures, Haptics, ImageGallery and more",
5
5
  "type": "module",
6
6
  "sideEffects": [