nucleus-core-ts 0.8.6 → 0.8.7
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/client.js +1 -1
- package/dist/dist/index.d.ts +475 -12
- package/dist/fe/index.js +157 -110
- package/dist/index.js +1 -1
- package/dist/nucleus.config.d.ts +3 -0
- package/dist/src/Client/Proxy/index.js +1 -1
- package/package.json +1 -1
- package/scripts/build.ts +62 -8
- package/dist/dist/index-0yyw12k6.d.ts +0 -8
- package/dist/dist/index-tv67j5qd.d.ts +0 -488
- package/dist/index-0yyw12k6.js +0 -1
- package/dist/index-tv67j5qd.js +0 -1
package/dist/fe/index.js
CHANGED
|
@@ -1,110 +1,157 @@
|
|
|
1
|
-
//
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
`,uniforms:{uTime:{value:0},uFlash:{value:0}},transparent:!0,depthWrite:!1});t.current=a}function n(a,i){if(!t.current||!r.current)return;if(t.current.uniforms.uTime)t.current.uniforms.uTime.value+=i;if(t.current.uniforms.uFlash)t.current.uniforms.uFlash.value=e.current;r.current.rotation.z+=i*0.08,r.current.position.x=a.pointer.x*0.05,r.current.position.y=a.pointer.y*0.03}return wa(n),it("mesh",{ref:r,position:[0,0,-0.4],children:[it("planeGeometry",{args:[5.4,3.8,2,2]},void 0,!1,void 0,this),it("primitive",{object:t.current,attach:"material"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Pd({lightningValue:e}){return it("group",{children:[it(zd,{lightningValue:e},void 0,!1,void 0,this),it(Nd,{lightningValue:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Sd(){return it("div",{className:"absolute inset-0 pointer-events-none",children:kd.map(function(t,r){return it("span",{className:"marble-bubble",style:{width:`${t.size}px`,height:`${t.size}px`,left:t.left,top:t.top,animationDelay:t.delay,animationDuration:t.duration,opacity:t.opacity}},`bubble-${r}`,!1,void 0,this)})},void 0,!1,void 0,this)}function lt({className:e}){let r=vd("absolute inset-0 overflow-hidden",e),n=Xr(0);return it("div",{className:r,style:{backgroundColor:"transparent"},children:[it("div",{className:"marble-base-gradient"},void 0,!1,void 0,this),it("div",{className:"marble-secondary-gradient"},void 0,!1,void 0,this),it("div",{className:"marble-overlay-gradient"},void 0,!1,void 0,this),it(fd,{fallback:null,children:it(bd,{className:"marble-canvas",dpr:[1,1.5],gl:{antialias:!0,alpha:!0},camera:{position:[0,0,2.5],fov:45},style:{position:"absolute",top:"50%",left:"50%",width:"150%",height:"150%",transform:"translate(-50%, -50%)"},children:it(Pd,{lightningValue:n},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),it("div",{className:"marble-swirl"},void 0,!1,void 0,this),it(Sd,{},void 0,!1,void 0,this),it("div",{className:"marble-highlight"},void 0,!1,void 0,this),it("div",{className:"marble-glass"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as co}from"@gsap/react";import uo from"gsap";import{useEffect as va,useEffectEvent as yt,useRef as so,useState as lo}from"react";import{clsx as Cd}from"clsx";import{twMerge as Td}from"tailwind-merge";function f(...e){return Td(Cd(e))}import{batch as Ld,createStore as Rd}from"h-state";var Md={roles:[],claims:[],roleClaims:[],selectedRole:null,newRoleName:"",newRoleDescription:"",searchClaim:"",entityFilter:"all",methodFilter:"all",showAssignedOnly:!1,activeTab:"roles",editingScopeClaimId:null,scopeInputValue:"",editingRoleId:null,editRoleDescription:""},{useStore:kn}=Rd(Md,{setRoles:(e)=>(t)=>{e.roles=t},setClaims:(e)=>(t)=>{e.claims=t},setRoleClaims:(e)=>(t)=>{e.roleClaims=t},setSelectedRole:(e)=>(t)=>{e.selectedRole=t},setNewRoleName:(e)=>(t)=>{e.newRoleName=t},setNewRoleDescription:(e)=>(t)=>{e.newRoleDescription=t},setSearchClaim:(e)=>(t)=>{e.searchClaim=t},setEntityFilter:(e)=>(t)=>{e.entityFilter=t},setMethodFilter:(e)=>(t)=>{e.methodFilter=t},setShowAssignedOnly:(e)=>(t)=>{e.showAssignedOnly=t},setActiveTab:(e)=>(t)=>{e.activeTab=t},addRole:(e)=>(t)=>{e.roles=[...e.roles,t]},removeRole:(e)=>(t)=>{if(e.roles=e.roles.filter((r)=>r.id!==t),e.selectedRole?.id===t)e.selectedRole=null},addRoleClaim:(e)=>(t)=>{e.roleClaims=[...e.roleClaims,t]},removeRoleClaim:(e)=>(t)=>{e.roleClaims=e.roleClaims.filter((r)=>r.id!==t)},updateRoleClaimScope:(e)=>(t,r)=>{e.roleClaims=e.roleClaims.map((n)=>n.id===t?{...n,scope:r}:n)},setEditingScopeClaimId:(e)=>(t)=>{if(e.editingScopeClaimId=t,t===null)e.scopeInputValue=""},setScopeInputValue:(e)=>(t)=>{e.scopeInputValue=t},setEditingRoleId:(e)=>(t)=>{if(e.editingRoleId=t,t===null)e.editRoleDescription=""},setEditRoleDescription:(e)=>(t)=>{e.editRoleDescription=t},updateRole:(e)=>(t,r)=>{if(e.roles=e.roles.map((n)=>n.id===t?{...n,...r}:n),e.selectedRole?.id===t)e.selectedRole={...e.selectedRole,...r}},resetForm:(e)=>()=>{Ld(()=>{e.newRoleName="",e.newRoleDescription=""})}});import{jsxDEV as q}from"react/jsx-dev-runtime";uo.registerPlugin(co);var Id={GET:"bg-blue-500/10 text-blue-600 dark:text-blue-400 border-blue-500/20",POST:"bg-emerald-500/10 text-emerald-600 dark:text-emerald-400 border-emerald-500/20",PUT:"bg-amber-500/10 text-amber-600 dark:text-amber-400 border-amber-500/20",PATCH:"bg-orange-500/10 text-orange-600 dark:text-orange-400 border-orange-500/20",DELETE:"bg-red-500/10 text-red-600 dark:text-red-400 border-red-500/20"};function po({title:e="Authorization Management",subtitle:t,className:r,defaultEntityFilter:n="all",defaultMethodFilter:a="all",defaultShowAssignedOnly:i=!1,getRolesAction:o,addRoleAction:s,updateRoleAction:l,deleteRoleAction:c,getClaimsAction:d,getRoleClaimsAction:u,addRoleClaimAction:w,updateRoleClaimAction:g,deleteRoleClaimAction:m,onRoleCreated:S,onRoleDeleted:b,onClaimToggled:z}){let k=kn(),R=so(null),p=so(null),[T,y]=lo(new Set),[N,L]=lo("");co(()=>{if(!p.current)return;uo.fromTo(p.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,ease:"power2.out"})},{scope:R});let O=yt(()=>{o.start({payload:{page:1,limit:100},onAfterHandle:(M)=>{if(M.data?.items)k.setRoles(M.data.items)}})}),F=yt(()=>{d.start({payload:{page:1,limit:1000},onAfterHandle:(M)=>{if(M.data?.items)k.setClaims(M.data.items)}})}),Y=yt((M)=>{u.start({payload:{page:1,limit:1000,filters:[{field:"role_id",operator:"eq",value:M}]},onAfterHandle:(ie)=>{if(ie.data?.items)k.setRoleClaims(ie.data.items)}})});va(()=>{O(),F()},[]);let re=yt(()=>{k.setEntityFilter(n),k.setMethodFilter(a),k.setShowAssignedOnly(i)});va(()=>{re()},[]),va(()=>{if(k.selectedRole)Y(k.selectedRole.id);else k.setRoleClaims([])},[k.selectedRole]);let E=yt(()=>{if(!k.newRoleName.trim())return;let M=`temp-${Date.now()}`,ie={id:M,name:k.newRoleName.trim(),description:k.newRoleDescription.trim()||"",createdAt:new Date,updatedAt:new Date};k.addRole(ie),k.resetForm(),s.start({payload:{name:ie.name,description:ie.description||void 0},onAfterHandle:(Ne)=>{if(O(),Ne.data)S?.(Ne.data)},onErrorHandle:()=>{k.removeRole(M)}})}),_=yt((M)=>{let ie=k.roles.find((Ne)=>Ne.id===M);if(!ie)return;k.removeRole(M),c.start({payload:{id:M},onAfterHandle:()=>{O(),b?.(M)},onErrorHandle:()=>{if(ie)k.addRole(ie)}})}),A=yt((M)=>{k.setEditingRoleId(M.id),k.setEditRoleDescription(M.description||"")}),ee=yt(()=>{k.setEditingRoleId(null)}),v=yt(()=>{let M=k.editingRoleId;if(!M||!l)return;let ie=k.roles.find((rt)=>rt.id===M);if(!ie)return;let Ne=ie.description,De=k.editRoleDescription;k.updateRole(M,{description:De}),k.setEditingRoleId(null),l.start({payload:{id:M,description:De},onAfterHandle:()=>{O()},onErrorHandle:()=>{k.updateRole(M,{description:Ne})}})}),G=yt((M,ie)=>{let Ne=k.selectedRole;if(!Ne)return;let De=Ne.id;if(ie){let rt=k.roleClaims.find((Ve)=>Ve.claimId===M.id);if(!rt)return;k.removeRoleClaim(rt.id),m.start({payload:{id:rt.id},onAfterHandle:()=>{Y(De),z?.(M,!1)},onErrorHandle:()=>{k.addRoleClaim(rt)}})}else{let rt=`temp-${Date.now()}`,Ve={id:rt,roleId:De,claimId:M.id,scope:"",createdAt:new Date,updatedAt:new Date};k.addRoleClaim(Ve),w.start({payload:{roleId:De,claimId:M.id},onAfterHandle:()=>{Y(De),z?.(M,!0)},onErrorHandle:()=>{k.removeRoleClaim(rt)}})}}),K=yt((M)=>{k.setSelectedRole(M)}),se=yt((M)=>{k.setSearchClaim(M)}),H=yt((M)=>{k.setEntityFilter(M||"all")}),U=yt((M)=>{k.setMethodFilter(M||"all")}),C=yt((M)=>{k.setShowAssignedOnly(M)}),de=yt((M,ie)=>{if(!g||!k.selectedRole)return;k.updateRoleClaimScope(M,ie),g.start({payload:{id:M,scope:ie},onAfterHandle:()=>{Y(k.selectedRole?.id||"")},onErrorHandle:()=>{Y(k.selectedRole?.id||"")}})}),B=(M)=>{let ie=M.split(".");if(ie[1]==="bulk")return ie[2]||"bulk";return ie[1]||"other"},ae=k.searchClaim.trim().toLowerCase(),ge=k.entityFilter.toLowerCase(),Ye=k.methodFilter.toLowerCase(),Ie=k.showAssignedOnly&&!!k.selectedRole,Pe=new Set(k.roleClaims.map((M)=>M.claimId)),pe=k.claims.filter((M)=>{let ie=ae?M.action.toLowerCase().includes(ae)||M.description.toLowerCase().includes(ae):!0,Ne=B(M.action).toLowerCase(),De=ge==="all"||Ne===ge,rt=Ye==="all"||M.method.toLowerCase()===Ye,Ve=Ie?Pe.has(M.id):!0;return ie&&De&&rt&&Ve}),ke=[{value:"all",label:"All Entities"},...Array.from(new Set(k.claims.map((M)=>B(M.action)))).sort((M,ie)=>M.localeCompare(ie)).map((M)=>({value:M,label:M}))],Te=[{value:"all",label:"All Methods"},{value:"get",label:"GET"},{value:"post",label:"POST"},{value:"put",label:"PUT"},{value:"patch",label:"PATCH"},{value:"delete",label:"DELETE"}],we=pe.reduce((M,ie)=>{let Ne=B(ie.action);if(!M[Ne])M[Ne]=[];return M[Ne].push(ie),M},{}),be=Object.keys(we).sort((M,ie)=>M.localeCompare(ie)),P=(M)=>{y((ie)=>{let Ne=new Set(ie);if(Ne.has(M))Ne.delete(M);else Ne.add(M);return Ne})},j=()=>{y(new Set(be))},Z=()=>{y(new Set)},me=(M,ie)=>{let Ne=we[M]||[];for(let De of Ne){let rt=Pe.has(De.id);if(ie&&!rt)G(De,!1);else if(!ie&&rt)G(De,!0)}},J=(M)=>{return(we[M]||[]).filter((Ne)=>Pe.has(Ne.id)).length},te=(M)=>k.roleClaims.find((ie)=>ie.claimId===M),D=(M)=>{if(g&&k.scopeInputValue!==void 0)de(M,k.scopeInputValue),k.setEditingScopeClaimId(null)},We=(M,ie)=>{k.setScopeInputValue(ie||""),k.setEditingScopeClaimId(M)};return q("main",{ref:R,className:f("min-h-screen bg-zinc-50 dark:bg-zinc-950 p-4 sm:p-6 lg:p-8",r),children:q("div",{ref:p,className:"max-w-[1600px] mx-auto",children:[q("header",{className:"mb-6",children:[q("h1",{className:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-zinc-100",children:e},void 0,!1,void 0,this),t&&q("p",{className:"mt-1 text-sm text-zinc-500 dark:text-zinc-400",children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q("div",{className:"grid grid-cols-1 xl:grid-cols-[320px_1fr] gap-6",children:[q("aside",{className:"space-y-4",children:[q("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-4",children:[q("h2",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100 mb-3",children:"Roles"},void 0,!1,void 0,this),q("div",{className:"space-y-2 mb-4",children:[q("input",{type:"text",value:k.newRoleName,onChange:(M)=>k.setNewRoleName(M.target.value),placeholder:"New role name",className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this),q("button",{type:"button",onClick:E,disabled:!k.newRoleName.trim()||s.state.isPending,className:"w-full px-3 py-2 text-sm font-medium text-white bg-emerald-600 hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed rounded-lg transition-colors",children:s.state.isPending?"Creating...":"Create Role"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q("div",{className:"space-y-1 max-h-[300px] overflow-y-auto",children:k.roles.map((M)=>q("div",{className:f("w-full text-left px-3 py-2 rounded-lg text-sm transition-colors group",M.id.startsWith("temp-")&&"opacity-50",k.selectedRole?.id===M.id?"bg-emerald-100 dark:bg-emerald-900/30 text-emerald-900 dark:text-emerald-100":"hover:bg-zinc-100 dark:hover:bg-zinc-800 text-zinc-700 dark:text-zinc-300"),children:[q("div",{className:"flex items-center justify-between",children:[q("button",{type:"button",onClick:()=>K(M),disabled:M.id.startsWith("temp-"),className:"flex-1 text-left truncate disabled:cursor-not-allowed font-medium",children:M.name},void 0,!1,void 0,this),q("div",{className:"flex items-center gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[M.name!=="godmin"&&!M.id.startsWith("temp-")&&l&&q("button",{type:"button",onClick:()=>A(M),className:"p-1 text-zinc-500 hover:text-emerald-600 transition-colors",title:"Edit description",children:q("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:q("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),M.name!=="godmin"&&!M.id.startsWith("temp-")&&q("button",{type:"button",onClick:()=>_(M.id),className:"p-1 text-red-500 hover:text-red-700 transition-colors",title:"Delete role",children:q("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:q("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.editingRoleId===M.id?q("div",{className:"mt-2 space-y-2",children:[q("textarea",{value:k.editRoleDescription,onChange:(ie)=>k.setEditRoleDescription(ie.target.value),placeholder:"Enter description...",rows:2,className:"w-full px-2 py-1.5 text-xs border border-zinc-200 dark:border-zinc-700 rounded bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 resize-none"},void 0,!1,void 0,this),q("div",{className:"flex gap-2",children:[q("button",{type:"button",onClick:v,className:"flex-1 px-2 py-1 text-xs font-medium text-white bg-emerald-600 hover:bg-emerald-700 rounded transition-colors",children:"Save"},void 0,!1,void 0,this),q("button",{type:"button",onClick:ee,className:"flex-1 px-2 py-1 text-xs font-medium text-zinc-600 dark:text-zinc-400 bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 rounded transition-colors",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):M.description&&q("p",{className:"mt-1 text-xs text-zinc-500 dark:text-zinc-400 truncate",children:M.description},void 0,!1,void 0,this)]},M.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q("div",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 p-4",children:[q("h2",{className:"text-sm font-semibold text-zinc-900 dark:text-zinc-100 mb-3",children:"Filters"},void 0,!1,void 0,this),q("div",{className:"space-y-3",children:[q("div",{children:[q("label",{htmlFor:"claim-search",className:"block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1",children:"Search"},void 0,!1,void 0,this),q("input",{id:"claim-search",type:"text",value:N,onChange:(M)=>{L(M.target.value),se(M.target.value)},placeholder:"Search claims...",className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q("div",{children:[q("label",{htmlFor:"entity-filter",className:"block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1",children:"Entity"},void 0,!1,void 0,this),q("select",{id:"entity-filter",value:k.entityFilter,onChange:(M)=>H(M.target.value),className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100",children:ke.map((M)=>q("option",{value:M.value,children:M.label},M.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q("div",{children:[q("label",{htmlFor:"method-filter",className:"block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1",children:"Method"},void 0,!1,void 0,this),q("select",{id:"method-filter",value:k.methodFilter,onChange:(M)=>U(M.target.value),className:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100",children:Te.map((M)=>q("option",{value:M.value,children:M.label},M.value,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q("label",{className:"flex items-center gap-2 cursor-pointer",children:[q("input",{type:"checkbox",checked:k.showAssignedOnly,onChange:(M)=>C(M.target.checked),disabled:!k.selectedRole,className:"w-4 h-4 rounded border-zinc-300 dark:border-zinc-600 text-emerald-600 focus:ring-emerald-500 disabled:opacity-50"},void 0,!1,void 0,this),q("span",{className:f("text-sm",!k.selectedRole?"text-zinc-400":"text-zinc-700 dark:text-zinc-300"),children:"Show assigned only"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),k.selectedRole&&q("div",{className:"bg-emerald-50 dark:bg-emerald-900/20 rounded-xl border border-emerald-200 dark:border-emerald-800 p-4",children:[q("div",{className:"text-sm font-medium text-emerald-900 dark:text-emerald-100",children:k.selectedRole.name},void 0,!1,void 0,this),q("div",{className:"text-2xl font-bold text-emerald-600 dark:text-emerald-400 mt-1",children:k.roleClaims.length},void 0,!1,void 0,this),q("div",{className:"text-xs text-emerald-700 dark:text-emerald-300",children:"claims assigned"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q("section",{className:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800",children:[q("div",{className:"p-4 border-b border-zinc-200 dark:border-zinc-800 flex flex-wrap items-center justify-between gap-3",children:[q("div",{children:[q("h2",{className:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",children:"Claims"},void 0,!1,void 0,this),q("p",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:[pe.length," of ",k.claims.length," claims \u2022"," ",be.length," entities"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q("div",{className:"flex items-center gap-2",children:[q("button",{type:"button",onClick:j,className:"px-3 py-1.5 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 border border-zinc-200 dark:border-zinc-700 rounded-lg transition-colors",children:"Expand All"},void 0,!1,void 0,this),q("button",{type:"button",onClick:Z,className:"px-3 py-1.5 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 border border-zinc-200 dark:border-zinc-700 rounded-lg transition-colors",children:"Collapse All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q("div",{className:"max-h-[calc(100vh-280px)] overflow-y-auto",children:be.length===0?q("div",{className:"p-8 text-center text-zinc-500 dark:text-zinc-400",children:"No claims match your filters"},void 0,!1,void 0,this):be.map((M)=>{let ie=we[M]||[],Ne=T.has(M),De=J(M),rt=De===ie.length;return q("div",{className:"border-b border-zinc-100 dark:border-zinc-800 last:border-b-0",children:[q("button",{type:"button",className:"w-full flex items-center justify-between px-4 py-3 cursor-pointer hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors text-left",onClick:()=>P(M),children:q("div",{className:"flex items-center gap-3",children:[q("svg",{className:f("w-4 h-4 text-zinc-400 transition-transform",Ne&&"rotate-90"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:q("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this),q("span",{className:"font-medium text-zinc-900 dark:text-zinc-100",children:M},void 0,!1,void 0,this),q("span",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[ie.length," claims"]},void 0,!0,void 0,this),k.selectedRole&&q("span",{className:f("text-xs px-2 py-0.5 rounded-full",rt?"bg-emerald-100 text-emerald-700 dark:bg-emerald-900/30 dark:text-emerald-400":De>0?"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400":"bg-zinc-100 text-zinc-500 dark:bg-zinc-800 dark:text-zinc-400"),children:[De,"/",ie.length]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),k.selectedRole&&k.selectedRole.name!=="godmin"&&q("div",{className:"flex items-center gap-2 px-4 pb-2",children:[q("button",{type:"button",onClick:()=>me(M,!0),className:"px-2 py-1 text-xs font-medium text-emerald-600 hover:text-emerald-700 dark:text-emerald-400 dark:hover:text-emerald-300 border border-emerald-200 dark:border-emerald-800 rounded",children:"Assign All"},void 0,!1,void 0,this),q("button",{type:"button",onClick:()=>me(M,!1),className:"px-2 py-1 text-xs font-medium text-red-600 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300 border border-red-200 dark:border-red-800 rounded",children:"Remove All"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ne&&q("div",{className:"px-4 pb-3",children:q("div",{className:"bg-zinc-50 dark:bg-zinc-800/50 rounded-lg divide-y divide-zinc-100 dark:divide-zinc-700/50",children:ie.map((Ve)=>{let $t=Pe.has(Ve.id),Tt=te(Ve.id),mr=k.editingScopeClaimId===Ve.id,_t=Tt?.scope||"",W=Ve.id.startsWith("temp-")||Tt?.id.startsWith("temp-");return q("div",{className:f("p-3 transition-colors",$t&&"bg-emerald-50/50 dark:bg-emerald-900/10"),children:q("div",{className:"flex items-start gap-3",children:[q("input",{type:"checkbox",checked:$t,onChange:()=>G(Ve,$t),disabled:!k.selectedRole||k.selectedRole.name==="godmin"||W||w.state.isPending||m.state.isPending,className:"mt-1 w-4 h-4 rounded border-zinc-300 dark:border-zinc-600 text-emerald-600 focus:ring-emerald-500 disabled:opacity-50"},void 0,!1,void 0,this),q("div",{className:"flex-1 min-w-0",children:[q("div",{className:"flex items-center gap-2 flex-wrap",children:[q("code",{className:"text-sm text-zinc-900 dark:text-zinc-100",children:Ve.action},void 0,!1,void 0,this),q("span",{className:f("px-1.5 py-0.5 text-xs font-medium rounded border",Id[Ve.method]||"bg-zinc-100 text-zinc-600"),children:Ve.method},void 0,!1,void 0,this)]},void 0,!0,void 0,this),q("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:Ve.description},void 0,!1,void 0,this),$t&&Tt&&!W&&q("div",{className:"mt-2",children:mr?q("div",{className:"flex items-center gap-2",children:[q("input",{type:"text",value:k.scopeInputValue,onChange:(le)=>k.setScopeInputValue(le.target.value),placeholder:"e.g. user_id=123&tenant_id=456",className:"flex-1 px-2 py-1 text-xs border border-zinc-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this),q("button",{type:"button",onClick:()=>D(Tt.id),className:"px-2 py-1 text-xs font-medium text-white bg-emerald-600 hover:bg-emerald-700 rounded transition-colors",children:"Save"},void 0,!1,void 0,this),q("button",{type:"button",onClick:()=>k.setEditingScopeClaimId(null),className:"px-2 py-1 text-xs font-medium text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 transition-colors",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):q("button",{type:"button",onClick:()=>We(Ve.id,_t),className:"text-xs text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 transition-colors",children:_t?q("span",{className:"font-mono bg-zinc-200 dark:bg-zinc-700 px-1.5 py-0.5 rounded",children:["scope: ",_t]},void 0,!0,void 0,this):q("span",{className:"italic hover:underline",children:"+ Add scope filter"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},Ve.id,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},M,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}var ot={container:"min-h-screen bg-zinc-50 dark:bg-zinc-950 p-4 sm:p-6",header:{wrapper:"mb-6 sm:mb-8",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm sm:text-base text-zinc-500 dark:text-zinc-400 mt-1"},tabs:{wrapper:"flex gap-2 sm:gap-4 mb-4 sm:mb-6",button:"px-3 sm:px-4 py-2 rounded-lg font-medium transition-colors text-sm sm:text-base",buttonActive:"bg-blue-600 text-white",buttonInactive:"bg-zinc-200 dark:bg-zinc-800 text-zinc-700 dark:text-zinc-300 hover:bg-zinc-300 dark:hover:bg-zinc-700"},filters:{wrapper:"mb-4 sm:mb-6 md:mb-6 lg:mb-8 xl:mb-8 2xl:mb-10",row:"grid grid-cols-1 gap-3 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 xl:grid-cols-6 2xl:grid-cols-8",control:"flex flex-col justify-end",search:"sm:col-span-2 md:col-span-2 lg:col-span-2 xl:col-span-3 2xl:col-span-4",searchContainer:"w-full",searchInput:"text-sm sm:text-sm md:text-sm lg:text-sm xl:text-base 2xl:text-base",toggle:"items-start sm:items-end"},card:{wrapper:"bg-white dark:bg-zinc-900 rounded-xl shadow-sm border border-zinc-200 dark:border-zinc-800 p-4 sm:p-6",header:"text-lg sm:text-xl font-semibold text-zinc-900 dark:text-zinc-100 mb-4"},roleList:{wrapper:"space-y-2",item:"w-full text-left p-3 sm:p-4 rounded-lg cursor-pointer transition-colors border",itemSelected:"bg-blue-50 dark:bg-blue-900/20 border-2 border-blue-500",itemHover:"bg-zinc-50 dark:bg-zinc-800 border-zinc-200 dark:border-zinc-700 hover:border-blue-300 dark:hover:border-blue-700",name:"font-medium text-zinc-900 dark:text-zinc-100",description:"text-sm text-zinc-500 dark:text-zinc-400 mt-1",badge:"ml-2 px-2 py-0.5 text-xs bg-purple-100 dark:bg-purple-900 text-purple-700 dark:text-purple-300 rounded-full",deleteButton:"p-2 text-red-500 hover:bg-red-50 dark:hover:bg-red-900/20 rounded-lg transition-colors"},claimList:{wrapper:"space-y-4",group:"border border-zinc-200 dark:border-zinc-700 rounded-lg overflow-hidden",groupHeader:"bg-zinc-100 dark:bg-zinc-800 px-3 sm:px-4 py-2 font-medium text-zinc-700 dark:text-zinc-300 capitalize text-sm sm:text-base",item:"px-3 sm:px-4 py-2",itemAction:"text-sm font-mono text-zinc-900 dark:text-zinc-100 truncate",itemDescription:"text-xs text-zinc-500 dark:text-zinc-400",methodBadge:{get:"bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300",post:"bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300",put:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300",patch:"bg-yellow-100 text-yellow-700 dark:bg-yellow-900 dark:text-yellow-300",delete:"bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300"}},form:{wrapper:"mb-4 sm:mb-6 p-3 sm:p-4 bg-zinc-50 dark:bg-zinc-800 rounded-lg",title:"text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-3",input:"w-full px-3 py-2 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm sm:text-base",button:"w-full px-4 py-2 bg-blue-600 text-white rounded-lg font-medium hover:bg-blue-700 transition-colors text-sm sm:text-base",buttonDisabled:"opacity-50 cursor-not-allowed"},search:{input:"w-full px-3 py-2 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-900 text-zinc-900 dark:text-zinc-100 focus:ring-2 focus:ring-blue-500 focus:border-transparent text-sm sm:text-base mb-4"},checkbox:{wrapper:"flex items-center gap-3 px-3 sm:px-4 py-2 hover:bg-zinc-50 dark:hover:bg-zinc-800 cursor-pointer",input:"w-4 h-4 text-blue-600 rounded border-zinc-300 dark:border-zinc-600 focus:ring-blue-500",label:"flex-1 min-w-0"},empty:{wrapper:"text-center py-6 sm:py-8",icon:"w-10 h-10 sm:w-12 sm:h-12 mx-auto text-purple-500 mb-2",text:"text-zinc-600 dark:text-zinc-400"},loading:{wrapper:"text-center py-6 sm:py-8",text:"text-zinc-500 text-sm sm:text-base"},stats:{text:"text-sm text-zinc-500 dark:text-zinc-400 mb-4"}};function mo(e){return{...ot,...e,header:{...ot.header,...e.header},tabs:{...ot.tabs,...e.tabs},filters:{...ot.filters,...e.filters},card:{...ot.card,...e.card},roleList:{...ot.roleList,...e.roleList},claimList:{...ot.claimList,...e.claimList,methodBadge:{...ot.claimList.methodBadge,...e.claimList?.methodBadge}},form:{...ot.form,...e.form},search:{...ot.search,...e.search},checkbox:{...ot.checkbox,...e.checkbox},empty:{...ot.empty,...e.empty},loading:{...ot.loading,...e.loading},stats:{...ot.stats,...e.stats}}}import{jsxDEV as gt}from"react/jsx-dev-runtime";function go({claims:e,isLoading:t}){let r=ot,n=(o)=>{let s=o.split(".");if(s[1]==="bulk")return s[2]||"bulk";return s[1]||"other"},a=e.reduce((o,s)=>{let l=n(s.action);if(!o[l])o[l]=[];return o[l].push(s),o},{}),i=(o)=>{let s=o.toLowerCase();if(s==="get")return r.claimList.methodBadge.get;if(s==="post")return r.claimList.methodBadge.post;if(s==="put")return r.claimList.methodBadge.put;if(s==="patch")return r.claimList.methodBadge.patch;if(s==="delete")return r.claimList.methodBadge.delete;return r.claimList.methodBadge.get};return gt("div",{className:r.card.wrapper,children:[gt("h2",{className:r.card.header,children:"All Claims"},void 0,!1,void 0,this),t?gt("div",{className:r.loading.wrapper,children:gt("span",{className:r.loading.text,children:"Loading claims..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Object.keys(a).length===0?gt("div",{className:r.empty.wrapper,children:gt("span",{className:r.empty.text,children:"No claims match the filters."},void 0,!1,void 0,this)},void 0,!1,void 0,this):gt("div",{className:r.claimList.wrapper,children:Object.entries(a).map(([o,s])=>gt("div",{className:r.claimList.group,children:[gt("div",{className:r.claimList.groupHeader,children:[o," (",s.length,")"]},void 0,!0,void 0,this),gt("div",{className:"divide-y divide-zinc-200 dark:divide-zinc-700",children:s.map((l)=>gt("div",{className:r.claimList.item,children:gt("div",{className:"flex items-center justify-between",children:[gt("div",{className:"flex-1 min-w-0",children:[gt("div",{className:r.claimList.itemAction,children:l.action},void 0,!1,void 0,this),gt("div",{className:r.claimList.itemDescription,children:l.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),gt("div",{className:"flex items-center gap-2",children:gt("span",{className:f("px-2 py-0.5 text-xs rounded-full",i(l.method)),children:l.method},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},l.id,!1,void 0,this))},void 0,!1,void 0,this)]},o,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as xe}from"react/jsx-dev-runtime";function bo({selectedRole:e,claims:t,roleClaims:r,isLoading:n,isToggling:a,onToggleClaim:i,onUpdateScope:o,editingScope:s,onEditScope:l,scopeValue:c,onScopeValueChange:d}){let u=ot,w=(R)=>{let p=R.split(".");if(p[1]==="bulk")return p[2]||"bulk";return p[1]||"other"},g=t.reduce((R,p)=>{let T=w(p.action);if(!R[T])R[T]=[];return R[T].push(p),R},{}),m=(R)=>r.some((p)=>p.claimId===R),S=(R)=>r.find((p)=>p.claimId===R),b=(R)=>{if(o&&c!==void 0)o(R,c),l?.(null)},z=()=>{l?.(null)},k=(R,p)=>{d?.(p||""),l?.(R)};if(!e)return xe("div",{className:u.card.wrapper,children:[xe("h2",{className:u.card.header,children:"Select a role"},void 0,!1,void 0,this),xe("div",{className:u.empty.wrapper,children:xe("span",{className:u.empty.text,children:"Select a role from the list to manage its claims"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.name==="godmin")return xe("div",{className:u.card.wrapper,children:[xe("h2",{className:u.card.header,children:['Claims for "',e.name,'"']},void 0,!0,void 0,this),xe("div",{className:u.empty.wrapper,children:[xe("svg",{className:u.empty.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:xe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),xe("p",{className:u.empty.text,children:["Godmin role has full access to all resources.",xe("br",{},void 0,!1,void 0,this),"Claims cannot be modified."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return xe("div",{className:u.card.wrapper,children:[xe("h2",{className:u.card.header,children:['Claims for "',e.name,'"']},void 0,!0,void 0,this),xe("div",{className:u.stats.text,children:[r.length," claims assigned"]},void 0,!0,void 0,this),n?xe("div",{className:u.loading.wrapper,children:xe("span",{className:u.loading.text,children:"Loading claims..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):Object.keys(g).length===0?xe("div",{className:u.empty.wrapper,children:xe("span",{className:u.empty.text,children:"No claims match the filters."},void 0,!1,void 0,this)},void 0,!1,void 0,this):xe("div",{className:"max-h-[500px] overflow-y-auto space-y-4",children:Object.entries(g).map(([R,p])=>xe("div",{className:u.claimList.group,children:[xe("div",{className:u.claimList.groupHeader,children:[R," (",p.length,")"]},void 0,!0,void 0,this),xe("div",{className:"divide-y divide-zinc-200 dark:divide-zinc-700",children:p.map((T)=>{let y=m(T.id),N=S(T.id),L=s===T.id,O=N?.scope||"";return xe("div",{className:f("py-3 px-2 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors",y&&"bg-emerald-50/50 dark:bg-emerald-900/10"),children:xe("div",{className:"flex items-start gap-3",children:[xe("input",{type:"checkbox",checked:y,onChange:()=>i(T,y),disabled:a||T.id.startsWith("temp-"),className:f(u.checkbox.input,"mt-1 shrink-0")},void 0,!1,void 0,this),xe("div",{className:"flex-1 min-w-0",children:[xe("div",{className:"flex items-center gap-2 flex-wrap",children:[xe("span",{className:"text-sm font-mono text-zinc-900 dark:text-zinc-100 truncate",children:T.action},void 0,!1,void 0,this),xe("span",{className:f("px-1.5 py-0.5 text-xs font-medium rounded",T.method==="GET"&&"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",T.method==="POST"&&"bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",T.method==="PUT"&&"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400",T.method==="PATCH"&&"bg-orange-100 text-orange-700 dark:bg-orange-900/30 dark:text-orange-400",T.method==="DELETE"&&"bg-red-100 text-red-700 dark:bg-red-900/30 dark:text-red-400"),children:T.method},void 0,!1,void 0,this)]},void 0,!0,void 0,this),xe("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:T.description},void 0,!1,void 0,this),y&&N&&!N.id.startsWith("temp-")&&xe("div",{className:"mt-2",children:L?xe("div",{className:"flex items-center gap-2",children:[xe("input",{type:"text",value:c||"",onChange:(F)=>d?.(F.target.value),placeholder:"e.g. user_id=123&tenant_id=456",className:"flex-1 px-2 py-1 text-xs border border-zinc-300 dark:border-zinc-600 rounded bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400"},void 0,!1,void 0,this),xe("button",{type:"button",onClick:()=>b(N.id),className:"px-2 py-1 text-xs font-medium text-white bg-emerald-600 hover:bg-emerald-700 rounded transition-colors",children:"Save"},void 0,!1,void 0,this),xe("button",{type:"button",onClick:z,className:"px-2 py-1 text-xs font-medium text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-zinc-100 transition-colors",children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):xe("button",{type:"button",onClick:()=>k(T.id,O),className:"text-xs text-zinc-500 dark:text-zinc-400 hover:text-zinc-700 dark:hover:text-zinc-200 transition-colors",children:O?xe("span",{className:"font-mono bg-zinc-100 dark:bg-zinc-800 px-1.5 py-0.5 rounded",children:["Scope: ",O]},void 0,!0,void 0,this):xe("span",{className:"italic",children:"+ Add scope filter"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},T.id,!1,void 0,this)})},void 0,!1,void 0,this)]},R,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as dt}from"react/jsx-dev-runtime";function fo({roles:e,selectedRole:t,isLoading:r,isCreating:n,isDeleting:a,newRoleName:i,newRoleDescription:o,onNewRoleNameChange:s,onNewRoleDescriptionChange:l,onSelectRole:c,onDeleteRole:d,onCreateRole:u}){let w=ot,g=(S,b)=>{if(S.stopPropagation(),confirm("Are you sure you want to delete this role?"))d(b)},m=(S)=>S.startsWith("temp-");return dt("div",{className:w.card.wrapper,children:[dt("h2",{className:w.card.header,children:"Roles"},void 0,!1,void 0,this),dt("div",{className:w.form.wrapper,children:[dt("h3",{className:w.form.title,children:"Create New Role"},void 0,!1,void 0,this),dt("div",{className:"space-y-3",children:[dt("input",{type:"text",placeholder:"Role name",value:i,onChange:(S)=>s(S.target.value),className:w.form.input},void 0,!1,void 0,this),dt("input",{type:"text",placeholder:"Description (optional)",value:o,onChange:(S)=>l(S.target.value),className:w.form.input},void 0,!1,void 0,this),dt("button",{type:"button",onClick:u,disabled:!i.trim()||n,className:f(w.form.button,(!i.trim()||n)&&w.form.buttonDisabled),children:n?"Creating...":"Create Role"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),r?dt("div",{className:w.loading.wrapper,children:dt("span",{className:w.loading.text,children:"Loading roles..."},void 0,!1,void 0,this)},void 0,!1,void 0,this):dt("div",{className:w.roleList.wrapper,children:e.map((S)=>dt("button",{type:"button",onClick:()=>c(S),disabled:m(S.id),className:f(w.roleList.item,t?.id===S.id?w.roleList.itemSelected:w.roleList.itemHover,m(S.id)&&"opacity-50 cursor-wait"),children:dt("div",{className:"flex items-center justify-between",children:[dt("div",{children:[dt("h4",{className:w.roleList.name,children:[S.name,S.name==="godmin"&&dt("span",{className:w.roleList.badge,children:"Super Admin"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S.description&&dt("p",{className:w.roleList.description,children:S.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this),S.name!=="godmin"&&!m(S.id)&&dt("button",{type:"button",onClick:(b)=>g(b,S.id),disabled:a,className:f(w.roleList.deleteButton,a&&"opacity-50 cursor-not-allowed"),children:dt("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:dt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},S.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as ho}from"@gsap/react";import vn from"gsap";import{forwardRef as Ud,useLayoutEffect as Bd,useRef as xa,useState as Ad}from"react";var wn={base:"relative inline-flex items-center justify-center overflow-hidden select-none",display:"inline-flex",alignment:"items-center justify-center",font:{weight:"font-semibold",family:"font-sans"},transition:"transition-all duration-200 ease-out",focus:"focus:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:ring-violet-500 dark:focus-visible:ring-offset-gray-900",disabled:{opacity:"disabled:opacity-50",cursor:"disabled:cursor-not-allowed disabled:pointer-events-none"},fullWidth:"w-full",size:{xs:{padding:"px-2.5 py-1",text:"text-xs",height:"h-7",iconSize:"w-3 h-3",gap:"gap-1"},sm:{padding:"px-3 py-1.5",text:"text-sm",height:"h-8",iconSize:"w-3.5 h-3.5",gap:"gap-1.5"},md:{padding:"px-4 py-2",text:"text-sm",height:"h-10",iconSize:"w-4 h-4",gap:"gap-2"},lg:{padding:"px-5 py-2.5",text:"text-base",height:"h-12",iconSize:"w-5 h-5",gap:"gap-2.5"},xl:{padding:"px-6 py-3",text:"text-lg",height:"h-14",iconSize:"w-6 h-6",gap:"gap-3"}},shape:{default:"rounded-lg",rounded:"rounded-xl",pill:"rounded-full",square:"rounded-none"},iconOnly:{xs:"w-7 h-7 p-0",sm:"w-8 h-8 p-0",md:"w-10 h-10 p-0",lg:"w-12 h-12 p-0",xl:"w-14 h-14 p-0"},variant:{nucleus:{background:"bg-zinc-900 dark:bg-white",text:"text-white dark:text-zinc-900",border:"border-0",shadow:"shadow-sm",hover:"hover:bg-zinc-800 dark:hover:bg-zinc-100",active:"active:bg-zinc-950 dark:active:bg-zinc-200 active:scale-[0.98]"},"nucleus-outline":{background:"bg-transparent",text:"text-zinc-900 dark:text-white",border:"border-2 border-zinc-900 dark:border-white",shadow:"",hover:"hover:bg-zinc-900 hover:text-white dark:hover:bg-white dark:hover:text-zinc-900",active:"active:bg-zinc-800 dark:active:bg-zinc-100 active:scale-[0.98]"},"nucleus-ghost":{background:"bg-transparent",text:"text-zinc-700 dark:text-zinc-300",border:"border-0",shadow:"",hover:"hover:bg-zinc-100 dark:hover:bg-zinc-800",active:"active:bg-zinc-200 dark:active:bg-zinc-700"},"nucleus-soft":{background:"bg-zinc-100 dark:bg-zinc-800",text:"text-zinc-900 dark:text-white",border:"border-0",shadow:"",hover:"hover:bg-zinc-200 dark:hover:bg-zinc-700",active:"active:bg-zinc-300 dark:active:bg-zinc-600 active:scale-[0.98]"},primary:{background:"bg-blue-600 dark:bg-blue-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-blue-500/20",hover:"hover:bg-blue-500 hover:shadow-lg hover:shadow-blue-500/30 hover:-translate-y-0.5",active:"active:bg-blue-700 active:translate-y-0 active:shadow-sm"},secondary:{background:"bg-gray-100 dark:bg-gray-800",text:"text-gray-900 dark:text-gray-100",border:"border border-gray-200 dark:border-gray-700",shadow:"shadow-sm",hover:"hover:bg-gray-200 dark:hover:bg-gray-700 hover:shadow-md hover:-translate-y-0.5",active:"active:bg-gray-300 dark:active:bg-gray-600 active:translate-y-0"},success:{background:"bg-emerald-600 dark:bg-emerald-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-emerald-500/20",hover:"hover:bg-emerald-500 hover:shadow-lg hover:shadow-emerald-500/30 hover:-translate-y-0.5",active:"active:bg-emerald-700 active:translate-y-0 active:shadow-sm"},warning:{background:"bg-amber-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-amber-500/20",hover:"hover:bg-amber-400 hover:shadow-lg hover:shadow-amber-500/30 hover:-translate-y-0.5",active:"active:bg-amber-600 active:translate-y-0 active:shadow-sm"},danger:{background:"bg-red-600 dark:bg-red-500",text:"text-white",border:"border-0",shadow:"shadow-md shadow-red-500/20",hover:"hover:bg-red-500 hover:shadow-lg hover:shadow-red-500/30 hover:-translate-y-0.5",active:"active:bg-red-700 active:translate-y-0 active:shadow-sm"},ghost:{background:"bg-transparent",text:"text-gray-700 dark:text-gray-300",border:"border-0",shadow:"",hover:"hover:bg-gray-100 dark:hover:bg-gray-800",active:"active:bg-gray-200 dark:active:bg-gray-700"},outline:{background:"bg-transparent",text:"text-gray-700 dark:text-gray-300",border:"border-2 border-gray-300 dark:border-gray-600",shadow:"",hover:"hover:bg-gray-100 dark:hover:bg-gray-800 hover:border-gray-400 dark:hover:border-gray-500",active:"active:bg-gray-200 dark:active:bg-gray-700"},link:{background:"bg-transparent",text:"text-violet-600 dark:text-violet-400",border:"border-0",shadow:"",hover:"hover:underline hover:text-violet-700 dark:hover:text-violet-300",active:"active:text-violet-800 dark:active:text-violet-200"}},spinner:{base:"animate-spin",size:{xs:"w-3 h-3",sm:"w-3.5 h-3.5",md:"w-4 h-4",lg:"w-5 h-5",xl:"w-6 h-6"}},ripple:{base:"absolute rounded-full bg-white/30 pointer-events-none"},pulse:{animation:"animate-pulse"}};import{clsx as Wd}from"clsx";import{twMerge as Hd}from"tailwind-merge";function ir(...e){return Hd(Wd(e))}import{jsxDEV as Zt}from"react/jsx-dev-runtime";vn.registerPlugin(ho);var V=Ud(({children:e,variant:t="nucleus",size:r="md",shape:n="default",loading:a=!1,disabled:i=!1,fullWidth:o=!1,leftIcon:s,rightIcon:l,iconOnly:c=!1,ripple:d=!0,pulse:u=!1,className:w,onClick:g,onMouseEnter:m,onMouseLeave:S,...b},z)=>{let k=xa(null),R=xa(null),p=xa(null),[T,y]=Ad(void 0),N=wn,L=i||a;Bd(()=>{if(a&&k.current&&!T)y(k.current.offsetWidth);if(!a&&T)y(void 0)},[a,T]);let{contextSafe:O}=ho({scope:k}),F=O((A)=>{if(L)return;if(d&&R.current&&k.current){let ee=k.current.getBoundingClientRect(),v=A.clientX-ee.left,G=A.clientY-ee.top,K=Math.max(ee.width,ee.height)*2,se=document.createElement("span");se.className=N.ripple.base,se.style.width=`${K}px`,se.style.height=`${K}px`,se.style.left=`${v-K/2}px`,se.style.top=`${G-K/2}px`,R.current.appendChild(se),vn.fromTo(se,{scale:0,opacity:0.6},{scale:1,opacity:0,duration:0.6,ease:"power2.out",onComplete:()=>{se.remove()}})}if(p.current)vn.to(p.current,{scale:0.95,duration:0.1,ease:"power2.out",onComplete:()=>{vn.to(p.current,{scale:1,duration:0.2,ease:"elastic.out(1, 0.5)"})}});g?.(A)}),Y=O((A)=>{if(L)return;m?.(A)}),re=O((A)=>{S?.(A)}),E=N.variant[t],_=(A,ee)=>{if(!A)return null;return Zt("span",{className:ir("inline-flex items-center justify-center shrink-0",N.size[r].iconSize,a&&ee==="left"&&"opacity-0"),children:A},void 0,!1,void 0,this)};return Zt("button",{ref:(A)=>{if(k.current=A,typeof z==="function")z(A);else if(z)z.current=A},type:"button",disabled:L,"aria-disabled":L,"aria-busy":a,onClick:F,onMouseEnter:Y,onMouseLeave:re,className:ir(N.base,N.font.weight,N.font.family,N.transition,N.focus,N.disabled.opacity,N.disabled.cursor,N.shape[n],c?N.iconOnly[r]:ir(N.size[r].padding,N.size[r].height),N.size[r].text,N.size[r].gap,E.background,E.text,E.border,E.shadow,!L&&E.hover,!L&&E.active,o&&N.fullWidth,u&&!a&&N.pulse.animation,w),style:T?{width:T}:void 0,...b,children:[Zt("span",{ref:R,className:"absolute inset-0 overflow-hidden rounded-[inherit] pointer-events-none","aria-hidden":"true"},void 0,!1,void 0,this),Zt("span",{ref:p,className:ir("relative inline-flex items-center justify-center z-10",N.size[r].gap),children:[a&&Zt("span",{className:"absolute inset-0 flex items-center justify-center","aria-hidden":"true",children:Zt("svg",{className:ir("animate-spin",N.size[r].iconSize),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[Zt("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Zt("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Zt("span",{className:ir("inline-flex items-center",N.size[r].gap,a&&"invisible"),"aria-hidden":a,children:[_(s,"left"),e,_(l,"right")]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)});V.displayName="Button";import{useGSAP as Od}from"@gsap/react";import $d from"gsap";import{useRef as zp}from"react";import{jsxDEV as Cp}from"react/jsx-dev-runtime";$d.registerPlugin(Od);import{useGSAP as wo}from"@gsap/react";import Na from"gsap";import{useEffect as yo,useEffectEvent as Fd,useRef as za,useState as Ir}from"react";var xn={container:{base:"w-full",wrapper:"flex flex-col gap-3"},label:{base:"text-sm font-medium text-zinc-700 dark:text-zinc-300"},challenge:{wrapper:"relative rounded-lg border border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800/50 p-4",math:{question:"text-2xl font-bold text-center text-zinc-900 dark:text-zinc-100 font-mono tracking-wide"},image:{wrapper:"flex justify-center",img:"max-w-full h-auto rounded select-none pointer-events-none"},text:{question:"text-2xl font-bold text-center text-zinc-900 dark:text-zinc-100 font-mono tracking-widest select-none"},puzzle:{wrapper:"flex flex-col gap-3",instruction:"text-sm text-center text-zinc-600 dark:text-zinc-400",grid:"flex flex-wrap justify-center gap-2",piece:"w-12 h-12 flex items-center justify-center rounded-lg border-2 border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-700 text-lg font-bold text-zinc-900 dark:text-zinc-100 cursor-pointer hover:border-blue-500 hover:bg-blue-50 dark:hover:bg-blue-900/30 transition-all duration-200 select-none",pieceSelected:"border-blue-500 bg-blue-100 dark:bg-blue-900/50 ring-2 ring-blue-500",pieceOrdered:"border-green-500 bg-green-50 dark:bg-green-900/30",orderDisplay:"flex justify-center gap-1 mt-2",orderBadge:"w-8 h-8 flex items-center justify-center rounded-md bg-blue-500 text-white text-sm font-medium",clearButton:"text-xs text-red-500 hover:text-red-600 dark:hover:text-red-400 cursor-pointer"}},input:{wrapper:"mt-3",base:"w-full px-4 py-2.5 rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 dark:placeholder:text-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200",error:"border-red-500 focus:ring-red-500"},actions:{wrapper:"flex items-center justify-between mt-2",refresh:"flex items-center gap-1.5 text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors duration-200 disabled:opacity-50 disabled:cursor-not-allowed",timer:"text-xs text-zinc-500 dark:text-zinc-400",timerExpired:"text-xs text-red-500 dark:text-red-400"},error:{container:"mt-2 p-2 rounded-md bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400"},loading:{wrapper:"flex items-center justify-center py-6",spinner:"w-6 h-6 border-2 border-zinc-300 dark:border-zinc-600 border-t-blue-500 rounded-full animate-spin"}};import{jsxDEV as Se,Fragment as ko}from"react/jsx-dev-runtime";Na.registerPlugin(wo);var Gd=({className:e,iconRef:t})=>Se("svg",{ref:t,xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:e,"aria-hidden":"true",children:[Se("path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"},void 0,!1,void 0,this),Se("path",{d:"M3 3v5h5"},void 0,!1,void 0,this),Se("path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"},void 0,!1,void 0,this),Se("path",{d:"M16 16h5v5"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);function zn({generateAction:e,config:t,onChallengeLoad:r,onAnswerChange:n,disabled:a=!1,autoGenerate:i=!0,className:o,label:s="Security Check",errorMessage:l}){let c=xn,d=za(null),u=za(null),w=za(null),[g,m]=Ir(null),[S,b]=Ir(""),[z,k]=Ir(null),[R,p]=Ir(!1),[T,y]=Ir(null),[N,L]=Ir([]),O=e.state.isPending,{contextSafe:F}=wo({scope:d}),Y=Fd(()=>{b(""),p(!1),y(null),L([]),e.start({payload:{type:t?.type,difficulty:t?.difficulty},onAfterHandle:(G)=>{let K=G.data;if(!K||K.rateLimited){y(G.message??"Too many requests. Please try again later."),m(null);return}if(m(K),r?.(G),u.current)Na.fromTo(u.current,{opacity:0,scale:0.95},{opacity:1,scale:1,duration:0.3,ease:"power2.out"})},onErrorHandle:()=>{m(null)}})}),re=F(()=>{if(w.current)Na.to(w.current,{rotation:"+=360",duration:0.5,ease:"power2.inOut"});Y()}),E=(G)=>{if(b(G),g)n?.(g.challengeId,G)},_=(G)=>{if(a||O||R)return;let K=N.includes(G)?N.filter((H)=>H!==G):[...N,G];L(K);let se=K.join(",");if(b(se),g)n?.(g.challengeId,se)},A=()=>{if(L([]),b(""),g)n?.(g.challengeId,"")};yo(()=>{if(i&&t?.enabled!==!1)Y()},[i,t?.enabled]),yo(()=>{if(!g?.expiresAt){k(null);return}let G=()=>{let se=Date.now(),H=Math.max(0,Math.floor((g.expiresAt-se)/1000));if(k(H),H<=0)p(!0)};G();let K=setInterval(G,1000);return()=>clearInterval(K)},[g?.expiresAt]);let ee=(G)=>{let K=Math.floor(G/60),se=G%60;return`${K}:${se.toString().padStart(2,"0")}`},v=()=>{if(!g)return"Enter answer";switch(g.type){case"math":return"Enter the result";case"image":case"text":return"Enter the text shown";case"puzzle":return"Enter piece order (e.g., 0,1,2,3)";default:return"Enter answer"}};if(t?.enabled===!1)return Se(ko,{},void 0,!1,void 0,this);return Se("div",{ref:d,className:f(c.container.base,o),children:Se("div",{className:c.container.wrapper,children:[Se("span",{className:c.label.base,children:s},void 0,!1,void 0,this),Se("div",{ref:u,className:c.challenge.wrapper,children:O?Se("div",{className:c.loading.wrapper,children:Se("div",{className:c.loading.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this):g?Se(ko,{children:[g.type==="math"&&Se("p",{className:c.challenge.math.question,children:g.question},void 0,!1,void 0,this),g.type==="text"&&Se("p",{className:c.challenge.text.question,children:g.question},void 0,!1,void 0,this),g.type==="image"&&g.imageData&&Se("div",{className:c.challenge.image.wrapper,children:Se("img",{src:g.imageData,alt:"Captcha",className:c.challenge.image.img,draggable:!1},void 0,!1,void 0,this)},void 0,!1,void 0,this),g.type==="puzzle"&&g.puzzleData&&Se("div",{className:c.challenge.puzzle.wrapper,children:[Se("p",{className:c.challenge.puzzle.instruction,children:["Click the pieces in the correct order (0 to"," ",g.puzzleData.pieces.length-1,")"]},void 0,!0,void 0,this),Se("div",{className:c.challenge.puzzle.grid,children:g.puzzleData.pieces.map((G)=>Se("button",{type:"button",onClick:()=>_(G.id),disabled:a||O||R,className:f(c.challenge.puzzle.piece,N.includes(G.id)&&c.challenge.puzzle.pieceOrdered),children:G.id},G.id,!1,void 0,this))},void 0,!1,void 0,this),N.length>0&&Se("div",{className:c.challenge.puzzle.orderDisplay,children:[N.map((G,K)=>Se("span",{className:c.challenge.puzzle.orderBadge,children:G},`order-${G}-${K}`,!1,void 0,this)),Se("button",{type:"button",onClick:A,className:c.challenge.puzzle.clearButton,children:"Clear"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):Se("div",{className:c.loading.wrapper,children:Se("p",{className:"text-sm text-zinc-500",children:"Click refresh to load captcha"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),g?.type!=="puzzle"&&Se("div",{className:c.input.wrapper,children:[Se("label",{htmlFor:"captcha-answer",className:"sr-only",children:s},void 0,!1,void 0,this),Se("input",{id:"captcha-answer",type:"text",value:S,onChange:(G)=>E(G.target.value),placeholder:v(),disabled:a||O||R,className:f(c.input.base,(l||R)&&c.input.error),autoComplete:"off"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Se("div",{className:c.actions.wrapper,children:[Se("button",{type:"button",onClick:re,disabled:a||O,className:c.actions.refresh,children:[Se(Gd,{iconRef:w},void 0,!1,void 0,this),Se("span",{children:"New challenge"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z!==null&&Se("span",{className:R?c.actions.timerExpired:c.actions.timer,children:R?"Expired":`Expires in ${ee(z)}`},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(l||R||T)&&Se("div",{className:c.error.container,children:Se("p",{className:c.error.text,children:T?T:R?"Captcha expired. Please refresh.":l},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as Ha}from"@gsap/react";import Tn from"gsap";import{useRef as $o}from"react";import{useGSAP as vo}from"@gsap/react";import Pa from"gsap";import{useRef as _d}from"react";var Xt={container:{base:"relative w-full",spacing:"mb-1"},wrapper:{base:"relative flex items-center",border:{base:"border rounded-lg",width:"border",radius:"rounded-lg"},padding:"px-4 py-3",transition:"transition-all duration-200 ease-out",states:{inactive:"border-gray-300 dark:border-gray-600",hover:"border-gray-400 dark:border-gray-500",focused:"border-blue-600 dark:border-blue-500",error:"border-red-500 dark:border-red-400",disabled:"border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50"}},input:{base:"w-full bg-transparent outline-none",text:"text-base",color:"text-gray-900 dark:text-gray-100",placeholder:"placeholder:text-gray-400 dark:placeholder:text-gray-500",disabled:"text-gray-400 dark:text-gray-500 cursor-not-allowed",transition:"transition-colors duration-200"},label:{base:"absolute pointer-events-none select-none",text:"text-base",transition:"transition-all duration-200 ease-out",states:{inactive:{position:"left-3 top-1/2 -translate-y-1/2",text:"text-base",color:"text-gray-500 dark:text-gray-400",background:"bg-transparent px-1"},floated:{position:"left-3 -top-2.5 translate-y-0",text:"text-xs",color:"text-gray-600 dark:text-gray-300",background:"bg-white/50 dark:bg-gray-900/50 px-1"},focused:{color:"text-blue-600 dark:text-blue-500"},error:{color:"text-red-500 dark:text-red-400"},disabled:{color:"text-gray-400 dark:text-gray-500"}}},helperText:{base:"mt-1.5 ml-1",text:"text-xs",color:"text-gray-500 dark:text-gray-400",disabled:"text-gray-400 dark:text-gray-500"},errorText:{base:"mt-1.5 ml-1",text:"text-xs",color:"text-red-500 dark:text-red-400",minHeight:"min-h-[1.25rem]"},icon:{base:"flex-shrink-0",size:"w-5 h-5",color:"text-gray-400 dark:text-gray-500",spacing:{left:"mr-2",right:"ml-2"},states:{focused:"text-blue-600 dark:text-blue-500",error:"text-red-500 dark:text-red-400",disabled:"text-gray-300 dark:text-gray-600"}},animation:{label:{duration:0.35,ease:"power3.out",floatY:-24,floatScale:0.75},typewriter:{charDelay:0.03,ease:"none"},border:{duration:0.2,ease:"power2.out"}}};import{clsx as Yd}from"clsx";import{twMerge as qd}from"tailwind-merge";function Xe(...e){return qd(Yd(e))}import{jsxDEV as Jd}from"react/jsx-dev-runtime";Pa.registerPlugin(vo);function Sa({label:e,isFloated:t,isFocused:r,hasError:n,isDisabled:a,hasLeftIcon:i,className:o}){let s=_d(null),l=Xt.label,c=Xt.animation.label;vo(()=>{if(!s.current)return;if(t)Pa.to(s.current,{y:c.floatY,x:i?-20:0,scale:c.floatScale,duration:c.duration,ease:c.ease});else Pa.to(s.current,{y:0,x:0,scale:1,duration:c.duration,ease:c.ease})},[t,i]);let d=()=>{if(a)return l.states.disabled.color;if(n)return l.states.error.color;if(r)return l.states.focused.color;if(t)return l.states.floated.color;return l.states.inactive.color},u=()=>{if(t)return l.states.floated.background;return l.states.inactive.background};return Jd("span",{ref:s,className:Xe(l.base,u(),i?"left-9 top-1/2 origin-left":"left-3 top-1/2 origin-left",d(),o),style:{transform:"translateY(-50%)"},"aria-hidden":"true",children:e},void 0,!1,void 0,this)}import{useGSAP as Oo}from"@gsap/react";import Wa from"gsap";import{useId as ec,useRef as Ao,useState as Er}from"react";function Nn(e,t=" "){let r=e.replace(/\D/g,"");if(!r)return"";return r.replace(/\B(?=(\d{3})+(?!\d))/g,t)}function or(e){return e.replace(/\D/g,"")}var Kd={tr:{pattern:[3,3,2,2],prefix:""},us:{pattern:[3,3,4],prefix:""},eu:{pattern:[2,3,3,2],prefix:""}};function Pn(e,t="tr"){let r=e.replace(/\D/g,"");if(!r)return"";let{pattern:n}=Kd[t],a=[],i=r;for(let o of n){if(i.length===0)break;a.push(i.slice(0,o)),i=i.slice(o)}if(i.length>0)a.push(i);return a.join(" ")}function Ca(e){return e.replace(/\D/g,"")}var Qd=/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/,Zd=/^(https?:\/\/)?([\da-z-]+\.)+[a-z]{2,6}(\/[^\s]*)?$/i,Xd=/^[+]?[(]?[0-9]{1,4}[)]?[-\s./0-9]{6,}$/,Wr={minLength:8,hasUppercase:/[A-Z]/,hasLowercase:/[a-z]/,hasNumber:/[0-9]/,hasSpecial:/[!@#$%^&*(),.?":{}|<>]/},xo={text:(e)=>{if(!e.trim())return{isValid:!0};return{isValid:!0}},email:(e)=>{if(!e.trim())return{isValid:!0};if(!Qd.test(e))return{isValid:!1,errorMessage:"Please enter a valid email address"};return{isValid:!0}},password:(e)=>{if(!e)return{isValid:!0};let t=[];if(e.length<Wr.minLength)t.push(`at least ${Wr.minLength} characters`);if(!Wr.hasUppercase.test(e))t.push("one uppercase letter");if(!Wr.hasLowercase.test(e))t.push("one lowercase letter");if(!Wr.hasNumber.test(e))t.push("one number");if(!Wr.hasSpecial.test(e))t.push("one special character");if(t.length>0)return{isValid:!1,errorMessage:`Password must contain ${t.join(", ")}`};return{isValid:!0}},number:(e)=>{if(!e.trim())return{isValid:!0};let t=Number(e);if(Number.isNaN(t))return{isValid:!1,errorMessage:"Please enter a valid number"};return{isValid:!0}},tel:(e)=>{if(!e.trim())return{isValid:!0};if(e.replace(/\D/g,"").length<7)return{isValid:!1,errorMessage:"Phone number must have at least 7 digits"};if(!Xd.test(e))return{isValid:!1,errorMessage:"Please enter a valid phone number"};return{isValid:!0}},url:(e)=>{if(!e.trim())return{isValid:!0};if(!Zd.test(e))return{isValid:!1,errorMessage:"Please enter a valid URL"};return{isValid:!0}}};function Ta(e,t,r){if(r?.required&&!e.trim())return{isValid:!1,errorMessage:r.requiredMessage||"This field is required"};if(r?.minLength&&e.length<r.minLength)return{isValid:!1,errorMessage:`Minimum ${r.minLength} characters required`};if(r?.maxLength&&e.length>r.maxLength)return{isValid:!1,errorMessage:`Maximum ${r.maxLength} characters allowed`};if(r?.pattern&&!r.pattern.test(e))return{isValid:!1,errorMessage:r.patternMessage||"Invalid format"};if(r?.customRules){for(let n of r.customRules)if(!n.validate(e))return{isValid:!1,errorMessage:n.message}}return xo[t](e)}function La(e){switch(e){case"email":return"email";case"number":return"numeric";case"tel":return"tel";case"url":return"url";default:return"text"}}function Ra(e,t){switch(e){case"email":return"email";case"password":return t?"new-password":"current-password";case"tel":return"tel";case"url":return"url";default:return"off"}}import{jsxDEV as Ae}from"react/jsx-dev-runtime";function zo({className:e}){return Ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Xe("h-5 w-5",e),"aria-hidden":"true",children:[Ae("rect",{width:"20",height:"16",x:"2",y:"4",rx:"2"},void 0,!1,void 0,this),Ae("path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function No({className:e}){return Ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Xe("h-5 w-5",e),"aria-hidden":"true",children:[Ae("rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2"},void 0,!1,void 0,this),Ae("path",{d:"M7 11V7a5 5 0 0 1 10 0v4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Po({className:e}){return Ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Xe("h-5 w-5",e),"aria-hidden":"true",children:[Ae("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"},void 0,!1,void 0,this),Ae("circle",{cx:"12",cy:"12",r:"3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function So({className:e}){return Ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Xe("h-5 w-5",e),"aria-hidden":"true",children:[Ae("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"},void 0,!1,void 0,this),Ae("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"},void 0,!1,void 0,this),Ae("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"},void 0,!1,void 0,this),Ae("path",{d:"m2 2 20 20"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Co({className:e}){return Ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Xe("h-5 w-5",e),"aria-hidden":"true",children:[Ae("line",{x1:"4",x2:"20",y1:"9",y2:"9"},void 0,!1,void 0,this),Ae("line",{x1:"4",x2:"20",y1:"15",y2:"15"},void 0,!1,void 0,this),Ae("line",{x1:"10",x2:"8",y1:"3",y2:"21"},void 0,!1,void 0,this),Ae("line",{x1:"16",x2:"14",y1:"3",y2:"21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function To({className:e}){return Ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Xe("h-5 w-5",e),"aria-hidden":"true",children:Ae("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Lo({className:e}){return Ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Xe("h-5 w-5",e),"aria-hidden":"true",children:[Ae("path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"},void 0,!1,void 0,this),Ae("path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function Ro({className:e}){return Ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Xe("h-5 w-5",e),"aria-hidden":"true",children:Ae("path",{d:"M20 6 9 17l-5-5"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Mo({className:e}){return Ae("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:Xe("h-5 w-5",e),"aria-hidden":"true",children:[Ae("circle",{cx:"12",cy:"12",r:"10"},void 0,!1,void 0,this),Ae("line",{x1:"12",x2:"12",y1:"8",y2:"12"},void 0,!1,void 0,this),Ae("line",{x1:"12",x2:"12.01",y1:"16",y2:"16"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Io}from"@gsap/react";import Wo from"gsap";import{useRef as Ed}from"react";import{jsxDEV as Hr}from"react/jsx-dev-runtime";Wo.registerPlugin(Io);function Ho(e){let t=0;if(!e)return{level:"weak",score:0,label:"",color:"bg-gray-200"};if(e.length>=8)t+=1;if(e.length>=12)t+=1;if(e.length>=16)t+=1;if(/[a-z]/.test(e))t+=1;if(/[A-Z]/.test(e))t+=1;if(/[0-9]/.test(e))t+=1;if(/[^a-zA-Z0-9]/.test(e))t+=1;if(/(.)\1{2,}/.test(e))t-=1;if(/^[a-zA-Z]+$/.test(e))t-=1;if(/^[0-9]+$/.test(e))t-=1;if(t=Math.max(0,Math.min(t,7)),t<=2)return{level:"weak",score:t,label:"Weak",color:"bg-red-500"};if(t<=4)return{level:"fair",score:t,label:"Fair",color:"bg-orange-500"};if(t<=5)return{level:"good",score:t,label:"Good",color:"bg-yellow-500"};return{level:"strong",score:t,label:"Strong",color:"bg-green-500"}}function Ma({password:e,className:t}){let r=Ed(null),n=Ho(e),a=e?Math.min(n.score/7*100,100):0;if(Io(()=>{if(!r.current)return;Wo.to(r.current,{width:`${a}%`,duration:0.3,ease:"power2.out"})},[a]),!e)return null;return Hr("div",{className:Xe("mt-2 mb-4",t),children:[Hr("div",{className:"flex items-center justify-between mb-1",children:[Hr("span",{className:"text-xs text-gray-500 dark:text-gray-400",children:"Password strength"},void 0,!1,void 0,this),Hr("span",{className:Xe("text-xs font-medium",n.level==="weak"&&"text-red-500",n.level==="fair"&&"text-orange-500",n.level==="good"&&"text-yellow-600",n.level==="strong"&&"text-green-500"),children:n.label},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Hr("div",{className:"h-1.5 w-full bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden",children:Hr("div",{ref:r,className:Xe("h-full rounded-full transition-colors duration-300",n.color),style:{width:0}},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Bo}from"@gsap/react";import Sn from"gsap";import{TextPlugin as Dd}from"gsap/TextPlugin";import{useEffect as Vd,useRef as Uo}from"react";import{jsxDEV as jd}from"react/jsx-dev-runtime";Sn.registerPlugin(Bo,Dd);function Ia({text:e,className:t,onComplete:r}){let n=Uo(null),a=Uo(""),i=Xt.errorText,o=Xt.animation.typewriter;if(Bo(()=>{if(!n.current||!e){if(n.current)n.current.textContent="";a.current="";return}if(e===a.current)return;Sn.killTweensOf(n.current),n.current.textContent="";let s=e.length*o.charDelay;Sn.to(n.current,{duration:s,text:{value:e,delimiter:""},ease:o.ease,onComplete:()=>{a.current=e,r?.()}})},[e]),Vd(()=>{return()=>{if(n.current)Sn.killTweensOf(n.current)}},[]),!e)return null;return jd("span",{ref:n,className:Xe(i.base,i.text,i.color,t),role:"alert","aria-live":"polite"},void 0,!1,void 0,this)}import{jsxDEV as nt}from"react/jsx-dev-runtime";Wa.registerPlugin(Oo);var tc={text:null,email:nt(zo,{},void 0,!1,void 0,this),password:nt(No,{},void 0,!1,void 0,this),number:nt(Co,{},void 0,!1,void 0,this),tel:nt(To,{},void 0,!1,void 0,this),url:nt(Lo,{},void 0,!1,void 0,this)};function Fe({value:e="",onChange:t,type:r="text",label:n,placeholder:a,helperText:i,errorMessage:o,disabled:s=!1,readOnly:l=!1,leftIcon:c,rightIcon:d,size:u="md",fullWidth:w=!0,className:g,inputClassName:m,labelClassName:S,wrapperClassName:b,showTypewriterError:z=!0,showTypeIcon:k=!0,showValidationIcon:R=!0,enableValidation:p=!0,validateOnBlur:T=!0,validateOnChange:y=!1,validationConfig:N,customValidator:L,onValidationChange:O,unit:F,unitPosition:Y="suffix",formatNumber:re=!1,thousandSeparator:E=" ",phoneFormat:_="tr",isNewPassword:A=!1,maxInputLength:ee,confirmValue:v,onConfirmChange:G,showPasswordStrength:K=!1,preventCopy:se=!1,preventPaste:H=!1,preventContextMenu:U=!1,trimOnBlur:C=!1,onFocus:de,onBlur:B,...ae}){let[ge,Ye]=Er(!1),[Ie,Pe]=Er(!1),[pe,ke]=Er(!1),[Te,we]=Er(void 0),[be,P]=Er(null),j=Ao(null),Z=Ao(null),me=ec(),J=Xt,te=o||Te,D=Boolean(te),We=Boolean(e&&e.length>0),M=ge||We,{contextSafe:ie}=Oo({scope:Z}),Ne=($e)=>{if(!p)return{isValid:!0};if(L)return L($e);return Ta($e,r,N)},De=($e)=>{let Ft=Ne($e);P(Ft.isValid),we(Ft.isValid?void 0:Ft.errorMessage),O?.(Ft)},rt=ie(($e)=>{if(s)return;Ye(!0),de?.($e)}),Ve=ie(($e)=>{if(Ye(!1),C&&e){let Ft=e.trim();if(Ft!==e)t?.(Ft)}if(T&&e)De(W(e));if(r==="password"&&v!==void 0&&e!==v)we("Passwords do not match"),P(!1);B?.($e)}),$t=($e)=>{if(se||r==="password")$e.preventDefault()},Tt=($e)=>{if(H)$e.preventDefault()},mr=($e)=>{if(U||r==="password")$e.preventDefault()},_t=($e)=>{let hr=$e.target.selectionStart??0,fn=e,vt=$e.target.value,hn=or(fn).length,ya=or(vt).length<hn;if(r==="number"&&re){let Jt=or(vt);vt=Nn(Jt,E)}else if(r==="tel")vt=Pn(vt,_);if(t?.(vt),r==="number"&&re||r==="tel")requestAnimationFrame(()=>{if(!j.current)return;let Jt=or($e.target.value.slice(0,hr)).length,Kt=0,Qt=0;for(let xt=0;xt<vt.length;xt++){let yn=vt[xt];if(yn!==void 0&&/\d/.test(yn))Qt++;if(Qt===Jt){Kt=xt+1;break}}if(Qt<Jt)Kt=vt.length;if(ya&&hr>0){let xt=$e.target.value[hr-1];if(xt===" "||xt===E)Kt=Math.max(0,Kt-1)}j.current.setSelectionRange(Kt,Kt)});if(y){let Jt=W(vt);De(Jt)}if(r==="password"&&v!==void 0&&vt!==v)we("Passwords do not match"),P(!1);else if(r==="password"&&v!==void 0&&vt===v)we(void 0),P(!0);else if(Te&&!y)we(void 0),P(null)},W=($e)=>{if(r==="number"&&re)return or($e);if(r==="tel")return Ca($e);return $e},le=()=>{if(r==="number"&&re&&e)return Nn(or(e),E);if(r==="tel"&&e)return Pn(e,_);return e},qe=()=>{ke(($e)=>!$e)},Le=()=>{if(r==="password")return pe?"text":"password";return r},Re=()=>{if(!k)return null;if(c)return null;if(r==="number"&&F)return null;return tc[r]},gr=()=>{if(!R||!We||be===null)return null;if(D)return nt(Mo,{className:"text-red-500"},void 0,!1,void 0,this);if(be)return nt(Ro,{className:"text-green-500"},void 0,!1,void 0,this);return null},br=()=>{if(r==="password")return nt("button",{type:"button",onClick:qe,className:"focus:outline-none",tabIndex:-1,"aria-label":pe?"Hide password":"Show password",children:pe?nt(So,{},void 0,!1,void 0,this):nt(Po,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(d)return d;return gr()},Qr=ie(()=>{if(s)return;if(Pe(!0),Z.current&&!ge&&!D)Wa.to(Z.current,{borderColor:"rgb(156, 163, 175)",duration:J.animation.border.duration,ease:J.animation.border.ease})}),Rr=ie(()=>{if(Pe(!1),Z.current&&!ge&&!D)Wa.to(Z.current,{borderColor:"rgb(209, 213, 219)",duration:J.animation.border.duration,ease:J.animation.border.ease})}),Zr=()=>{if(s)return J.wrapper.states.disabled;if(D)return J.wrapper.states.error;if(ge)return J.wrapper.states.focused;if(Ie)return J.wrapper.states.hover;return J.wrapper.states.inactive},fr=()=>{switch(u){case"sm":return"px-3 py-2 text-sm";case"lg":return"px-5 py-4 text-lg";default:return J.wrapper.padding}};return nt("div",{className:Xe(J.container.base,J.container.spacing,w&&"w-full",g),children:[nt("label",{ref:Z,htmlFor:me,className:Xe(J.wrapper.base,J.wrapper.border.base,J.wrapper.transition,fr(),Zr(),"cursor-text",b),onMouseEnter:Qr,onMouseLeave:Rr,children:[(c||Re())&&nt("span",{className:Xe(J.icon.base,J.icon.size,J.icon.color,J.icon.spacing.left,ge&&J.icon.states.focused,D&&J.icon.states.error,s&&J.icon.states.disabled),children:c||Re()},void 0,!1,void 0,this),n&&nt(Sa,{label:n,isFloated:M,isFocused:ge,hasError:D,isDisabled:s,hasLeftIcon:Boolean(c||Re()),className:S},void 0,!1,void 0,this),F&&Y==="prefix"&&nt("span",{className:"text-gray-500 dark:text-gray-400 mr-1 select-none",children:F},void 0,!1,void 0,this),nt("input",{ref:j,id:me,type:r==="number"&&re?"text":Le(),inputMode:La(r),autoComplete:Ra(r,A),maxLength:ee,value:le(),onChange:_t,onFocus:rt,onBlur:Ve,onCopy:$t,onPaste:Tt,onContextMenu:mr,disabled:s,readOnly:l,placeholder:M?a:"","aria-label":n,"aria-invalid":D,"aria-describedby":te?`${me}-error`:i?`${me}-helper`:void 0,className:Xe(J.input.base,J.input.text,J.input.color,J.input.placeholder,J.input.transition,s&&J.input.disabled,m),...ae},void 0,!1,void 0,this),F&&Y==="suffix"&&nt("span",{className:"text-gray-500 dark:text-gray-400 ml-1 select-none",children:F},void 0,!1,void 0,this),br()&&nt("span",{className:Xe(J.icon.base,J.icon.size,J.icon.color,J.icon.spacing.right,ge&&J.icon.states.focused,D&&J.icon.states.error,s&&J.icon.states.disabled),children:br()},void 0,!1,void 0,this)]},void 0,!0,void 0,this),nt("div",{className:J.errorText.minHeight,children:D&&z&&te?nt(Ia,{text:te},void 0,!1,void 0,this):D?nt("span",{id:`${me}-error`,className:Xe(J.errorText.base,J.errorText.text,J.errorText.color),role:"alert",children:te},void 0,!1,void 0,this):i?nt("span",{id:`${me}-helper`,className:Xe(J.helperText.base,J.helperText.text,J.helperText.color,s&&J.helperText.disabled),children:i},void 0,!1,void 0,this):null},void 0,!1,void 0,this),r==="password"&&K&&e&&nt(Ma,{password:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{batch as rc,createStore as nc}from"h-state";var ac={currentPassword:"",newPassword:"",confirmPassword:"",step:"form",error:null},{useStore:Cn}=nc(ac,{setCurrentPassword:(e)=>(t)=>{if(e.currentPassword=t,e.error)e.error=null},setNewPassword:(e)=>(t)=>{if(e.newPassword=t,e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{rc(()=>{e.currentPassword="",e.newPassword="",e.confirmPassword="",e.step="form",e.error=null})}});var yr={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},button:{wrapper:"mt-6"},links:{container:"mt-6 text-center",cancel:"text-sm text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-white font-medium transition-colors cursor-pointer inline-flex items-center gap-1"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},success:{container:"flex flex-col items-center text-center",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",title:"text-xl font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"}};import{jsxDEV as Ee}from"react/jsx-dev-runtime";Tn.registerPlugin(Ha);function Fo({className:e}){return Ee("svg",{className:f("w-4 h-4",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ee("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function ic({className:e}){return Ee("svg",{className:f("w-8 h-8 text-green-600 dark:text-green-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ee("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Ua({changePasswordAction:e,onSuccess:t,onCancel:r,cancelHref:n}){let a=yr,i=$o(null),o=$o(null),s=Cn(),{contextSafe:l}=Ha({scope:i}),c=e.state.isPending;Ha(()=>{if(s.step==="success"&&o.current)Tn.fromTo(o.current,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.4,ease:"back.out(1.7)"})},{dependencies:[s.step]});let d=l(()=>{if(!i.current)return;Tn.fromTo(i.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{Tn.set(i.current,{x:0})}})}),u=l((g)=>{if(g.preventDefault(),s.newPassword!==s.confirmPassword){s.setError("New passwords do not match"),d();return}if(s.newPassword.length<8){s.setError("Password must be at least 8 characters"),d();return}s.setError(null),e.start({payload:{currentPassword:s.currentPassword,newPassword:s.newPassword,confirmPassword:s.confirmPassword},onAfterHandle:()=>{s.setStep("success"),t?.()},onErrorHandle:(m)=>{let S=m instanceof Error?m.message:"Failed to change password. Please try again.";s.setError(S),d()}})}),w=()=>{if(r)r();else if(n)window.location.href=n};if(s.step==="success")return Ee("div",{ref:o,className:a.success.container,children:[Ee("div",{className:a.success.iconWrapper,children:Ee(ic,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ee("h2",{className:a.success.title,children:"Password Changed!"},void 0,!1,void 0,this),Ee("p",{className:a.success.message,children:"Your password has been successfully updated. You can now use your new password to log in."},void 0,!1,void 0,this),(n||r)&&Ee("div",{className:a.links.container,children:Ee("button",{type:"button",onClick:w,className:a.links.cancel,children:[Ee(Fo,{},void 0,!1,void 0,this),"Go back"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Ee("form",{ref:i,onSubmit:u,className:f(a.form.container,a.form.spacing),noValidate:!0,children:[s.error&&Ee("div",{className:a.error.container,children:Ee("p",{className:a.error.text,children:s.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ee("div",{className:a.input.wrapper,children:Ee(Fe,{label:"Current Password",type:"password",value:s.currentPassword,onChange:(g)=>s.setCurrentPassword(g),placeholder:"Enter your current password",autoComplete:"current-password",enableValidation:!1,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ee("div",{className:a.input.wrapper,children:Ee(Fe,{label:"New Password",type:"password",value:s.newPassword,onChange:(g)=>s.setNewPassword(g),placeholder:"Enter your new password",autoComplete:"new-password",isNewPassword:!0,showPasswordStrength:!0,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ee("div",{className:a.input.wrapper,children:Ee(Fe,{label:"Confirm New Password",type:"password",value:s.confirmPassword,onChange:(g)=>s.setConfirmPassword(g),placeholder:"Confirm your new password",autoComplete:"new-password",enableValidation:!1,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ee("div",{className:a.button.wrapper,children:Ee(V,{type:"submit",variant:"primary",size:"lg",fullWidth:!0,loading:e.state.isPending,children:"Change Password"},void 0,!1,void 0,this)},void 0,!1,void 0,this),(n||r)&&Ee("div",{className:a.links.container,children:Ee("button",{type:"button",onClick:w,className:a.links.cancel,disabled:c,children:[Ee(Fo,{},void 0,!1,void 0,this),"Cancel"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as kr}from"react/jsx-dev-runtime";function Ba({logo:e,title:t,subtitle:r}){let n=yr;return kr("header",{className:n.header.container,children:[e?kr("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this):kr("div",{className:n.header.iconWrapper,children:kr("svg",{className:"w-8 h-8 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:kr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),kr("h1",{className:f(n.header.title),children:t},void 0,!1,void 0,this),kr("p",{className:f(n.header.subtitle),children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Yo}from"@gsap/react";import qo from"gsap";import{useRef as Go}from"react";import{jsxDEV as Ur}from"react/jsx-dev-runtime";qo.registerPlugin(Yo);function _o({logo:e,title:t="Change Password",subtitle:r="Enter your current password and choose a new one.",changePasswordAction:n,onSuccess:a,onCancel:i,cancelHref:o,showBackground:s=!0,className:l}){let c=yr,d=Go(null),u=Go(null);return Yo(()=>{if(!u.current)return;qo.fromTo(u.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:d}),Ur("main",{ref:d,className:f(c.container.base,l),"aria-label":"Change password page",children:[s&&Ur(lt,{},void 0,!1,void 0,this),Ur("div",{className:c.container.wrapper,children:Ur("article",{ref:u,className:f(c.card.base,c.card.padding,c.card.background,c.card.border,c.card.shadow,c.card.rounded),children:[Ur(Ba,{logo:e,title:t,subtitle:r},void 0,!1,void 0,this),Ur(Ua,{changePasswordAction:n,onSuccess:a,onCancel:i,cancelHref:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Zo}from"@gsap/react";import Ga from"gsap";import{useId as lc,useRef as Fa}from"react";var wr={container:{base:"flex flex-col",spacing:"gap-1",disabled:"pointer-events-none"},wrapper:{base:"inline-flex items-center cursor-pointer select-none",gap:{sm:"gap-2",md:"gap-2.5",lg:"gap-3"}},label:{base:"cursor-pointer",text:{size:{sm:"text-sm",md:"text-base",lg:"text-lg"},color:{light:"text-gray-700",dark:"dark:text-gray-200"}},disabled:"opacity-50 cursor-not-allowed"},checkbox:{base:"relative flex items-center justify-center overflow-hidden",size:{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},border:{base:"border-2",width:"border-2",color:{light:"border-gray-300",dark:"dark:border-gray-600"},focused:"ring-2 ring-offset-2 ring-blue-500 dark:ring-offset-gray-900"},background:{unchecked:{light:"bg-white",dark:"dark:bg-gray-800"},checked:{primary:"bg-blue-500",secondary:"bg-purple-500",success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-cyan-500"}},rounded:"rounded-md",shadow:"shadow-sm",transition:"transition-all duration-200",disabled:{opacity:"opacity-50",cursor:"cursor-not-allowed"}},checkIcon:{base:"absolute",size:{sm:"w-3 h-3",md:"w-3.5 h-3.5",lg:"w-4 h-4"},stroke:{width:"stroke-[3]",color:"stroke-white"}},indeterminateIcon:{base:"absolute",size:{sm:{width:"w-2",height:"h-0.5"},md:{width:"w-2.5",height:"h-0.5"},lg:{width:"w-3",height:"h-0.5"}},background:"bg-white",rounded:"rounded-full"},switch:{track:{base:"relative inline-flex items-center cursor-pointer",size:{sm:{width:"w-8",height:"h-4"},md:{width:"w-11",height:"h-6"},lg:{width:"w-14",height:"h-7"}},background:{unchecked:{light:"bg-gray-200",dark:"dark:bg-gray-700"},checked:{primary:"bg-blue-500",secondary:"bg-purple-500",success:"bg-emerald-500",warning:"bg-amber-500",danger:"bg-red-500",info:"bg-cyan-500"}},border:{base:"border",color:{light:"border-gray-300",dark:"dark:border-gray-600"}},rounded:"rounded-full",shadow:"shadow-inner",transition:"transition-all duration-300 ease-out",disabled:{opacity:"opacity-50",cursor:"cursor-not-allowed"}},thumb:{base:"absolute flex items-center justify-center bg-white rounded-full shadow-lg",size:{sm:"w-3 h-3",md:"w-5 h-5",lg:"w-6 h-6"},background:{light:"bg-white",dark:"bg-white"},shadow:"shadow-md",rounded:"rounded-full",transition:"transition-all duration-300 ease-out",position:{sm:{unchecked:"left-0.5",checked:"left-[calc(100%-14px)]"},md:{unchecked:"left-0.5",checked:"left-[calc(100%-22px)]"},lg:{unchecked:"left-0.5",checked:"left-[calc(100%-26px)]"}}},icon:{base:"absolute",size:{sm:"w-2 h-2",md:"w-3 h-3",lg:"w-3.5 h-3.5"},color:{unchecked:{light:"text-gray-400",dark:"text-gray-500"},checked:"text-current"}}},ripple:{base:"absolute inset-0 rounded-full opacity-0",size:"scale-0",color:{primary:"bg-blue-400/30",secondary:"bg-purple-400/30",success:"bg-emerald-400/30",warning:"bg-amber-400/30",danger:"bg-red-400/30",info:"bg-cyan-400/30"}},errorText:{base:"mt-1",text:"text-sm",color:"text-red-500"},helperText:{base:"mt-1",text:"text-sm",color:{light:"text-gray-500",dark:"dark:text-gray-400"}}};import{clsx as oc}from"clsx";import{twMerge as sc}from"tailwind-merge";function ut(...e){return sc(oc(e))}import{useGSAP as Jo}from"@gsap/react";import Aa from"gsap";import{useRef as Ln}from"react";import{jsxDEV as Dr}from"react/jsx-dev-runtime";Aa.registerPlugin(Jo);function Oa({checked:e,indeterminate:t=!1,size:r,color:n,disabled:a=!1}){let i=Ln(null),o=Ln(null),s=Ln(null),l=Ln(null),c=wr;return Jo(()=>{if(!i.current)return;let d=Aa.timeline();if(e&&!t){if(d.to(i.current,{borderColor:"transparent",duration:0.15,ease:"power2.out"}),o.current){let u=o.current.getTotalLength();Aa.set(o.current,{strokeDasharray:u,strokeDashoffset:u}),d.to(o.current,{strokeDashoffset:0,duration:0.3,ease:"power3.out"},"-=0.1")}if(l.current)d.fromTo(l.current,{scale:0,opacity:0.6},{scale:2.5,opacity:0,duration:0.5,ease:"power2.out"},"-=0.3")}else if(t){if(d.to(i.current,{borderColor:"transparent",duration:0.15,ease:"power2.out"}),s.current)d.fromTo(s.current,{scaleX:0,opacity:0},{scaleX:1,opacity:1,duration:0.25,ease:"back.out(2)"},"-=0.1")}else{if(o.current){let u=o.current.getTotalLength();d.to(o.current,{strokeDashoffset:u,duration:0.2,ease:"power2.in"})}if(s.current)d.to(s.current,{scaleX:0,opacity:0,duration:0.15,ease:"power2.in"},"<");d.to(i.current,{borderColor:"",duration:0.15,ease:"power2.out"},"-=0.1")}},[e,t]),Dr("div",{ref:i,className:ut(c.checkbox.base,c.checkbox.size[r],c.checkbox.border.base,c.checkbox.rounded,c.checkbox.shadow,c.checkbox.transition,!e&&!t&&c.checkbox.border.color.light,!e&&!t&&c.checkbox.border.color.dark,!e&&!t&&c.checkbox.background.unchecked.light,!e&&!t&&c.checkbox.background.unchecked.dark,(e||t)&&c.checkbox.background.checked[n],(e||t)&&"border-transparent",a&&c.checkbox.disabled.opacity,a&&c.checkbox.disabled.cursor),children:[Dr("div",{ref:l,className:ut(c.ripple.base,c.ripple.color[n])},void 0,!1,void 0,this),Dr("svg",{viewBox:"0 0 24 24",fill:"none",className:ut(c.checkIcon.base,c.checkIcon.size[r],"opacity-0",e&&!t&&"opacity-100"),"aria-hidden":"true",children:Dr("path",{ref:o,d:"M4 12.5L9.5 18L20 6",strokeLinecap:"round",strokeLinejoin:"round",className:ut(c.checkIcon.stroke.width,c.checkIcon.stroke.color),fill:"none"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Dr("div",{ref:s,className:ut(c.indeterminateIcon.base,c.indeterminateIcon.size[r].width,c.indeterminateIcon.size[r].height,c.indeterminateIcon.background,c.indeterminateIcon.rounded,"opacity-0 scale-x-0",t&&"opacity-100")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ko}from"@gsap/react";import Qo from"gsap";import{useRef as Vr}from"react";import{jsxDEV as vr}from"react/jsx-dev-runtime";Qo.registerPlugin(Ko);function $a({checked:e,size:t,color:r,disabled:n=!1}){let a=Vr(null),i=Vr(null),o=Vr(null),s=Vr(null),l=Vr(null),c=wr,d=(u)=>{return{sm:{unchecked:2,checked:18},md:{unchecked:2,checked:24},lg:{unchecked:2,checked:30}}[t][u?"checked":"unchecked"]};return Ko(()=>{if(!i.current||!a.current)return;let u=Qo.timeline();if(e){if(u.to(i.current,{x:d(!0),duration:0.35,ease:"elastic.out(1, 0.75)"}),u.to(i.current,{scale:1.1,duration:0.15,ease:"power2.out"},"<"),u.to(i.current,{scale:1,duration:0.2,ease:"power2.inOut"}),o.current)u.fromTo(o.current,{scale:0,rotate:-180,opacity:0},{scale:1,rotate:0,opacity:1,duration:0.3,ease:"back.out(2)"},"-=0.4");if(s.current)u.to(s.current,{scale:0,rotate:90,opacity:0,duration:0.2,ease:"power2.in"},"<-0.2");if(l.current)u.fromTo(l.current,{opacity:0,scale:0.8},{opacity:0.6,scale:1,duration:0.3,ease:"power2.out"},"-=0.3").to(l.current,{opacity:0,duration:0.5,ease:"power2.inOut"})}else{if(u.to(i.current,{x:d(!1),duration:0.35,ease:"elastic.out(1, 0.75)"}),u.to(i.current,{scale:0.9,duration:0.1,ease:"power2.out"},"<"),u.to(i.current,{scale:1,duration:0.15,ease:"power2.inOut"}),s.current)u.fromTo(s.current,{scale:0,rotate:-90,opacity:0},{scale:1,rotate:0,opacity:1,duration:0.25,ease:"back.out(1.5)"},"-=0.35");if(o.current)u.to(o.current,{scale:0,rotate:180,opacity:0,duration:0.2,ease:"power2.in"},"<-0.15")}},[e,t]),vr("div",{ref:a,className:ut(c.switch.track.base,c.switch.track.size[t].width,c.switch.track.size[t].height,c.switch.track.rounded,c.switch.track.shadow,c.switch.track.transition,!e&&c.switch.track.background.unchecked.light,!e&&c.switch.track.background.unchecked.dark,e&&c.switch.track.background.checked[r],n&&c.switch.track.disabled.opacity,n&&c.switch.track.disabled.cursor),children:[vr("div",{ref:l,className:ut("absolute inset-0 rounded-full blur-md opacity-0",e&&c.switch.track.background.checked[r])},void 0,!1,void 0,this),vr("div",{ref:i,className:ut(c.switch.thumb.base,c.switch.thumb.size[t],c.switch.thumb.background.light,c.switch.thumb.shadow,c.switch.thumb.rounded,"transform-gpu"),style:{x:d(e)},children:[vr("svg",{ref:o,viewBox:"0 0 24 24",fill:"none",className:ut(c.switch.icon.base,c.switch.icon.size[t],"text-emerald-500","opacity-0"),"aria-hidden":"true",children:vr("path",{d:"M5 13l4 4L19 7",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this),vr("svg",{ref:s,viewBox:"0 0 24 24",fill:"none",className:ut(c.switch.icon.base,c.switch.icon.size[t],c.switch.icon.color.unchecked.light,"opacity-100"),"aria-hidden":"true",children:vr("path",{d:"M6 6l12 12M6 18L18 6",stroke:"currentColor",strokeWidth:"2.5",strokeLinecap:"round"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Et}from"react/jsx-dev-runtime";Ga.registerPlugin(Zo);function Dt({checked:e,onChange:t,variant:r="checkbox",size:n="md",color:a="primary",label:i,labelPosition:o="right",disabled:s=!1,indeterminate:l=!1,name:c,value:d,id:u,required:w=!1,errorMessage:g,helperText:m,className:S,labelClassName:b,ariaLabel:z,ariaDescribedBy:k}){let R=Fa(null),p=Fa(null),T=Fa(null),y=lc(),N=u||y,L=wr,{contextSafe:O}=Zo({scope:R}),F=O(()=>{if(s)return;if(T.current)Ga.to(T.current,{scale:0.97,duration:0.1,ease:"power2.out",onComplete:()=>{Ga.to(T.current,{scale:1,duration:0.15,ease:"elastic.out(1, 0.5)"})}});t(!e)}),Y=(_)=>{if(_.key===" "||_.key==="Enter")_.preventDefault(),F()},re=()=>{if(r==="switch")return Et($a,{checked:e,size:n,color:a,disabled:s},void 0,!1,void 0,this);return Et(Oa,{checked:e,indeterminate:l,size:n,color:a,disabled:s},void 0,!1,void 0,this)},E=()=>{if(!i)return null;return Et("span",{className:ut(L.label.base,L.label.text.size[n],L.label.text.color.light,L.label.text.color.dark,s&&L.label.disabled,b),children:[i,w&&Et("span",{className:"text-red-500 ml-0.5",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return Et("div",{ref:R,className:ut(L.container.base,L.container.spacing,s&&L.container.disabled,S),children:[Et("label",{ref:T,htmlFor:N,className:ut(L.wrapper.base,L.wrapper.gap[n],s&&"cursor-not-allowed",o==="left"&&"flex-row-reverse"),onKeyDown:Y,children:[Et("input",{ref:p,type:"checkbox",id:N,name:c,value:d,checked:e,disabled:s,required:w,onChange:F,className:"sr-only","aria-label":z||(typeof i==="string"?i:void 0),"aria-describedby":k,"aria-checked":l?"mixed":e,"aria-invalid":!!g},void 0,!1,void 0,this),re(),E()]},void 0,!0,void 0,this),g&&Et("span",{className:ut(L.errorText.base,L.errorText.text,L.errorText.color),children:g},void 0,!1,void 0,this),m&&!g&&Et("span",{className:ut(L.helperText.base,L.helperText.text,L.helperText.color.light,L.helperText.color.dark),children:m},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Cs}from"@gsap/react";import Ts from"gsap";import{useRef as Xa}from"react";var ye={container:{base:"w-full overflow-hidden",border:"border border-gray-200 dark:border-gray-700",rounded:"rounded-lg",shadow:"shadow-sm"},scrollContainer:{base:"overflow-auto",maxHeight:"max-h-[70vh]",scrollbar:"scrollbar-thin scrollbar-thumb-gray-300 dark:scrollbar-thumb-gray-600 scrollbar-track-transparent"},table:{base:"w-full border-collapse table-fixed",layout:"min-w-full"},header:{wrapper:{base:"sticky top-0 z-10",background:"bg-gray-50 dark:bg-gray-800"},row:{base:"",border:"border-b border-gray-200 dark:border-gray-700"},cell:{base:"relative select-none bg-gray-50 dark:bg-gray-800",padding:"px-4 py-3",text:"text-left text-xs font-semibold uppercase tracking-wider",color:"text-gray-600 dark:text-gray-300",transition:"transition-colors duration-200",hover:"hover:bg-gray-100 dark:hover:bg-gray-750",sortable:"cursor-pointer",sorted:"bg-gray-100 dark:bg-gray-750"},sortIcon:{base:"inline-flex ml-1.5 transition-transform duration-300",active:"text-primary-500 dark:text-primary-400",inactive:"text-gray-400 dark:text-gray-500"},resizeHandle:{base:"absolute right-0 top-0 h-full w-1 cursor-col-resize",idle:"bg-transparent hover:bg-primary-400 dark:hover:bg-primary-500",active:"bg-primary-500 dark:bg-primary-400",hitArea:'before:absolute before:right-[-4px] before:top-0 before:h-full before:w-[9px] before:content-[""]'}},body:{wrapper:{base:""},row:{base:"group",border:"border-b border-gray-100 dark:border-gray-700/50",transition:"transition-colors duration-150",hover:"hover:bg-gray-50 dark:hover:bg-gray-800/50",zebra:{even:"bg-white dark:bg-gray-900",odd:"bg-gray-50/50 dark:bg-gray-800/30"}},cell:{base:"relative",padding:"px-4 py-3",text:"text-sm",color:"text-gray-900 dark:text-gray-100",truncate:"truncate",transition:"transition-all duration-150",hover:"group-hover:bg-gray-50/50 dark:group-hover:bg-gray-800/30"},resizeHandle:{base:"absolute bottom-0 left-0 w-full h-1 cursor-row-resize",idle:"bg-transparent hover:bg-primary-400 dark:hover:bg-primary-500",active:"bg-primary-500 dark:bg-primary-400",hitArea:'before:absolute before:bottom-[-4px] before:left-0 before:w-full before:h-[9px] before:content-[""]'}},loading:{wrapper:"flex items-center justify-center py-8",spinner:{base:"animate-spin rounded-full border-2",size:"h-8 w-8",color:"border-primary-500 border-t-transparent"},text:"ml-3 text-sm text-gray-500 dark:text-gray-400"},empty:{wrapper:"flex flex-col items-center justify-center py-12",icon:"h-12 w-12 text-gray-300 dark:text-gray-600 mb-4",text:"text-sm text-gray-500 dark:text-gray-400"},infiniteScroll:{trigger:"h-1 w-full",loader:"flex items-center justify-center py-4"},animation:{row:{enter:{opacity:0,y:10},visible:{opacity:1,y:0},duration:0.3,stagger:0.02},cell:{hover:{scale:1.01},duration:0.15},sort:{duration:0.3,ease:"power2.out"},resize:{duration:0.1,ease:"power1.out"}}};import{clsx as dc}from"clsx";import{twMerge as cc}from"tailwind-merge";function ue(...e){return cc(dc(e))}import{jsxDEV as Rn}from"react/jsx-dev-runtime";function Xo({message:e="No data available",className:t}){let r=ye.empty;return Rn("div",{className:ue(r.wrapper,t),children:[Rn("svg",{className:r.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:Rn("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Rn("p",{className:r.text,children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useEffect as Eo,useRef as qa}from"react";import{jsxDEV as Ya}from"react/jsx-dev-runtime";function Mn({text:e="Loading...",className:t}){let r=ye.loading;return Ya("div",{className:ue(r.wrapper,t),children:[Ya("div",{className:ue(r.spinner.base,r.spinner.size,r.spinner.color)},void 0,!1,void 0,this),e&&Ya("span",{className:r.text,children:e},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as _a}from"react/jsx-dev-runtime";function Do({isLoading:e,hasMoreData:t,onTrigger:r,scrollContainerRef:n,autoFetchUntilScroll:a=!1,className:i}){let o=qa(null),s=qa(null),l=qa(!1),c=()=>{if(!a||!n.current||e||!t)return;let w=n.current;if(!(w.scrollHeight>w.clientHeight))r()};Eo(()=>{if(!a||!t)return;let w=setTimeout(()=>{c()},100);return()=>clearTimeout(w)},[a,t,e]),Eo(()=>{l.current=!1},[]);let d=(w)=>{if(s.current)s.current.disconnect();if(!w||!t)return;s.current=new IntersectionObserver((g)=>{if(g[0]?.isIntersecting&&!e&&t)r()},{threshold:0.1,rootMargin:"100px"}),s.current.observe(w)},u=ye.infiniteScroll;if(!t&&!e)return null;return _a("div",{ref:(w)=>{o.current=w,d(w)},className:ue(u.trigger,i),children:e&&_a("div",{className:u.loader,children:_a(Mn,{text:"Loading more..."},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as ns}from"@gsap/react";import as from"gsap";import{useRef as is}from"react";import{useGSAP as Vo}from"@gsap/react";import jo from"gsap";import{useRef as es}from"react";import{jsxDEV as In}from"react/jsx-dev-runtime";function ts({columnCount:e,rowIndex:t,columnWidths:r,hasActionColumn:n}){let a=es(null),i=ye;Vo(()=>{if(!a.current)return;jo.fromTo(a.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,delay:t*0.05,ease:"power2.out"})},[t]);let o=n?e+1:e;return In("tr",{ref:a,className:ue(i.body.row.base,i.body.row.transition,t%2===0?i.body.row.zebra.even:i.body.row.zebra.odd),children:Array.from({length:o}).map((s,l)=>In("td",{style:{width:r[l]??150},className:ue(i.body.cell.base,i.body.cell.padding),children:In(uc,{},void 0,!1,void 0,this)},l,!1,void 0,this))},void 0,!1,void 0,this)}function uc(){let e=es(null);return Vo(()=>{if(!e.current)return;jo.to(e.current,{backgroundPosition:"200% 0",duration:1.5,repeat:-1,ease:"none"})},[]),In("div",{ref:e,className:"h-4 w-3/4 rounded bg-gradient-to-r from-gray-200 via-gray-300 to-gray-200 bg-[length:200%_100%] dark:from-zinc-700 dark:via-zinc-600 dark:to-zinc-700"},void 0,!1,void 0,this)}import{jsxDEV as Gt}from"react/jsx-dev-runtime";function os({columns:e,actionColumns:t,rowCount:r=5,defaultColumnWidth:n=150}){let a=is(null),i=ye;ns(()=>{if(!a.current)return;as.fromTo(a.current,{opacity:0},{opacity:1,duration:0.3,ease:"power2.out"})},[]);let o=e.map((s)=>s.width??n);if(t?.length)t.forEach((s)=>{o.push(s.width??n)});return Gt("table",{ref:a,className:ue(i.table.base,i.table.layout),children:[Gt("thead",{className:i.header.wrapper.base,children:Gt("tr",{className:i.header.row.base,children:[e.map((s,l)=>Gt("th",{style:{width:o[l]},className:ue(i.header.cell.base,i.header.cell.padding,i.header.cell.text,i.header.cell.color),children:Gt(rs,{},void 0,!1,void 0,this)},String(s.key),!1,void 0,this)),t?.map((s)=>Gt("th",{style:{width:s.width??n},className:ue(i.header.cell.base,i.header.cell.padding,i.header.cell.text,i.header.cell.color),children:Gt(rs,{},void 0,!1,void 0,this)},s.key,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Gt("tbody",{className:i.body.wrapper.base,children:Array.from({length:r}).map((s,l)=>Gt(ts,{columnCount:e.length,rowIndex:l,columnWidths:o,hasActionColumn:Boolean(t?.length)},l,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}function rs(){let e=is(null);return ns(()=>{if(!e.current)return;as.to(e.current,{backgroundPosition:"200% 0",duration:1.5,repeat:-1,ease:"none"})},[]),Gt("div",{ref:e,className:"h-4 w-1/2 rounded bg-gradient-to-r from-gray-300 via-gray-400 to-gray-300 bg-[length:200%_100%] dark:from-zinc-600 dark:via-zinc-500 dark:to-zinc-600"},void 0,!1,void 0,this)}import{useRef as ms}from"react";import{useGSAP as ss}from"@gsap/react";import Ja from"gsap";import{useRef as pc}from"react";import{jsxDEV as mc}from"react/jsx-dev-runtime";Ja.registerPlugin(ss);function ls({type:e,isActive:t,onResizeStart:r,className:n}){let a=pc(null);ss(()=>{if(!a.current)return;if(t)Ja.to(a.current,{scaleY:e==="column"?1.1:1,scaleX:e==="row"?1.1:1,duration:ye.animation.resize.duration,ease:ye.animation.resize.ease});else Ja.to(a.current,{scaleY:1,scaleX:1,duration:ye.animation.resize.duration,ease:ye.animation.resize.ease})},[t,e]);let i=e==="column"?ye.header.resizeHandle:ye.body.resizeHandle;return mc("button",{ref:a,type:"button","aria-label":`Resize ${e}`,className:ue(i.base,t?i.active:i.idle,i.hitArea,"appearance-none border-none bg-transparent p-0",n),onMouseDown:r,onTouchStart:r},void 0,!1,void 0,this)}import{useGSAP as cs}from"@gsap/react";import us from"gsap";import{useRef as gc}from"react";import{jsxDEV as ds}from"react/jsx-dev-runtime";us.registerPlugin(cs);function ps({direction:e,isActive:t,className:r}){let n=gc(null);cs(()=>{if(!n.current)return;let i=t&&e==="desc"?180:0;us.to(n.current,{rotation:i,opacity:t?1:0.4,duration:ye.animation.sort.duration,ease:ye.animation.sort.ease})},[e,t]);let a=ye.header.sortIcon;return ds("svg",{ref:n,className:ue(a.base,t?a.active:a.inactive,r),width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:ds("path",{d:"M6 2L10 7H2L6 2Z",fill:"currentColor"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as jr}from"react/jsx-dev-runtime";function gs({column:e,width:t,sortDirection:r,isResizing:n,isSorted:a,onSort:i,onResizeStart:o,onDoubleClick:s,headerMiddleware:l}){let c=ms(null),d=ms(null),u=ye.header.cell,w=()=>{if(e.sortable&&i)i()},g=()=>{if(e.headerRenderer)return e.headerRenderer(e);if(l){let m=l(e,e.key);if(m!==void 0)return m}return e.header};return jr("th",{ref:c,scope:"col","data-column-key":String(e.key),style:{width:`${t}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ue(u.base,u.padding,u.text,u.color,u.transition,u.hover,e.sortable&&u.sortable,a&&u.sorted,e.headerClassName),onClick:w,onDoubleClick:s,"aria-sort":a?r==="asc"?"ascending":"descending":void 0,children:[jr("div",{ref:d,className:"flex items-center",children:[jr("span",{className:"truncate",children:g()},void 0,!1,void 0,this),e.sortable&&jr(ps,{direction:r,isActive:a},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.resizable!==!1&&jr(ls,{type:"column",isActive:n,onResizeStart:o},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as hc}from"@gsap/react";import en from"gsap";import{useRef as Ka}from"react";import{batch as Wn,createStore as bc}from"h-state";var fc={sortColumnKey:null,sortDirection:null,columnWidths:{},rowHeights:{},resizingColumn:null,resizingRow:null,hoveredRow:null,hoveredCell:null,editingCell:null,editValue:"",isLoadingMore:!1,selectedRows:[]},{useStore:Vt}=bc(fc,{setSortState:(e)=>(t,r)=>{Wn(()=>{e.sortColumnKey=t,e.sortDirection=r})},setColumnWidth:(e)=>(t,r)=>{e.columnWidths[t]=r},setRowHeight:(e)=>(t,r)=>{e.rowHeights[t]=r},setResizingColumn:(e)=>(t)=>{e.resizingColumn=t},setResizingRow:(e)=>(t)=>{e.resizingRow=t},setHoveredRow:(e)=>(t)=>{e.hoveredRow=t},setHoveredCell:(e)=>(t)=>{e.hoveredCell=t},setEditingCell:(e)=>(t)=>{e.editingCell=t},setEditValue:(e)=>(t)=>{e.editValue=t},startEditing:(e)=>(t,r,n)=>{Wn(()=>{e.editingCell={row:t,column:r},e.editValue=n})},cancelEditing:(e)=>()=>{Wn(()=>{e.editingCell=null,e.editValue=""})},setIsLoadingMore:(e)=>(t)=>{e.isLoadingMore=t},resetWidths:(e)=>()=>{Wn(()=>{e.columnWidths={},e.rowHeights={}})},autoFitColumn:(e)=>(t,r)=>{e.columnWidths[t]=Math.max(r+32,60)},toggleRowSelection:(e)=>(t)=>{if(e.selectedRows.indexOf(t)===-1)e.selectedRows=[...e.selectedRows,t];else e.selectedRows=e.selectedRows.filter((n)=>n!==t)},selectAllRows:(e)=>(t)=>{e.selectedRows=Array.from({length:t},(r,n)=>n)},clearSelection:(e)=>()=>{e.selectedRows=[]},isRowSelected:(e)=>(t)=>{return e.selectedRows.includes(t)}});import{jsxDEV as xr}from"react/jsx-dev-runtime";function Hn({rowIndex:e,isHovered:t,isHeader:r=!1,totalRows:n=0}){let a=Ka(null),i=Ka(null),o=Ka(null),s=Vt(),l=ye,c=r?!1:s.selectedRows.includes(e),d=r&&n>0&&s.selectedRows.length===n,u=r&&s.selectedRows.length>0&&s.selectedRows.length<n;hc(()=>{if(!i.current||!o.current)return;if(en.killTweensOf([i.current,o.current]),t||c)en.set(i.current,{opacity:0,display:"none"}),en.set(o.current,{opacity:1,display:"flex"});else en.set(i.current,{opacity:1,display:"flex"}),en.set(o.current,{opacity:0,display:"none"})},[t,c]);let w=(g)=>{if(g.stopPropagation(),r)if(d||u)s.clearSelection();else s.selectAllRows(n);else s.toggleRowSelection(e)};if(r)return xr("th",{ref:a,scope:"col",className:ue(l.header.cell.base,l.header.cell.padding,l.header.cell.text,l.header.cell.color,"w-12 text-center"),children:xr("div",{className:"flex items-center justify-center",children:xr("input",{type:"checkbox",checked:d,ref:o,onChange:()=>{},onClick:w,className:ue("h-4 w-4 cursor-pointer rounded border-gray-300","text-blue-600 focus:ring-blue-500","dark:border-gray-600 dark:bg-zinc-700"),style:{opacity:u?0.5:1}},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);return xr("td",{ref:a,className:ue(l.body.cell.base,l.body.cell.padding,l.body.cell.text,l.body.cell.color,"w-12 text-center"),children:xr("div",{className:"flex items-center justify-center relative",children:[xr("span",{ref:i,className:"text-gray-400 dark:text-gray-500 text-xs font-medium",children:e+1},void 0,!1,void 0,this),xr("input",{ref:o,type:"checkbox",checked:c,onChange:()=>{},onClick:w,className:ue("absolute h-4 w-4 cursor-pointer rounded border-gray-300","text-blue-600 focus:ring-blue-500","dark:border-gray-600 dark:bg-zinc-700"),style:{display:"none"}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as tn}from"react/jsx-dev-runtime";function bs({columns:e,actionColumns:t,columnWidths:r,sortColumnKey:n,sortDirection:a,resizingColumn:i,defaultColumnWidth:o,onSort:s,onResizeStart:l,onColumnDoubleClick:c,headerMiddleware:d,enableSelection:u,totalRows:w=0}){let g=ye.header,m=(S,b)=>{return r[S]??b??o};return tn("thead",{className:ue(g.wrapper.base,g.wrapper.background),children:tn("tr",{className:ue(g.row.base,g.row.border),children:[u&&tn(Hn,{rowIndex:-1,isHovered:!1,isHeader:!0,totalRows:w},void 0,!1,void 0,this),e.map((S)=>{let b=String(S.key);return tn(gs,{column:S,width:m(b,S.width),sortDirection:n===S.key?a:null,isResizing:i===b,isSorted:n===S.key,onSort:()=>s(S.key),onResizeStart:(z)=>l(b,z),onDoubleClick:()=>c(b),headerMiddleware:d},b,!1,void 0,this)}),t?.map((S)=>tn("th",{scope:"col",style:{width:`${m(S.key,S.width)}px`,minWidth:S.minWidth},className:ue(g.cell.base,g.cell.padding,g.cell.text,g.cell.color,S.headerClassName),children:S.header},S.key,!1,void 0,this))]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as xs}from"@gsap/react";import zs from"gsap";import{useRef as vs}from"react";import{useRef as yc}from"react";import{jsxDEV as kc}from"react/jsx-dev-runtime";function fs({column:e,row:t,rowIndex:r,width:n}){let a=yc(null),i=ye.body.cell,o={row:t,rowIndex:r,columnKey:e.key},s=()=>{return e.renderer(o)};return kc("td",{ref:a,style:{width:`${n}px`,minWidth:e.minWidth},className:ue(i.base,i.padding,i.text,i.color,i.transition,e.cellClassName),children:s()},void 0,!1,void 0,this)}import{useGSAP as hs}from"@gsap/react";import Qa from"gsap";import{useRef as wc}from"react";import{jsxDEV as vc}from"react/jsx-dev-runtime";Qa.registerPlugin(hs);function ys({column:e,row:t,rowIndex:r,width:n,isHovered:a,hasClickAction:i,hasDoubleClickAction:o,onClick:s,onDoubleClick:l,cellMiddleware:c}){let d=wc(null),u=ye.body.cell,{contextSafe:w}=hs({scope:d}),g=w(()=>{if(!d.current||!a)return;Qa.to(d.current,{scale:ye.animation.cell.hover.scale,duration:ye.animation.cell.duration})}),m=w(()=>{if(!d.current)return;Qa.to(d.current,{scale:1,duration:ye.animation.cell.duration})}),S=()=>{let z=e.key;return t[z]},b=()=>{let z=S(),k={value:z,row:t,rowIndex:r,columnKey:e.key,column:e};if(e.cellRenderer)return e.cellRenderer(k);if(c){let R=c(k);if(R!==void 0)return R}if(z===null||z===void 0)return"";return String(z)};return vc("td",{ref:d,"data-column-key":String(e.key),style:{width:`${n}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ue(u.base,u.padding,u.text,u.color,u.truncate,u.transition,(i||o)&&"cursor-pointer",e.cellClassName),onClick:i?s:void 0,onDoubleClick:o?l:void 0,onKeyDown:i||o?(z)=>{if(z.key==="Enter"&&i&&s)s()}:void 0,onMouseEnter:g,onMouseLeave:m,children:b()},void 0,!1,void 0,this)}import{useGSAP as ks}from"@gsap/react";import Un from"gsap";import{useRef as Za}from"react";import{jsxDEV as kt}from"react/jsx-dev-runtime";function ws({column:e,row:t,rowIndex:r,width:n,isHovered:a,onSave:i,cellMiddleware:o}){let s=Za(null),l=Za(null),c=Za(null),d=Vt(),u=ye,w=String(e.key),g=d.editingCell?.row===r&&d.editingCell?.column===w,m=e.editConfig??{type:"text",showIconOnHover:!0},b=(()=>{let L=e.key;return t[L]})(),z=b===null||b===void 0?"":String(b);ks(()=>{if(!c.current)return;if(Un.killTweensOf(c.current),a&&!g&&m.showIconOnHover!==!1)Un.to(c.current,{opacity:1,scale:1,duration:0.15,ease:"power2.out",overwrite:!0});else Un.set(c.current,{opacity:0,scale:0.8})},[a,g,m.showIconOnHover]),ks(()=>{if(g&&l.current)Un.fromTo(l.current,{opacity:0,scale:0.95},{opacity:1,scale:1,duration:0.2,ease:"power2.out"}),l.current.focus(),l.current.select()},[g]);let k=()=>{d.startEditing(r,w,z)},R=()=>{i(d.editValue),d.cancelEditing()},p=()=>{d.cancelEditing()},T=(L)=>{if(L.key==="Enter"&&!L.shiftKey)L.preventDefault(),R();else if(L.key==="Escape")p()},y=()=>{let L={value:b,row:t,rowIndex:r,columnKey:e.key,column:e};if(e.cellRenderer)return e.cellRenderer(L);if(o){let O=o(L);if(O!==void 0)return O}return z},N=()=>{let L=m.type??"text";if(L==="textarea")return kt("textarea",{ref:l,value:d.editValue,onChange:(O)=>d.setEditValue(O.target.value),onKeyDown:T,placeholder:m.placeholder,maxLength:m.maxLength,className:ue("w-full resize-none rounded border border-blue-500 bg-white px-2 py-1 text-sm","focus:outline-none focus:ring-2 focus:ring-blue-500","dark:border-blue-400 dark:bg-zinc-800 dark:text-white"),rows:2},void 0,!1,void 0,this);if(L==="select"&&m.selectOptions)return kt("select",{value:d.editValue,onChange:(O)=>d.setEditValue(O.target.value),onKeyDown:T,className:ue("w-full rounded border border-blue-500 bg-white px-2 py-1 text-sm","focus:outline-none focus:ring-2 focus:ring-blue-500","dark:border-blue-400 dark:bg-zinc-800 dark:text-white"),children:m.selectOptions.map((O)=>kt("option",{value:O.value,children:O.label},O.value,!1,void 0,this))},void 0,!1,void 0,this);return kt("input",{ref:l,type:L==="number"?"number":"text",value:d.editValue,onChange:(O)=>d.setEditValue(O.target.value),onKeyDown:T,placeholder:m.placeholder,maxLength:m.maxLength,className:ue("w-full rounded border border-blue-500 bg-white px-2 py-1 text-sm","focus:outline-none focus:ring-2 focus:ring-blue-500","dark:border-blue-400 dark:bg-zinc-800 dark:text-white")},void 0,!1,void 0,this)};if(g)return kt("td",{ref:s,"data-column-key":w,style:{width:`${n}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ue(u.body.cell.base,"p-1",e.cellClassName),children:kt("div",{className:"flex flex-col gap-1",children:[N(),kt("div",{className:"flex justify-end gap-1",children:[kt("button",{type:"button",onClick:R,className:ue("rounded bg-green-500 px-2 py-0.5 text-xs text-white","hover:bg-green-600 transition-colors"),children:"Save"},void 0,!1,void 0,this),kt("button",{type:"button",onClick:p,className:ue("rounded bg-gray-400 px-2 py-0.5 text-xs text-white","hover:bg-gray-500 transition-colors dark:bg-zinc-600 dark:hover:bg-zinc-500"),children:"Cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this);return kt("td",{ref:s,"data-column-key":w,style:{width:`${n}px`,minWidth:e.minWidth,maxWidth:e.maxWidth},className:ue(u.body.cell.base,u.body.cell.padding,u.body.cell.text,u.body.cell.color,u.body.cell.truncate,u.body.cell.transition,"group relative",e.cellClassName),children:kt("div",{className:"flex items-center gap-2",children:[kt("span",{className:"flex-1 truncate",children:y()},void 0,!1,void 0,this),e.editable&&kt("button",{ref:c,type:"button",onClick:k,"aria-label":"Edit cell",className:ue("flex-shrink-0 rounded p-1 opacity-0","text-gray-500 hover:bg-gray-200 hover:text-gray-700","dark:text-gray-400 dark:hover:bg-zinc-700 dark:hover:text-gray-200","transition-colors"),children:kt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[kt("path",{d:"M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z"},void 0,!1,void 0,this),kt("path",{d:"m15 5 4 4"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)}import{jsxDEV as rn}from"react/jsx-dev-runtime";zs.registerPlugin(xs);function Ns({row:e,rowIndex:t,columns:r,actionColumns:n,defaultColumnWidth:a,hasClickAction:i,hasDoubleClickAction:o,onCellClick:s,onCellDoubleClick:l,onCellEdit:c,cellMiddleware:d,animationDelay:u=0,enableSelection:w}){let g=vs(null),m=Vt(),S=ye.body.row,b=ye.animation.row,z=m.hoveredRow===t,k=m.columnWidths,R=vs(!1);xs(()=>{if(!g.current||R.current)return;zs.fromTo(g.current,{opacity:b.enter.opacity,y:b.enter.y},{opacity:b.visible.opacity,y:b.visible.y,duration:b.duration,delay:u,ease:"power2.out"}),R.current=!0},[]);let p=(L,O)=>{return k[L]??O??a},T=t%2===0,y=(L,O)=>{if(!s)return;let F=O?null:e[L];s({value:F,row:e,rowIndex:t,columnKey:L,isActionColumn:O})},N=(L,O)=>{if(!l)return;let F=O?null:e[L];l({value:F,row:e,rowIndex:t,columnKey:L,isActionColumn:O})};return rn("tr",{ref:g,className:ue(S.base,S.border,S.transition,S.hover,T?S.zebra.even:S.zebra.odd),onMouseEnter:()=>m.setHoveredRow(t),onMouseLeave:()=>m.setHoveredRow(null),children:[w&&rn(Hn,{rowIndex:t,isHovered:z},void 0,!1,void 0,this),r.map((L)=>{let O=String(L.key),F=p(O,L.width);if(L.editable)return rn(ws,{column:L,row:e,rowIndex:t,width:F,isHovered:z,onSave:(Y)=>{if(c){let re=e[L.key];c({row:e,rowIndex:t,columnKey:L.key,oldValue:re,newValue:Y})}},cellMiddleware:d},O,!1,void 0,this);return rn(ys,{column:L,row:e,rowIndex:t,width:F,isHovered:z,hasClickAction:i,hasDoubleClickAction:o,onClick:()=>y(L.key,!1),onDoubleClick:()=>N(L.key,!1),cellMiddleware:d},O,!1,void 0,this)}),n?.map((L)=>rn(fs,{column:L,row:e,rowIndex:t,width:p(L.key,L.width)},L.key,!1,void 0,this))]},void 0,!0,void 0,this)}function Ps({onAutoFit:e}){return{autoFit:(r,n)=>{if(!n)return;let a=n.querySelectorAll(`td[data-column="${r}"], th[data-column="${r}"]`),i=0;if(a.forEach((o)=>{let s=o.firstElementChild;if(s){let l=s.scrollWidth;i=Math.max(i,l)}else i=Math.max(i,o.scrollWidth)}),i>0)e(r,i)}}}import{useRef as nn}from"react";function Ss({minWidth:e,tableRef:t,onResizeStart:r,onResizeEnd:n}){let a=nn(0),i=nn(0),o=nn(""),s=nn(0),l=nn(!1),c=(p)=>{if(!t.current)return null;return t.current.querySelector(`th[data-column-key="${p}"]`)},d=(p)=>{if(!t.current)return[];let T=c(p),y=t.current.querySelectorAll(`td[data-column-key="${p}"]`),N=[];if(T)N.push(T);for(let L of Array.from(y))N.push(L);return N},u=(p)=>{if(!t.current)return;let T=Array.from(t.current.querySelectorAll("th[data-column-key]")),y=T.length-1;for(let N=0;N<T.length;N++){let L=T[N];if(!L)continue;let O=L.getAttribute("data-column-key");if(!O)continue;let F=N===y,Y=L.offsetWidth,re=d(O);for(let E of re)if(p&&F)E.style.width="";else E.style.width=`${Y}px`,E.style.minWidth=`${Y}px`,E.style.maxWidth=`${Y}px`}},w=(p)=>{let T=d(o.current);for(let y of T)y.style.width=`${p}px`,y.style.minWidth=`${p}px`,y.style.maxWidth=`${p}px`;s.current=p},g=(p)=>{p.preventDefault();let T=p.clientX-a.current,y=Math.max(e,i.current+T);w(y)},m=(p)=>{p.preventDefault();let T=p.touches[0];if(!T)return;let y=T.clientX-a.current,N=Math.max(e,i.current+y);w(N)},S=()=>{document.body.style.cursor="",document.body.style.userSelect="",l.current=!0,setTimeout(()=>{l.current=!1},100)},b=()=>l.current,z=()=>{document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",z),S(),n(o.current,s.current)},k=()=>{document.removeEventListener("touchmove",m),document.removeEventListener("touchend",k),S(),n(o.current,s.current)};return{startResize:(p,T)=>{T.preventDefault(),T.stopPropagation();let y=c(p);if(!y)return;let N=y.offsetWidth;if(o.current=p,i.current=N,s.current=N,u(!0),r(p),document.body.style.cursor="col-resize",document.body.style.userSelect="none","touches"in T){let L=T.touches[0];if(!L)return;a.current=L.clientX,document.addEventListener("touchmove",m,{passive:!1}),document.addEventListener("touchend",k)}else a.current=T.clientX,document.addEventListener("mousemove",g),document.addEventListener("mouseup",z)},isJustResized:b}}import{jsxDEV as bt}from"react/jsx-dev-runtime";Ts.registerPlugin(Cs);var xc={hasClickAction:!1,hasDoubleClickAction:!1,isFrontendSort:!0,enableInfiniteScroll:!1,infiniteScrollThreshold:100,pageSize:20,autoFetchUntilScroll:!0,defaultColumnWidth:150,defaultRowHeight:48,minColumnWidth:60,minRowHeight:32,enableSelection:!1,selectionColumnWidth:48};function Bn({data:e,columns:t,actionColumns:r,keyExtractor:n,callbacks:a,config:i,className:o,headerMiddleware:s,cellMiddleware:l,isLoading:c,isPending:d,skeletonRowCount:u=5,emptyMessage:w,selectionToolbar:g,isLoadingMore:m=!1,hasMoreData:S=!1}){let b={...xc,...i},z=Xa(null),k=Xa(null),R=Vt(),p=ye,{startResize:T,isJustResized:y}=Ss({minWidth:b.minColumnWidth,tableRef:z,onResizeStart:(v)=>{R.setResizingColumn(v)},onResizeEnd:(v,G)=>{R.setResizingColumn(null),R.setColumnWidth(v,G),a?.onColumnResize?.(v,G)}}),{autoFit:N}=Ps({onAutoFit:(v,G)=>{R.autoFitColumn(v,G)}}),L=Xa(!1);Cs(()=>{if(!z.current||L.current)return;Ts.fromTo(z.current,{opacity:0},{opacity:1,duration:0.3,ease:"power2.out"}),L.current=!0},[]);let O=(v)=>{if(y())return;if(!t.find((se)=>se.key===v)?.sortable)return;let K="asc";if(R.sortColumnKey===v){if(R.sortDirection==="asc")K="desc";else if(R.sortDirection==="desc")K=null}if(R.setSortState(String(v),K),!b.isFrontendSort)a?.onSort?.(v,K)},F=(v,G)=>{T(v,G)},Y=(v)=>{N(v,z.current)},re=()=>{if(m)return;a?.onLoadMore?.()},_=(()=>{if(!b.isFrontendSort||!R.sortColumnKey||!R.sortDirection)return e;let{sortColumnKey:v,sortDirection:G}=R;return[...e].sort((K,se)=>{let H=K[v],U=se[v];if(H===U)return 0;if(H===null||H===void 0)return 1;if(U===null||U===void 0)return-1;let C=H<U?-1:1;return G==="asc"?C:-C})})(),A=R.selectedRows.map((v)=>_[v]).filter((v)=>v!==void 0),ee=R.selectedRows.length>0;if(c)return bt("div",{className:ue(p.container.base,p.container.border,p.container.rounded,o),children:bt(Mn,{},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(d)return bt("div",{className:ue(p.container.base,p.container.border,p.container.rounded,p.container.shadow,o),children:bt("div",{className:ue(p.scrollContainer.base,p.scrollContainer.maxHeight,p.scrollContainer.scrollbar),children:bt(os,{columns:t,actionColumns:r,rowCount:u,defaultColumnWidth:b.defaultColumnWidth},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(e.length===0)return bt("div",{className:ue(p.container.base,p.container.border,p.container.rounded,o),children:bt(Xo,{message:w},void 0,!1,void 0,this)},void 0,!1,void 0,this);return bt("div",{className:ue(p.container.base,p.container.border,p.container.rounded,p.container.shadow,o),children:[b.enableSelection&&ee&&g&&bt("div",{className:"flex items-center justify-between border-b border-gray-200 bg-blue-50 px-4 py-2 dark:border-gray-700 dark:bg-blue-900/20",children:[bt("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:[R.selectedRows.length," item selected"]},void 0,!0,void 0,this),bt("div",{className:"flex items-center gap-2",children:g({selectedRows:R.selectedRows,selectedData:A,totalCount:_.length,onClearSelection:R.clearSelection})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),bt("div",{ref:k,className:ue(p.scrollContainer.base,p.scrollContainer.maxHeight,p.scrollContainer.scrollbar),children:[bt("table",{ref:z,className:ue(p.table.base,p.table.layout),children:[bt(bs,{columns:t,actionColumns:r,columnWidths:R.columnWidths,sortColumnKey:R.sortColumnKey,sortDirection:R.sortDirection,resizingColumn:R.resizingColumn,defaultColumnWidth:b.defaultColumnWidth,onSort:O,onResizeStart:F,onColumnDoubleClick:Y,headerMiddleware:s,enableSelection:b.enableSelection,totalRows:_.length},void 0,!1,void 0,this),bt("tbody",{className:p.body.wrapper.base,children:_.map((v,G)=>bt(Ns,{row:v,rowIndex:G,columns:t,actionColumns:r,defaultColumnWidth:b.defaultColumnWidth,hasClickAction:b.hasClickAction,hasDoubleClickAction:b.hasDoubleClickAction,onCellClick:a?.onCellClick,onCellDoubleClick:a?.onCellDoubleClick,onCellEdit:a?.onCellEdit,cellMiddleware:l,animationDelay:G*p.animation.row.stagger,enableSelection:b.enableSelection},n(v,G),!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),b.enableInfiniteScroll&&bt(Do,{isLoading:m,hasMoreData:S,onTrigger:re,scrollContainerRef:k,autoFetchUntilScroll:b.autoFetchUntilScroll},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ms}from"@gsap/react";import Is from"gsap";import{useRef as Pc}from"react";var jt={container:{base:"relative flex flex-col w-full",spacing:"gap-1"},input:{wrapper:{base:"relative flex items-center w-full cursor-pointer",border:{base:"border border-gray-300 dark:border-gray-600",focused:"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500/20",error:"border-red-500 dark:border-red-400",disabled:"border-gray-200 dark:border-gray-700 cursor-not-allowed"},background:{light:"bg-white",dark:"dark:bg-gray-800"},padding:"px-4 py-3",rounded:"rounded-lg",shadow:"shadow-sm",transition:"transition-all duration-200 ease-out"},text:{base:"flex-1",size:"text-base",color:{light:"text-gray-900",dark:"dark:text-white"},placeholder:{light:"text-gray-400",dark:"dark:text-gray-500"}},icon:{base:"flex items-center justify-center flex-shrink-0",size:"w-5 h-5",color:{light:"text-gray-400",dark:"dark:text-gray-500",focused:"text-blue-500 dark:text-blue-400"},spacing:{left:"mr-3",right:"ml-3"}}},label:{base:"block",text:{size:"text-sm font-medium",color:{light:"text-gray-700",dark:"dark:text-gray-300"}},spacing:"mb-1.5"},dropdown:{base:"absolute left-0 right-0 z-50",background:{light:"bg-white",dark:"dark:bg-gray-800"},border:{light:"border border-gray-200",dark:"dark:border-gray-700"},rounded:"rounded-xl",shadow:"shadow-xl",padding:"p-4",spacing:{top:"mb-2",bottom:"mt-2"},position:{top:"bottom-full",bottom:"top-full"}},calendar:{base:"select-none",width:"w-72"},header:{base:"flex items-center justify-between",padding:"mb-4",button:{base:"flex items-center justify-center",size:"w-8 h-8",color:{light:"text-gray-600",dark:"dark:text-gray-400"},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},rounded:"rounded-lg",transition:"transition-colors duration-150"},title:{base:"flex items-center justify-center cursor-pointer",text:{size:"text-base",weight:"font-semibold",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},rounded:"rounded-lg",padding:"px-3 py-1.5",transition:"transition-colors duration-150"}},weekdays:{base:"grid grid-cols-7",padding:"mb-2",text:{size:"text-xs",weight:"font-medium",color:{light:"text-gray-500",dark:"dark:text-gray-400"}}},grid:{base:"grid grid-cols-7",gap:""},dayWrapper:{base:"flex items-center justify-center",inRange:{light:"bg-blue-100",dark:"dark:bg-blue-900/40"},rangeStart:"rounded-l-lg",rangeEnd:"rounded-r-lg"},day:{base:"flex items-center justify-center cursor-pointer",size:"w-9 h-9",text:{size:"text-sm",color:{light:"text-gray-900",dark:"dark:text-white"}},rounded:"rounded-lg",transition:"transition-all duration-150",states:{hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},selected:{background:"bg-blue-500 dark:bg-blue-600",text:"text-white"},today:{border:"ring-2 ring-blue-500 ring-inset",text:"text-blue-600 dark:text-blue-400 font-semibold"},disabled:{opacity:"opacity-30",cursor:"cursor-not-allowed"},inRange:{light:"bg-blue-100",dark:"dark:bg-blue-900/40"},rangeStart:{rounded:"rounded-l-lg rounded-r-none"},rangeEnd:{rounded:"rounded-r-lg rounded-l-none"},otherMonth:{opacity:"opacity-40"}}},monthSelector:{base:"py-2",grid:"grid grid-cols-3 gap-2",item:{base:"flex items-center justify-center cursor-pointer",padding:"px-3 py-2",rounded:"rounded-lg",text:{size:"text-sm",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},selected:{background:"bg-blue-500 dark:bg-blue-600",text:"text-white"},transition:"transition-colors duration-150"}},yearSelector:{base:"py-2 max-h-64 overflow-y-auto",grid:"grid grid-cols-4 gap-2",item:{base:"flex items-center justify-center cursor-pointer",padding:"px-2 py-2",rounded:"rounded-lg",text:{size:"text-sm",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"},selected:{background:"bg-blue-500 dark:bg-blue-600",text:"text-white"},transition:"transition-colors duration-150"}},footer:{base:"flex items-center justify-between",padding:"mt-4 pt-4",border:{light:"border-t border-gray-200",dark:"dark:border-gray-700"},button:{base:"flex items-center justify-center",padding:"px-4 py-2",rounded:"rounded-lg",text:{size:"text-sm font-medium"},today:{background:{light:"bg-blue-50",dark:"dark:bg-blue-900/30"},text:{light:"text-blue-600",dark:"dark:text-blue-400"},hover:{light:"hover:bg-blue-100",dark:"dark:hover:bg-blue-900/50"}},clear:{background:"bg-transparent",text:{light:"text-gray-600",dark:"dark:text-gray-400"},hover:{light:"hover:bg-gray-100",dark:"dark:hover:bg-gray-700"}},transition:"transition-colors duration-150"}},rangeIndicator:{base:"flex items-center justify-center",text:{size:"text-sm",color:{light:"text-gray-600",dark:"dark:text-gray-400"}},padding:"py-2 mb-2",separator:"mx-2"},helperText:{base:"mt-1",text:"text-sm",color:{light:"text-gray-500",dark:"dark:text-gray-400"}},errorText:{base:"mt-1",text:"text-sm",color:"text-red-500"}};import{clsx as zc}from"clsx";import{twMerge as Nc}from"tailwind-merge";function fe(...e){return Nc(zc(e))}var Ls={"tr-TR":{months:["Ocak","\u015Eubat","Mart","Nisan","May\u0131s","Haziran","Temmuz","A\u011Fustos","Eyl\xFCl","Ekim","Kas\u0131m","Aral\u0131k"],monthsShort:["Oca","\u015Eub","Mar","Nis","May","Haz","Tem","A\u011Fu","Eyl","Eki","Kas","Ara"],weekdays:["Pazar","Pazartesi","Sal\u0131","\xC7ar\u015Famba","Per\u015Fembe","Cuma","Cumartesi"],weekdaysShort:["Paz","Pzt","Sal","\xC7ar","Per","Cum","Cmt"],weekdaysMin:["Pz","Pt","Sa","\xC7a","Pe","Cu","Ct"],today:"Bug\xFCn",clear:"Temizle",close:"Kapat",selectDate:"Tarih se\xE7in",selectStartDate:"Ba\u015Flang\u0131\xE7 tarihi",selectEndDate:"Biti\u015F tarihi",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"en-US":{months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],today:"Today",clear:"Clear",close:"Close",selectDate:"Select date",selectStartDate:"Start date",selectEndDate:"End date",dateFormat:"MM/dd/yyyy",firstDayOfWeek:0},"en-GB":{months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],weekdays:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],weekdaysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],weekdaysMin:["Su","Mo","Tu","We","Th","Fr","Sa"],today:"Today",clear:"Clear",close:"Close",selectDate:"Select date",selectStartDate:"Start date",selectEndDate:"End date",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"de-DE":{months:["Januar","Februar","M\xE4rz","April","Mai","Juni","Juli","August","September","Oktober","November","Dezember"],monthsShort:["Jan","Feb","M\xE4r","Apr","Mai","Jun","Jul","Aug","Sep","Okt","Nov","Dez"],weekdays:["Sonntag","Montag","Dienstag","Mittwoch","Donnerstag","Freitag","Samstag"],weekdaysShort:["So","Mo","Di","Mi","Do","Fr","Sa"],weekdaysMin:["So","Mo","Di","Mi","Do","Fr","Sa"],today:"Heute",clear:"L\xF6schen",close:"Schlie\xDFen",selectDate:"Datum ausw\xE4hlen",selectStartDate:"Startdatum",selectEndDate:"Enddatum",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"fr-FR":{months:["Janvier","F\xE9vrier","Mars","Avril","Mai","Juin","Juillet","Ao\xFBt","Septembre","Octobre","Novembre","D\xE9cembre"],monthsShort:["Jan","F\xE9v","Mar","Avr","Mai","Jun","Jul","Ao\xFB","Sep","Oct","Nov","D\xE9c"],weekdays:["Dimanche","Lundi","Mardi","Mercredi","Jeudi","Vendredi","Samedi"],weekdaysShort:["Dim","Lun","Mar","Mer","Jeu","Ven","Sam"],weekdaysMin:["Di","Lu","Ma","Me","Je","Ve","Sa"],today:"Aujourd'hui",clear:"Effacer",close:"Fermer",selectDate:"S\xE9lectionner une date",selectStartDate:"Date de d\xE9but",selectEndDate:"Date de fin",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"es-ES":{months:["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre"],monthsShort:["Ene","Feb","Mar","Abr","May","Jun","Jul","Ago","Sep","Oct","Nov","Dic"],weekdays:["Domingo","Lunes","Martes","Mi\xE9rcoles","Jueves","Viernes","S\xE1bado"],weekdaysShort:["Dom","Lun","Mar","Mi\xE9","Jue","Vie","S\xE1b"],weekdaysMin:["Do","Lu","Ma","Mi","Ju","Vi","S\xE1"],today:"Hoy",clear:"Limpiar",close:"Cerrar",selectDate:"Seleccionar fecha",selectStartDate:"Fecha de inicio",selectEndDate:"Fecha de fin",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"it-IT":{months:["Gennaio","Febbraio","Marzo","Aprile","Maggio","Giugno","Luglio","Agosto","Settembre","Ottobre","Novembre","Dicembre"],monthsShort:["Gen","Feb","Mar","Apr","Mag","Giu","Lug","Ago","Set","Ott","Nov","Dic"],weekdays:["Domenica","Luned\xEC","Marted\xEC","Mercoled\xEC","Gioved\xEC","Venerd\xEC","Sabato"],weekdaysShort:["Dom","Lun","Mar","Mer","Gio","Ven","Sab"],weekdaysMin:["Do","Lu","Ma","Me","Gi","Ve","Sa"],today:"Oggi",clear:"Cancella",close:"Chiudi",selectDate:"Seleziona data",selectStartDate:"Data di inizio",selectEndDate:"Data di fine",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"pt-BR":{months:["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda-feira","Ter\xE7a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S\xE1bado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"],weekdaysMin:["Do","Se","Te","Qa","Qi","Sx","S\xE1"],today:"Hoje",clear:"Limpar",close:"Fechar",selectDate:"Selecionar data",selectStartDate:"Data inicial",selectEndDate:"Data final",dateFormat:"dd/MM/yyyy",firstDayOfWeek:0},"pt-PT":{months:["Janeiro","Fevereiro","Mar\xE7o","Abril","Maio","Junho","Julho","Agosto","Setembro","Outubro","Novembro","Dezembro"],monthsShort:["Jan","Fev","Mar","Abr","Mai","Jun","Jul","Ago","Set","Out","Nov","Dez"],weekdays:["Domingo","Segunda-feira","Ter\xE7a-feira","Quarta-feira","Quinta-feira","Sexta-feira","S\xE1bado"],weekdaysShort:["Dom","Seg","Ter","Qua","Qui","Sex","S\xE1b"],weekdaysMin:["Do","Se","Te","Qa","Qi","Sx","S\xE1"],today:"Hoje",clear:"Limpar",close:"Fechar",selectDate:"Selecionar data",selectStartDate:"Data inicial",selectEndDate:"Data final",dateFormat:"dd/MM/yyyy",firstDayOfWeek:1},"nl-NL":{months:["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"],monthsShort:["Jan","Feb","Mrt","Apr","Mei","Jun","Jul","Aug","Sep","Okt","Nov","Dec"],weekdays:["Zondag","Maandag","Dinsdag","Woensdag","Donderdag","Vrijdag","Zaterdag"],weekdaysShort:["Zo","Ma","Di","Wo","Do","Vr","Za"],weekdaysMin:["Zo","Ma","Di","Wo","Do","Vr","Za"],today:"Vandaag",clear:"Wissen",close:"Sluiten",selectDate:"Selecteer datum",selectStartDate:"Startdatum",selectEndDate:"Einddatum",dateFormat:"dd-MM-yyyy",firstDayOfWeek:1},"pl-PL":{months:["Stycze\u0144","Luty","Marzec","Kwiecie\u0144","Maj","Czerwiec","Lipiec","Sierpie\u0144","Wrzesie\u0144","Pa\u017Adziernik","Listopad","Grudzie\u0144"],monthsShort:["Sty","Lut","Mar","Kwi","Maj","Cze","Lip","Sie","Wrz","Pa\u017A","Lis","Gru"],weekdays:["Niedziela","Poniedzia\u0142ek","Wtorek","\u015Aroda","Czwartek","Pi\u0105tek","Sobota"],weekdaysShort:["Nd","Pn","Wt","\u015Ar","Cz","Pt","So"],weekdaysMin:["Nd","Pn","Wt","\u015Ar","Cz","Pt","So"],today:"Dzisiaj",clear:"Wyczy\u015B\u0107",close:"Zamknij",selectDate:"Wybierz dat\u0119",selectStartDate:"Data pocz\u0105tkowa",selectEndDate:"Data ko\u0144cowa",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"ru-RU":{months:["\u042F\u043D\u0432\u0430\u0440\u044C","\u0424\u0435\u0432\u0440\u0430\u043B\u044C","\u041C\u0430\u0440\u0442","\u0410\u043F\u0440\u0435\u043B\u044C","\u041C\u0430\u0439","\u0418\u044E\u043D\u044C","\u0418\u044E\u043B\u044C","\u0410\u0432\u0433\u0443\u0441\u0442","\u0421\u0435\u043D\u0442\u044F\u0431\u0440\u044C","\u041E\u043A\u0442\u044F\u0431\u0440\u044C","\u041D\u043E\u044F\u0431\u0440\u044C","\u0414\u0435\u043A\u0430\u0431\u0440\u044C"],monthsShort:["\u042F\u043D\u0432","\u0424\u0435\u0432","\u041C\u0430\u0440","\u0410\u043F\u0440","\u041C\u0430\u0439","\u0418\u044E\u043D","\u0418\u044E\u043B","\u0410\u0432\u0433","\u0421\u0435\u043D","\u041E\u043A\u0442","\u041D\u043E\u044F","\u0414\u0435\u043A"],weekdays:["\u0412\u043E\u0441\u043A\u0440\u0435\u0441\u0435\u043D\u044C\u0435","\u041F\u043E\u043D\u0435\u0434\u0435\u043B\u044C\u043D\u0438\u043A","\u0412\u0442\u043E\u0440\u043D\u0438\u043A","\u0421\u0440\u0435\u0434\u0430","\u0427\u0435\u0442\u0432\u0435\u0440\u0433","\u041F\u044F\u0442\u043D\u0438\u0446\u0430","\u0421\u0443\u0431\u0431\u043E\u0442\u0430"],weekdaysShort:["\u0412\u0441","\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431"],weekdaysMin:["\u0412\u0441","\u041F\u043D","\u0412\u0442","\u0421\u0440","\u0427\u0442","\u041F\u0442","\u0421\u0431"],today:"\u0421\u0435\u0433\u043E\u0434\u043D\u044F",clear:"\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C",close:"\u0417\u0430\u043A\u0440\u044B\u0442\u044C",selectDate:"\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0434\u0430\u0442\u0443",selectStartDate:"\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430",selectEndDate:"\u0414\u0430\u0442\u0430 \u043E\u043A\u043E\u043D\u0447\u0430\u043D\u0438\u044F",dateFormat:"dd.MM.yyyy",firstDayOfWeek:1},"ja-JP":{months:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],monthsShort:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],weekdays:["\u65E5\u66DC\u65E5","\u6708\u66DC\u65E5","\u706B\u66DC\u65E5","\u6C34\u66DC\u65E5","\u6728\u66DC\u65E5","\u91D1\u66DC\u65E5","\u571F\u66DC\u65E5"],weekdaysShort:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],weekdaysMin:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],today:"\u4ECA\u65E5",clear:"\u30AF\u30EA\u30A2",close:"\u9589\u3058\u308B",selectDate:"\u65E5\u4ED8\u3092\u9078\u629E",selectStartDate:"\u958B\u59CB\u65E5",selectEndDate:"\u7D42\u4E86\u65E5",dateFormat:"yyyy/MM/dd",firstDayOfWeek:0},"ko-KR":{months:["1\uC6D4","2\uC6D4","3\uC6D4","4\uC6D4","5\uC6D4","6\uC6D4","7\uC6D4","8\uC6D4","9\uC6D4","10\uC6D4","11\uC6D4","12\uC6D4"],monthsShort:["1\uC6D4","2\uC6D4","3\uC6D4","4\uC6D4","5\uC6D4","6\uC6D4","7\uC6D4","8\uC6D4","9\uC6D4","10\uC6D4","11\uC6D4","12\uC6D4"],weekdays:["\uC77C\uC694\uC77C","\uC6D4\uC694\uC77C","\uD654\uC694\uC77C","\uC218\uC694\uC77C","\uBAA9\uC694\uC77C","\uAE08\uC694\uC77C","\uD1A0\uC694\uC77C"],weekdaysShort:["\uC77C","\uC6D4","\uD654","\uC218","\uBAA9","\uAE08","\uD1A0"],weekdaysMin:["\uC77C","\uC6D4","\uD654","\uC218","\uBAA9","\uAE08","\uD1A0"],today:"\uC624\uB298",clear:"\uC9C0\uC6B0\uAE30",close:"\uB2EB\uAE30",selectDate:"\uB0A0\uC9DC \uC120\uD0DD",selectStartDate:"\uC2DC\uC791\uC77C",selectEndDate:"\uC885\uB8CC\uC77C",dateFormat:"yyyy.MM.dd",firstDayOfWeek:0},"zh-CN":{months:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],monthsShort:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],weekdays:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],weekdaysShort:["\u5468\u65E5","\u5468\u4E00","\u5468\u4E8C","\u5468\u4E09","\u5468\u56DB","\u5468\u4E94","\u5468\u516D"],weekdaysMin:["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],today:"\u4ECA\u5929",clear:"\u6E05\u9664",close:"\u5173\u95ED",selectDate:"\u9009\u62E9\u65E5\u671F",selectStartDate:"\u5F00\u59CB\u65E5\u671F",selectEndDate:"\u7ED3\u675F\u65E5\u671F",dateFormat:"yyyy-MM-dd",firstDayOfWeek:1},"zh-TW":{months:["\u4E00\u6708","\u4E8C\u6708","\u4E09\u6708","\u56DB\u6708","\u4E94\u6708","\u516D\u6708","\u4E03\u6708","\u516B\u6708","\u4E5D\u6708","\u5341\u6708","\u5341\u4E00\u6708","\u5341\u4E8C\u6708"],monthsShort:["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],weekdays:["\u661F\u671F\u65E5","\u661F\u671F\u4E00","\u661F\u671F\u4E8C","\u661F\u671F\u4E09","\u661F\u671F\u56DB","\u661F\u671F\u4E94","\u661F\u671F\u516D"],weekdaysShort:["\u9031\u65E5","\u9031\u4E00","\u9031\u4E8C","\u9031\u4E09","\u9031\u56DB","\u9031\u4E94","\u9031\u516D"],weekdaysMin:["\u65E5","\u4E00","\u4E8C","\u4E09","\u56DB","\u4E94","\u516D"],today:"\u4ECA\u5929",clear:"\u6E05\u9664",close:"\u95DC\u9589",selectDate:"\u9078\u64C7\u65E5\u671F",selectStartDate:"\u958B\u59CB\u65E5\u671F",selectEndDate:"\u7D50\u675F\u65E5\u671F",dateFormat:"yyyy/MM/dd",firstDayOfWeek:0},"ar-SA":{months:["\u064A\u0646\u0627\u064A\u0631","\u0641\u0628\u0631\u0627\u064A\u0631","\u0645\u0627\u0631\u0633","\u0623\u0628\u0631\u064A\u0644","\u0645\u0627\u064A\u0648","\u064A\u0648\u0646\u064A\u0648","\u064A\u0648\u0644\u064A\u0648","\u0623\u063A\u0633\u0637\u0633","\u0633\u0628\u062A\u0645\u0628\u0631","\u0623\u0643\u062A\u0648\u0628\u0631","\u0646\u0648\u0641\u0645\u0628\u0631","\u062F\u064A\u0633\u0645\u0628\u0631"],monthsShort:["\u064A\u0646\u0627","\u0641\u0628\u0631","\u0645\u0627\u0631","\u0623\u0628\u0631","\u0645\u0627\u064A","\u064A\u0648\u0646","\u064A\u0648\u0644","\u0623\u063A\u0633","\u0633\u0628\u062A","\u0623\u0643\u062A","\u0646\u0648\u0641","\u062F\u064A\u0633"],weekdays:["\u0627\u0644\u0623\u062D\u062F","\u0627\u0644\u0625\u062B\u0646\u064A\u0646","\u0627\u0644\u062B\u0644\u0627\u062B\u0627\u0621","\u0627\u0644\u0623\u0631\u0628\u0639\u0627\u0621","\u0627\u0644\u062E\u0645\u064A\u0633","\u0627\u0644\u062C\u0645\u0639\u0629","\u0627\u0644\u0633\u0628\u062A"],weekdaysShort:["\u0623\u062D\u062F","\u0625\u062B\u0646","\u062B\u0644\u0627","\u0623\u0631\u0628","\u062E\u0645\u064A","\u062C\u0645\u0639","\u0633\u0628\u062A"],weekdaysMin:["\u062D","\u0646","\u062B","\u0631","\u062E","\u062C","\u0633"],today:"\u0627\u0644\u064A\u0648\u0645",clear:"\u0645\u0633\u062D",close:"\u0625\u063A\u0644\u0627\u0642",selectDate:"\u0627\u062E\u062A\u0631 \u062A\u0627\u0631\u064A\u062E",selectStartDate:"\u062A\u0627\u0631\u064A\u062E \u0627\u0644\u0628\u062F\u0627\u064A\u0629",selectEndDate:"\u062A\u0627\u0631\u064A\u062E \u0627\u0644\u0646\u0647\u0627\u064A\u0629",dateFormat:"dd/MM/yyyy",firstDayOfWeek:6}};function At(e){return Ls[e]}function Ea(e,t,r){let n=[],a=new Date(e,t,1),i=new Date(e,t+1,0),o=a.getDay()-r;if(o<0)o+=7;for(let l=o-1;l>=0;l--)n.push(new Date(e,t,-l));for(let l=1;l<=i.getDate();l++)n.push(new Date(e,t,l));let s=42-n.length;for(let l=1;l<=s;l++)n.push(new Date(e,t+1,l));return n}function Lt(e,t){if(!e||!t)return!1;return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()&&e.getDate()===t.getDate()}function Da(e,t){return e.getFullYear()===t.getFullYear()&&e.getMonth()===t.getMonth()}function Va(e){return Lt(e,new Date)}function Ar(e,t,r){if(!t||!r)return!1;let n=e.getTime();return n>t.getTime()&&n<r.getTime()}function an(e,t,r,n,a){if(t&&e<t)return!0;if(r&&e>r)return!0;if(n){for(let i of n)if(Lt(e,i))return!0}if(a&&a.includes(e.getDay()))return!0;return!1}function Br(e,t){if(!e)return"";let r=e.getDate().toString().padStart(2,"0"),n=(e.getMonth()+1).toString().padStart(2,"0"),a=e.getFullYear().toString();return t.replace("dd",r).replace("MM",n).replace("yyyy",a)}function Rs(e,t,r=" - "){if(!e.start&&!e.end)return"";if(!e.start)return Br(e.end,t);if(!e.end)return Br(e.start,t);return`${Br(e.start,t)}${r}${Br(e.end,t)}`}function on(e,t){if(!e)return"";let r=At(t);return Br(e,r.dateFormat)}function ja(e,t,r=" - "){let n=At(t);return Rs(e,n.dateFormat,r)}function Or(e,t){let r=new Date(e);return r.setMonth(r.getMonth()+t),r}function zr(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate())}function ei(e,t=12){let r=[],n=e-Math.floor(t/2);for(let a=0;a<t;a++)r.push(n+a);return r}function ti(e,t){let n=[...At(e).weekdaysMin];for(let a=0;a<t;a++)n.push(n.shift());return n}import{jsxDEV as $r}from"react/jsx-dev-runtime";Is.registerPlugin(Ms);function ri({currentMonth:e,selectedDate:t,selectedRange:r,mode:n,locale:a,minDate:i,maxDate:o,disabledDates:s,disabledDaysOfWeek:l,firstDayOfWeek:c,onDateSelect:d,hoverDate:u,onHoverChange:w}){let g=Pc(null),m=jt,S=Ea(e.getFullYear(),e.getMonth(),c),b=ti(a,c);Ms(()=>{if(!g.current)return;let p=g.current.querySelectorAll("[data-day]");Is.fromTo(p,{opacity:0,scale:0.8},{opacity:1,scale:1,duration:0.3,stagger:{amount:0.15,grid:[6,7],from:"start"},ease:"power2.out"})},[e]);let z=(p)=>{let T=n==="single"?Lt(p,t):r&&(Lt(p,r.start)||Lt(p,r.end)),y=Da(p,e),N=an(p,i,o,s,l),L=Va(p),O=n==="range"&&r?Ar(p,r.start,r.end)||u&&r.start&&!r.end&&Ar(p,r.start,u):!1,F=n==="range"&&r?.start&&!r?.end&&u&&Lt(p,u);return fe(m.day.base,m.day.size,m.day.text.size,m.day.rounded,m.day.transition,!T&&!O&&m.day.text.color.light,!T&&!O&&m.day.text.color.dark,!T&&!O&&!N&&m.day.states.hover.light,!T&&!O&&!N&&m.day.states.hover.dark,!y&&m.day.states.otherMonth.opacity,N&&m.day.states.disabled.opacity,N&&m.day.states.disabled.cursor,L&&!T&&m.day.states.today.border,L&&!T&&m.day.states.today.text,T&&m.day.states.selected.background,T&&m.day.states.selected.text,F&&"ring-2 ring-blue-400 ring-inset")},k=(p)=>{if(an(p,i,o,s,l))return;d(p)},R=(p)=>{if(n==="range")w(p)};return $r("div",{children:[$r("div",{className:fe(m.weekdays.base,m.weekdays.padding),children:b.map((p,T)=>$r("div",{className:fe("flex items-center justify-center",m.day.size,m.weekdays.text.size,m.weekdays.text.weight,m.weekdays.text.color.light,m.weekdays.text.color.dark),children:p},`weekday-${T}`,!1,void 0,this))},void 0,!1,void 0,this),$r("div",{ref:g,className:fe(m.grid.base,m.grid.gap),children:S.map((p,T)=>{let y=n==="range"&&r?.start&&Lt(p,r.start),N=n==="range"&&r?.end&&Lt(p,r.end),L=n==="range"&&r?Ar(p,r.start,r.end)||u&&r.start&&!r.end&&Ar(p,r.start,u):!1,O=n==="range"&&r?.start&&!r?.end&&u&&Lt(p,u),F=L||y||N||O;return $r("div",{className:fe(m.dayWrapper.base,F&&m.dayWrapper.inRange.light,F&&m.dayWrapper.inRange.dark,y&&m.dayWrapper.rangeStart,(N||O)&&m.dayWrapper.rangeEnd,y&&!N&&!O&&"rounded-r-none",(N||O)&&!y&&"rounded-l-none",L&&!y&&!N&&!O&&"rounded-none"),children:$r("button",{type:"button","data-day":!0,onClick:()=>k(p),onMouseEnter:()=>R(p),onMouseLeave:()=>R(null),disabled:an(p,i,o,s,l),className:z(p),"aria-label":p.toLocaleDateString(a),"aria-pressed":n==="single"?Lt(p,t):!!(r&&(Lt(p,r.start)||Lt(p,r.end))),children:p.getDate()},void 0,!1,void 0,this)},`day-${T}`,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ws}from"@gsap/react";import Hs from"gsap";import{useRef as Sc}from"react";import{jsxDEV as pt}from"react/jsx-dev-runtime";Hs.registerPlugin(Ws);function ni({currentMonth:e,onPrevMonth:t,onNextMonth:r,onPrevYear:n,onNextYear:a,onMonthYearClick:i,locale:o,minDate:s,maxDate:l}){let c=Sc(null),d=jt,w=At(o).months[e.getMonth()],g=e.getFullYear(),m=!s||e>s,S=!l||e<l;return Ws(()=>{if(!c.current)return;Hs.fromTo(c.current,{opacity:0,y:-10},{opacity:1,y:0,duration:0.2,ease:"power2.out"})},[e]),pt("div",{className:fe(d.header.base,d.header.padding),children:[pt("div",{className:"flex items-center gap-1",children:[pt("button",{type:"button",onClick:n,disabled:!m,className:fe(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!m&&"opacity-30 cursor-not-allowed"),"aria-label":"Previous year",children:pt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:[pt("polyline",{points:"11 17 6 12 11 7"},void 0,!1,void 0,this),pt("polyline",{points:"18 17 13 12 18 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),pt("button",{type:"button",onClick:t,disabled:!m,className:fe(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!m&&"opacity-30 cursor-not-allowed"),"aria-label":"Previous month",children:pt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:pt("polyline",{points:"15 18 9 12 15 6"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),pt("button",{ref:c,type:"button",onClick:i,className:fe(d.header.title.base,d.header.title.text.size,d.header.title.text.weight,d.header.title.text.color.light,d.header.title.text.color.dark,d.header.title.hover.light,d.header.title.hover.dark,d.header.title.rounded,d.header.title.padding,d.header.title.transition),children:[w," ",g]},void 0,!0,void 0,this),pt("div",{className:"flex items-center gap-1",children:[pt("button",{type:"button",onClick:r,disabled:!S,className:fe(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!S&&"opacity-30 cursor-not-allowed"),"aria-label":"Next month",children:pt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:pt("polyline",{points:"9 18 15 12 9 6"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),pt("button",{type:"button",onClick:a,disabled:!S,className:fe(d.header.button.base,d.header.button.size,d.header.button.color.light,d.header.button.color.dark,d.header.button.hover.light,d.header.button.hover.dark,d.header.button.rounded,d.header.button.transition,!S&&"opacity-30 cursor-not-allowed"),"aria-label":"Next year",children:pt("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-4 h-4","aria-hidden":"true",children:[pt("polyline",{points:"6 17 11 12 6 7"},void 0,!1,void 0,this),pt("polyline",{points:"13 17 18 12 13 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as $s}from"@gsap/react";import ii from"gsap";import{useEffect as As,useId as Tc,useRef as Os,useState as sn}from"react";import{useGSAP as Us}from"@gsap/react";import Bs from"gsap";import{useRef as Cc}from"react";import{jsxDEV as sr}from"react/jsx-dev-runtime";Bs.registerPlugin(Us);function ai({currentMonth:e,onMonthSelect:t,onYearSelect:r,locale:n,minDate:a,maxDate:i,view:o,onViewChange:s,onClose:l}){let c=Cc(null),d=jt,u=At(n),w=e.getFullYear(),g=e.getMonth(),m=ei(w,16);Us(()=>{if(!c.current)return;let z=c.current.querySelectorAll("[data-item]");Bs.fromTo(z,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.25,stagger:0.02,ease:"power2.out"})},[o]);let S=(z)=>{t(z),l()},b=(z)=>{r(z),s("month")};if(o==="year")return sr("div",{ref:c,className:d.yearSelector.base,children:sr("div",{className:d.yearSelector.grid,children:m.map((z)=>{let k=z===w,R=a&&z<a.getFullYear()||i&&z>i.getFullYear();return sr("button",{type:"button","data-item":!0,onClick:()=>b(z),disabled:R,className:fe(d.yearSelector.item.base,d.yearSelector.item.padding,d.yearSelector.item.rounded,d.yearSelector.item.text.size,d.yearSelector.item.transition,k?fe(d.yearSelector.item.selected.background,d.yearSelector.item.selected.text):fe(d.yearSelector.item.text.color.light,d.yearSelector.item.text.color.dark,d.yearSelector.item.hover.light,d.yearSelector.item.hover.dark),R&&"opacity-30 cursor-not-allowed"),children:z},z,!1,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this);return sr("div",{ref:c,className:d.monthSelector.base,children:[sr("div",{className:"flex justify-center mb-3",children:sr("button",{type:"button",onClick:()=>s("year"),className:fe(d.header.title.base,d.header.title.text.size,d.header.title.text.weight,d.header.title.text.color.light,d.header.title.text.color.dark,d.header.title.hover.light,d.header.title.hover.dark,d.header.title.rounded,d.header.title.padding,d.header.title.transition),children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),sr("div",{className:d.monthSelector.grid,children:u.monthsShort.map((z,k)=>{let R=k===g,p=a&&new Date(w,k+1,0)<a||i&&new Date(w,k,1)>i;return sr("button",{type:"button","data-item":!0,onClick:()=>S(k),disabled:p,className:fe(d.monthSelector.item.base,d.monthSelector.item.padding,d.monthSelector.item.rounded,d.monthSelector.item.text.size,d.monthSelector.item.transition,R?fe(d.monthSelector.item.selected.background,d.monthSelector.item.selected.text):fe(d.monthSelector.item.text.color.light,d.monthSelector.item.text.color.dark,d.monthSelector.item.hover.light,d.monthSelector.item.hover.dark),p&&"opacity-30 cursor-not-allowed"),children:z},z,!1,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Ge,Fragment as Lc}from"react/jsx-dev-runtime";ii.registerPlugin($s);function An({mode:e,value:t,onChange:r,locale:n="en-US",placeholder:a,label:i,disabled:o=!1,minDate:s,maxDate:l,disabledDates:c,disabledDaysOfWeek:d,className:u,inputClassName:w,dropdownClassName:g,showClearButton:m=!0,showTodayButton:S=!0,firstDayOfWeek:b,leftIcon:z,rightIcon:k,errorMessage:R,helperText:p,required:T=!1,onOpen:y,onClose:N}){let L=At(n),O=b??L.firstDayOfWeek,[F,Y]=sn(!1),[re,E]=sn("bottom"),[_,A]=sn(()=>{if(e==="single"&&t)return zr(t);if(e==="range"&&t?.start){let D=t;return D.start?zr(D.start):zr(new Date)}return zr(new Date)}),[ee,v]=sn("calendar"),[G,K]=sn(null),se=Os(null),H=Os(null),U=Tc(),C=jt,de=e==="single"?t:null,B=e==="range"?t:null,ae=e==="single"?on(de,n):ja(B||{start:null,end:null},n),ge=a||(e==="range"?`${L.selectStartDate} - ${L.selectEndDate}`:L.selectDate),{contextSafe:Ye}=$s({scope:se});As(()=>{if(!F)return;let D=()=>{if(!se.current)return;let We=se.current.getBoundingClientRect(),M=window.innerHeight-We.bottom,ie=We.top;if(M<400&&ie>M)E("top");else E("bottom")};return D(),window.addEventListener("scroll",D,!0),window.addEventListener("resize",D),()=>{window.removeEventListener("scroll",D,!0),window.removeEventListener("resize",D)}},[F]),As(()=>{if(!F)return;let D=(M)=>{if(se.current&&!se.current.contains(M.target))Pe()},We=(M)=>{if(M.key==="Escape")Pe()};return document.addEventListener("mousedown",D),document.addEventListener("keydown",We),()=>{document.removeEventListener("mousedown",D),document.removeEventListener("keydown",We)}},[F]);let Ie=Ye(()=>{if(o)return;Y(!0),v("calendar"),y?.(),requestAnimationFrame(()=>{if(H.current)ii.fromTo(H.current,{opacity:0,y:re==="bottom"?-12:12,scale:0.96},{opacity:1,y:0,scale:1,duration:0.25,ease:"power3.out"})})}),Pe=Ye(()=>{if(H.current)ii.to(H.current,{opacity:0,y:re==="bottom"?-8:8,scale:0.96,duration:0.15,ease:"power2.in",onComplete:()=>{Y(!1),K(null),N?.()}});else Y(!1),K(null),N?.()}),pe=(D)=>{if(e==="single")r(D),Pe();else{let We=B||{start:null,end:null};if(!We.start||We.start&&We.end)r({start:D,end:null});else{if(D<We.start)r({start:D,end:We.start});else r({start:We.start,end:D});Pe()}}},ke=Ye(()=>{if(e==="single")r(null);else r({start:null,end:null})}),Te=()=>{let D=zr(new Date);if(A(D),e==="single")r(D),Pe()},we=()=>A(Or(_,-1)),be=()=>A(Or(_,1)),P=()=>A(Or(_,-12)),j=()=>A(Or(_,12)),Z=()=>{v(ee==="calendar"?"month":"calendar")},me=(D)=>{A(new Date(_.getFullYear(),D,1)),v("calendar")},J=(D)=>{A(new Date(D,_.getMonth(),1))},te=()=>{if(F)Pe();else Ie()};return Ge("div",{ref:se,className:fe(C.container.base,C.container.spacing,u),children:[i&&Ge("label",{htmlFor:U,className:fe(C.label.base,C.label.text.size,C.label.text.color.light,C.label.text.color.dark,C.label.spacing),children:[i,T&&Ge("span",{className:"text-red-500 ml-1",children:"*"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ge("div",{className:"relative",children:[Ge("button",{id:U,type:"button",onClick:te,disabled:o,className:fe(C.input.wrapper.base,C.input.wrapper.border.base,C.input.wrapper.background.light,C.input.wrapper.background.dark,C.input.wrapper.padding,C.input.wrapper.rounded,C.input.wrapper.shadow,C.input.wrapper.transition,F&&C.input.wrapper.border.focused,R&&C.input.wrapper.border.error,o&&C.input.wrapper.border.disabled,w),"aria-expanded":F,"aria-haspopup":"dialog",children:[z&&Ge("span",{className:fe(C.input.icon.base,C.input.icon.size,C.input.icon.color.light,C.input.icon.color.dark,C.input.icon.spacing.left,F&&C.input.icon.color.focused),children:z},void 0,!1,void 0,this),!z&&Ge("span",{className:fe(C.input.icon.base,C.input.icon.size,C.input.icon.color.light,C.input.icon.color.dark,C.input.icon.spacing.left,F&&C.input.icon.color.focused),children:Ge("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-full h-full","aria-hidden":"true",children:[Ge("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"},void 0,!1,void 0,this),Ge("line",{x1:"16",y1:"2",x2:"16",y2:"6"},void 0,!1,void 0,this),Ge("line",{x1:"8",y1:"2",x2:"8",y2:"6"},void 0,!1,void 0,this),Ge("line",{x1:"3",y1:"10",x2:"21",y2:"10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ge("span",{className:fe(C.input.text.base,C.input.text.size,ae?fe(C.input.text.color.light,C.input.text.color.dark):fe(C.input.text.placeholder.light,C.input.text.placeholder.dark),"text-left"),children:ae||ge},void 0,!1,void 0,this),k&&Ge("span",{className:fe(C.input.icon.base,C.input.icon.size,C.input.icon.color.light,C.input.icon.color.dark,C.input.icon.spacing.right,F&&C.input.icon.color.focused),children:k},void 0,!1,void 0,this)]},void 0,!0,void 0,this),F&&Ge("div",{ref:H,className:fe(C.dropdown.base,C.dropdown.background.light,C.dropdown.background.dark,C.dropdown.border.light,C.dropdown.border.dark,C.dropdown.rounded,C.dropdown.shadow,C.dropdown.padding,re==="top"&&C.dropdown.position.top,re==="top"&&C.dropdown.spacing.top,re==="bottom"&&C.dropdown.position.bottom,re==="bottom"&&C.dropdown.spacing.bottom,g),role:"dialog","aria-modal":"true","aria-label":L.selectDate,children:Ge("div",{className:C.calendar.base,children:[e==="range"&&Ge("div",{className:fe(C.rangeIndicator.base,C.rangeIndicator.padding,"border-b",C.footer.border.light,C.footer.border.dark),children:[Ge("div",{className:fe("flex-1 text-center",C.rangeIndicator.text.size,B?.start?fe(C.input.text.color.light,C.input.text.color.dark):fe(C.rangeIndicator.text.color.light,C.rangeIndicator.text.color.dark)),children:B?.start?on(B.start,n):L.selectStartDate},void 0,!1,void 0,this),Ge("span",{className:fe(C.rangeIndicator.separator,C.rangeIndicator.text.color.light),children:"\u2192"},void 0,!1,void 0,this),Ge("div",{className:fe("flex-1 text-center",C.rangeIndicator.text.size,B?.end?fe(C.input.text.color.light,C.input.text.color.dark):fe(C.rangeIndicator.text.color.light,C.rangeIndicator.text.color.dark)),children:B?.end?on(B.end,n):L.selectEndDate},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ee==="calendar"?Ge(Lc,{children:[Ge(ni,{currentMonth:_,onPrevMonth:we,onNextMonth:be,onPrevYear:P,onNextYear:j,onMonthYearClick:Z,locale:n,minDate:s,maxDate:l},void 0,!1,void 0,this),Ge(ri,{currentMonth:_,selectedDate:de,selectedRange:B,mode:e,locale:n,minDate:s,maxDate:l,disabledDates:c,disabledDaysOfWeek:d,firstDayOfWeek:O,onDateSelect:pe,hoverDate:G,onHoverChange:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Ge(ai,{currentMonth:_,onMonthSelect:me,onYearSelect:J,locale:n,minDate:s,maxDate:l,view:ee==="month"?"month":"year",onViewChange:(D)=>v(D),onClose:()=>v("calendar")},void 0,!1,void 0,this),(S||m)&&Ge("div",{className:fe(C.footer.base,C.footer.padding,C.footer.border.light,C.footer.border.dark),children:[m&&Ge("button",{type:"button",onClick:ke,className:fe(C.footer.button.base,C.footer.button.padding,C.footer.button.rounded,C.footer.button.text.size,C.footer.button.clear.background,C.footer.button.clear.text.light,C.footer.button.clear.text.dark,C.footer.button.clear.hover.light,C.footer.button.clear.hover.dark,C.footer.button.transition),children:L.clear},void 0,!1,void 0,this),S&&Ge("button",{type:"button",onClick:Te,className:fe(C.footer.button.base,C.footer.button.padding,C.footer.button.rounded,C.footer.button.text.size,C.footer.button.today.background.light,C.footer.button.today.background.dark,C.footer.button.today.text.light,C.footer.button.today.text.dark,C.footer.button.today.hover.light,C.footer.button.today.hover.dark,C.footer.button.transition),children:L.today},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),R&&Ge("span",{className:fe(C.errorText.base,C.errorText.text,C.errorText.color),children:R},void 0,!1,void 0,this),p&&!R&&Ge("span",{className:fe(C.helperText.base,C.helperText.text,C.helperText.color.light,C.helperText.color.dark),children:p},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Gs}from"@gsap/react";import Ys from"gsap";import{useRef as Rc}from"react";var Nr={container:{base:"relative min-h-screen w-full",wrapper:"relative z-10 w-full max-w-6xl mx-auto px-4 py-8 sm:px-6 lg:px-8"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-2xl"},header:{container:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4 mb-8",titleWrapper:"flex-1",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white",subtitle:"mt-1 text-sm sm:text-base text-zinc-600 dark:text-zinc-400",badge:"inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900/30 dark:text-blue-400 ml-3",actions:"flex-shrink-0"},stats:{container:"grid grid-cols-3 gap-4 mb-8 p-4 rounded-xl bg-zinc-50 dark:bg-zinc-800/50",item:"text-center",value:"text-2xl font-bold text-zinc-900 dark:text-white",label:"text-xs text-zinc-500 dark:text-zinc-400 mt-1"},deviceList:{container:"mt-6",grid:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",empty:{container:"flex flex-col items-center justify-center py-12 text-center",icon:"w-16 h-16 text-zinc-300 dark:text-zinc-600 mb-4",text:"text-zinc-500 dark:text-zinc-400"}},deviceCard:{base:"group relative flex flex-col transition-all duration-200",padding:"p-4 sm:p-5",background:"bg-white dark:bg-zinc-800/60",backgroundCurrent:"bg-blue-50/50 dark:bg-blue-900/10",border:"border border-zinc-200 dark:border-zinc-700/50",borderCurrent:"border-blue-300 dark:border-blue-700/50",shadow:"shadow-sm",rounded:"rounded-xl",hover:"hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-600",header:{container:"flex items-start gap-3 mb-3",icon:"flex-shrink-0 w-10 h-10 rounded-lg bg-zinc-100 dark:bg-zinc-700 flex items-center justify-center text-zinc-500 dark:text-zinc-400",iconCurrent:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",info:"flex-1 min-w-0",deviceName:"font-medium text-zinc-900 dark:text-white truncate",deviceType:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5"},details:{container:"space-y-2 text-sm",row:"flex items-center justify-between",label:"text-zinc-500 dark:text-zinc-400",value:"text-zinc-700 dark:text-zinc-300 truncate ml-2 text-right"},footer:{container:"flex items-center justify-between mt-4 pt-4 border-t border-zinc-100 dark:border-zinc-700/50",currentBadge:"inline-flex items-center px-2 py-1 rounded-md text-xs font-medium bg-green-100 text-green-700 dark:bg-green-900/30 dark:text-green-400",revokeButton:"text-xs text-red-600 dark:text-red-400 hover:text-red-700 dark:hover:text-red-300 font-medium transition-colors"},trustScore:{container:"mt-3",bar:"h-1.5 w-full bg-zinc-200 dark:bg-zinc-700 rounded-full overflow-hidden",barFill:"h-full rounded-full transition-all duration-300",label:"text-xs text-zinc-500 dark:text-zinc-400 mt-1"}},modal:{overlay:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",container:"bg-white dark:bg-zinc-800 rounded-2xl shadow-2xl max-w-md w-full p-6",title:"text-lg font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 mb-6",actions:"flex gap-3 justify-end"},loading:{container:"flex flex-col items-center justify-center py-12",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400"}};import{jsxDEV as ze}from"react/jsx-dev-runtime";Ys.registerPlugin(Gs);function Mc(e){switch(e?.toLowerCase()){case"mobile":return ze("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-label":"Mobile device",children:[ze("title",{children:"Mobile device"},void 0,!1,void 0,this),ze("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 18h.01M8 21h8a2 2 0 002-2V5a2 2 0 00-2-2H8a2 2 0 00-2 2v14a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);case"tablet":return ze("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-label":"Tablet device",children:[ze("title",{children:"Tablet device"},void 0,!1,void 0,this),ze("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M12 18h.01M7 21h10a2 2 0 002-2V5a2 2 0 00-2-2H7a2 2 0 00-2 2v14a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);default:return ze("svg",{className:"w-5 h-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-label":"Desktop device",children:[ze("title",{children:"Desktop device"},void 0,!1,void 0,this),ze("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}}function Ic(e){if(!e)return"bg-zinc-400";if(e>=80)return"bg-green-500";if(e>=60)return"bg-yellow-500";if(e>=40)return"bg-orange-500";return"bg-red-500"}function Fs(e){if(!e)return"Unknown";return new Date(e).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}function On({device:e,isCurrent:t=!1,onRevoke:r,isRevoking:n=!1}){let a=Nr,i=Rc(null);Gs(()=>{if(!i.current)return;Ys.fromTo(i.current,{opacity:0,y:20},{opacity:1,y:0,duration:0.4,ease:"power2.out"})},{scope:i});let o=e.deviceName||`${e.browserName||"Unknown"} on ${e.osName||"Unknown"}`;return ze("article",{ref:i,className:f(a.deviceCard.base,a.deviceCard.padding,t?a.deviceCard.backgroundCurrent:a.deviceCard.background,t?a.deviceCard.borderCurrent:a.deviceCard.border,a.deviceCard.shadow,a.deviceCard.rounded,!t&&a.deviceCard.hover),children:[ze("header",{className:a.deviceCard.header.container,children:[ze("div",{className:f(a.deviceCard.header.icon,t&&a.deviceCard.header.iconCurrent),children:Mc(e.deviceType)},void 0,!1,void 0,this),ze("div",{className:a.deviceCard.header.info,children:[ze("h3",{className:a.deviceCard.header.deviceName,children:o},void 0,!1,void 0,this),ze("p",{className:a.deviceCard.header.deviceType,children:[e.deviceType||"Desktop"," \u2022 ",e.browserName," ",e.browserVersion]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ze("dl",{className:a.deviceCard.details.container,children:[ze("div",{className:a.deviceCard.details.row,children:[ze("dt",{className:a.deviceCard.details.label,children:"IP Address"},void 0,!1,void 0,this),ze("dd",{className:a.deviceCard.details.value,children:e.ipAddress||"Unknown"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),e.locationCity&&ze("div",{className:a.deviceCard.details.row,children:[ze("dt",{className:a.deviceCard.details.label,children:"Location"},void 0,!1,void 0,this),ze("dd",{className:a.deviceCard.details.value,children:[e.locationCity,e.locationCountry?`, ${e.locationCountry}`:""]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ze("div",{className:a.deviceCard.details.row,children:[ze("dt",{className:a.deviceCard.details.label,children:"Last Active"},void 0,!1,void 0,this),ze("dd",{className:a.deviceCard.details.value,children:Fs(e.lastActivityAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ze("div",{className:a.deviceCard.details.row,children:[ze("dt",{className:a.deviceCard.details.label,children:"First Seen"},void 0,!1,void 0,this),ze("dd",{className:a.deviceCard.details.value,children:Fs(e.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),e.trustScore!==void 0&&ze("div",{className:a.deviceCard.trustScore.container,children:[ze("div",{className:a.deviceCard.trustScore.bar,children:ze("div",{className:f(a.deviceCard.trustScore.barFill,Ic(e.trustScore)),style:{width:`${e.trustScore}%`}},void 0,!1,void 0,this)},void 0,!1,void 0,this),ze("p",{className:a.deviceCard.trustScore.label,children:["Trust Score: ",e.trustScore,"%"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ze("footer",{className:a.deviceCard.footer.container,children:[t?ze("span",{className:a.deviceCard.footer.currentBadge,children:[ze("svg",{className:"w-3 h-3 mr-1",fill:"currentColor",viewBox:"0 0 20 20",children:ze("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this),"Current Device"]},void 0,!0,void 0,this):ze("span",{},void 0,!1,void 0,this),r&&!t&&ze("button",{type:"button",onClick:()=>r(e.id),disabled:n,className:f(a.deviceCard.footer.revokeButton,n&&"opacity-50 cursor-not-allowed"),children:n?"Revoking...":"Revoke Access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Pr}from"react/jsx-dev-runtime";function $n({title:e="Active Devices",subtitle:t="Manage devices that have access to your account",totalDevices:r=0,onRevokeAll:n,isRevokingAll:a=!1,allowRevokeAll:i=!0}){let o=Nr;return Pr("header",{className:o.header.container,children:[Pr("div",{className:o.header.titleWrapper,children:[Pr("h1",{className:o.header.title,children:[e,r>0&&Pr("span",{className:o.header.badge,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Pr("p",{className:o.header.subtitle,children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&r>1&&n&&Pr("div",{className:o.header.actions,children:Pr(V,{variant:"outline",size:"sm",onClick:n,disabled:a,className:"text-red-600 border-red-200 hover:bg-red-50 dark:text-red-400 dark:border-red-800 dark:hover:bg-red-900/20",children:a?"Revoking...":"Revoke All Other Devices"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as _s}from"@gsap/react";import Js from"gsap";import{useEffect as Bc,useEffectEvent as oi,useRef as qs,useState as Gn}from"react";import{batch as Wc,createStore as Hc}from"h-state";var Uc={devices:[],currentSessionId:null,isLoading:!1,isRevoking:null,isRevokingAll:!1,error:null,stats:null},{useStore:Fn}=Hc(Uc,{setDevices:(e)=>(t)=>{e.devices=t},setCurrentSessionId:(e)=>(t)=>{e.currentSessionId=t},setLoading:(e)=>(t)=>{e.isLoading=t},setRevoking:(e)=>(t)=>{e.isRevoking=t},setRevokingAll:(e)=>(t)=>{e.isRevokingAll=t},setError:(e)=>(t)=>{e.error=t},setStats:(e)=>(t)=>{e.stats=t},removeDevice:(e)=>(t)=>{e.devices=e.devices.filter((r)=>r.id!==t)},clearAllDevices:(e)=>(t)=>{if(t&&e.currentSessionId)e.devices=e.devices.filter((r)=>r.id===e.currentSessionId);else e.devices=[]},reset:(e)=>()=>{Wc(()=>{e.devices=[],e.currentSessionId=null,e.isLoading=!1,e.isRevoking=null,e.isRevokingAll=!1,e.error=null,e.stats=null})}});import{jsxDEV as ce}from"react/jsx-dev-runtime";Js.registerPlugin(_s);function Ks({variant:e="default",title:t="Active Devices",subtitle:r="Manage devices that have access to your account",sessionsAction:n,sessionRevokeAction:a,sessionRevokeAllAction:i,sessionsStatsAction:o,sessionsPendingAction:s,sessionApproveAction:l,sessionRejectAction:c,onDeviceRevoked:d,onAllDevicesRevoked:u,onDeviceApproved:w,onDeviceRejected:g,showBackground:m=!1,showStats:S=!0,showPendingDevices:b=!0,allowRevokeAll:z=!0,allowRevokeCurrent:k=!1,className:R}){let p=Nr,T=qs(null),y=qs(null),[N,L]=Gn(!1),[O,F]=Gn(null),[Y,re]=Gn([]),[E,_]=Gn(null),A=Fn(),ee=oi(()=>{A.setLoading(!0),A.setError(null),n.start({payload:void 0,onAfterHandle:(B)=>{let ae=B;if(ae?.data?.sessions)A.setDevices(ae.data.sessions),A.setCurrentSessionId(ae.data.currentSessionId||null);A.setLoading(!1)},onErrorHandle:(B)=>{A.setError(B instanceof Error?B.message:"Failed to load devices"),A.setLoading(!1)}})}),v=oi(()=>{if(!o)return;o.start({payload:void 0,onAfterHandle:(B)=>{let ae=B;if(ae?.data)A.setStats(ae.data)},onErrorHandle:()=>{}})}),G=oi(()=>{if(!s||!b)return;s.start({payload:void 0,onAfterHandle:(B)=>{let ae=B;if(ae?.data?.sessions)re(ae.data.sessions)},onErrorHandle:()=>{}})}),K=(B)=>{if(!l||!B.approvalToken)return;_(B.id),l.start({payload:{token:B.approvalToken},onAfterHandle:()=>{re((ae)=>ae.filter((ge)=>ge.id!==B.id)),_(null),w?.(B.id),ee()},onErrorHandle:()=>{_(null)}})},se=(B)=>{if(!c||!B.approvalToken)return;_(B.id),c.start({payload:{token:B.approvalToken},onAfterHandle:()=>{re((ae)=>ae.filter((ge)=>ge.id!==B.id)),_(null),g?.(B.id)},onErrorHandle:()=>{_(null)}})};Bc(()=>{if(ee(),S)v();if(b)G()},[S,b]),_s(()=>{if(!y.current)return;Js.fromTo(y.current,{opacity:0,y:30},{opacity:1,y:0,duration:0.6,ease:"power3.out"})},{scope:T});let H=(B)=>{F(B),L(!0)},U=()=>{if(!O)return;A.setRevoking(O),L(!1),a.start({payload:{_sessionId:O,reason:"user_revoked"},onAfterHandle:()=>{A.removeDevice(O),A.setRevoking(null),d?.(O),F(null)},onErrorHandle:(B)=>{A.setError(B instanceof Error?B.message:"Failed to revoke device"),A.setRevoking(null),F(null)}})},C=()=>{A.setRevokingAll(!0),i.start({payload:{excludeCurrent:!0,reason:"user_revoked_all"},onAfterHandle:()=>{A.clearAllDevices(!0),A.setRevokingAll(!1),u?.()},onErrorHandle:(B)=>{A.setError(B instanceof Error?B.message:"Failed to revoke all devices"),A.setRevokingAll(!1)}})},de=A.devices.filter((B)=>B.id!==A.currentSessionId).length;return ce("main",{ref:T,className:f(p.container.base,R),"aria-label":"Devices management page",children:[m&&ce(lt,{},void 0,!1,void 0,this),ce("div",{className:p.container.wrapper,children:ce("article",{ref:y,className:f(p.card.base,p.card.padding,p.card.background,p.card.border,p.card.shadow,p.card.rounded),children:[ce($n,{title:t,subtitle:r,totalDevices:A.devices.length,onRevokeAll:C,isRevokingAll:A.isRevokingAll,allowRevokeAll:z&&de>0},void 0,!1,void 0,this),S&&A.stats&&ce("div",{className:p.stats.container,children:[ce("div",{className:p.stats.item,children:[ce("p",{className:p.stats.value,children:A.stats.activeSessions},void 0,!1,void 0,this),ce("p",{className:p.stats.label,children:"Active Sessions"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ce("div",{className:p.stats.item,children:[ce("p",{className:p.stats.value,children:A.stats.uniqueDevices},void 0,!1,void 0,this),ce("p",{className:p.stats.label,children:"Unique Devices"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ce("div",{className:p.stats.item,children:[ce("p",{className:p.stats.value,children:A.stats.uniqueIpAddresses},void 0,!1,void 0,this),ce("p",{className:p.stats.label,children:"IP Addresses"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),A.error&&ce("div",{className:p.error.container,children:ce("p",{className:p.error.text,children:A.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),b&&Y.length>0&&ce("section",{className:"mb-8",children:[ce("h2",{className:"text-lg font-semibold text-amber-600 mb-4 flex items-center gap-2",children:[ce("span",{className:"inline-block w-2 h-2 bg-amber-500 rounded-full animate-pulse"},void 0,!1,void 0,this),"Pending Approval (",Y.length,")"]},void 0,!0,void 0,this),ce("div",{className:p.deviceList.grid,children:Y.map((B)=>ce("div",{className:"bg-amber-50 border border-amber-200 rounded-xl p-4 dark:bg-amber-900/20 dark:border-amber-800",children:[ce("div",{className:"flex items-start gap-3 mb-3",children:[ce("div",{className:"p-2 bg-amber-100 rounded-lg dark:bg-amber-800",children:ce("svg",{className:"w-5 h-5 text-amber-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[ce("title",{children:"Device"},void 0,!1,void 0,this),ce("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),ce("div",{children:[ce("p",{className:"font-medium text-gray-900 dark:text-white",children:B.deviceName||"Unknown Device"},void 0,!1,void 0,this),ce("p",{className:"text-sm text-gray-500",children:[B.browserName," \u2022 ",B.osName]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ce("div",{className:"text-sm text-gray-600 dark:text-gray-400 mb-4",children:[ce("p",{children:["IP: ",B.ipAddress||"Unknown"]},void 0,!0,void 0,this),ce("p",{children:["Requested:"," ",B.approvalRequestedAt?new Date(B.approvalRequestedAt).toLocaleString():"Unknown"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ce("div",{className:"flex gap-2",children:[ce(V,{variant:"primary",size:"sm",onClick:()=>K(B),disabled:E===B.id,className:"flex-1 bg-green-600 hover:bg-green-700",children:E===B.id?"...":"\u2713 Approve"},void 0,!1,void 0,this),ce(V,{variant:"outline",size:"sm",onClick:()=>se(B),disabled:E===B.id,className:"flex-1 text-red-600 border-red-200 hover:bg-red-50",children:E===B.id?"...":"\u2717 Reject"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},B.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),A.isLoading?ce("div",{className:p.loading.container,children:[ce("div",{className:p.loading.spinner},void 0,!1,void 0,this),ce("p",{className:p.loading.text,children:"Loading devices..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):A.devices.length===0?ce("div",{className:p.deviceList.empty.container,children:[ce("svg",{className:p.deviceList.empty.icon,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:[ce("title",{children:"No devices"},void 0,!1,void 0,this),ce("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ce("p",{className:p.deviceList.empty.text,children:"No active devices found"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):ce("section",{className:p.deviceList.container,children:ce("div",{className:p.deviceList.grid,children:A.devices.map((B)=>ce(On,{device:B,isCurrent:B.id===A.currentSessionId||B.isCurrent,onRevoke:B.id!==A.currentSessionId&&!B.isCurrent||k?H:void 0,isRevoking:A.isRevoking===B.id},B.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),N&&ce("div",{className:p.modal.overlay,onClick:()=>L(!1),onKeyDown:(B)=>B.key==="Escape"&&L(!1),role:"dialog","aria-modal":"true","aria-labelledby":"confirm-modal-title",children:ce("div",{className:p.modal.container,onClick:(B)=>B.stopPropagation(),onKeyDown:(B)=>B.stopPropagation(),role:"document",children:[ce("h2",{id:"confirm-modal-title",className:p.modal.title,children:"Revoke Device Access"},void 0,!1,void 0,this),ce("p",{className:p.modal.message,children:"Are you sure you want to revoke access for this device? The user will be logged out immediately."},void 0,!1,void 0,this),ce("div",{className:p.modal.actions,children:[ce(V,{variant:"outline",size:"sm",onClick:()=>{L(!1),F(null)},children:"Cancel"},void 0,!1,void 0,this),ce(V,{variant:"primary",size:"sm",onClick:U,className:"bg-red-600 hover:bg-red-700",children:"Revoke Access"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as si}from"@gsap/react";import qn from"gsap";import{useRef as Qs}from"react";import{batch as Ac,createStore as Oc}from"h-state";var $c={email:"",step:"request",error:null},{useStore:Yn}=Oc($c,{setEmail:(e)=>(t)=>{if(e.email=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{Ac(()=>{e.email="",e.step="request",e.error=null})}});var Sr={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},button:{wrapper:"mt-6"},links:{container:"mt-6 text-center",backToLogin:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer inline-flex items-center gap-1"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},success:{container:"flex flex-col items-center text-center",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",title:"text-xl font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"}};import{jsxDEV as je}from"react/jsx-dev-runtime";qn.registerPlugin(si);function Zs({className:e}){return je("svg",{className:f("w-4 h-4",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:je("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Fc({className:e}){return je("svg",{className:f("w-8 h-8 text-green-600 dark:text-green-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:je("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function li({forgotPasswordAction:e,onBackToLogin:t,backToLoginHref:r}){let n=Sr,a=Qs(null),i=Qs(null),o=Yn(),{contextSafe:s}=si({scope:a}),l=e.state.isPending,c=s((w)=>{if(w.preventDefault(),!o.email){o.setError("Please enter your email address"),d();return}o.setError(null),e.start({payload:{email:o.email},onAfterHandle:()=>{o.setStep("success")},onErrorHandle:(g)=>{let m=g instanceof Error?g.message:"Failed to send reset email. Please try again.";o.setError(m),d()}})}),d=s(()=>{if(!a.current)return;qn.fromTo(a.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{qn.set(a.current,{x:0})}})});si(()=>{if(o.step==="success"&&i.current)qn.fromTo(i.current,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.4,ease:"back.out(1.7)"})},{dependencies:[o.step]});let u=()=>{if(t)t();else if(r)window.location.href=r};if(o.step==="success")return je("div",{ref:i,className:n.success.container,children:[je("div",{className:n.success.iconWrapper,children:je(Fc,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),je("h2",{className:n.success.title,children:"Check your email"},void 0,!1,void 0,this),je("p",{className:n.success.message,children:["We've sent a password reset link to ",je("strong",{children:o.email},void 0,!1,void 0,this),". Please check your inbox and follow the instructions."]},void 0,!0,void 0,this),je("div",{className:n.links.container,children:je("button",{type:"button",onClick:u,className:n.links.backToLogin,children:[je(Zs,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return je("form",{ref:a,onSubmit:c,className:n.form.container,noValidate:!0,children:[o.error&&je("div",{className:n.error.container,role:"alert",children:je("p",{className:n.error.text,children:o.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),je("div",{className:n.form.spacing,children:[je("div",{className:n.input.wrapper,children:je(Fe,{type:"email",label:"Email",placeholder:"you@example.com",value:o.email,onChange:o.setEmail,disabled:l,enableValidation:!1,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),je("div",{className:n.button.wrapper,children:je(V,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:l,disabled:l,children:"Send Reset Link"},void 0,!1,void 0,this)},void 0,!1,void 0,this),je("div",{className:n.links.container,children:je("button",{type:"button",onClick:u,className:n.links.backToLogin,disabled:l,children:[je(Zs,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as lr}from"react/jsx-dev-runtime";function Gc({className:e}){return lr("svg",{className:f("w-8 h-8 text-blue-600 dark:text-blue-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:lr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function di({logo:e,title:t,subtitle:r}){let n=Sr;return lr("header",{className:n.header.container,children:[e?lr("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this):lr("div",{className:n.header.iconWrapper,children:lr(Gc,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),lr("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),lr("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Es}from"@gsap/react";import Ds from"gsap";import{useRef as Xs}from"react";import{jsxDEV as Fr}from"react/jsx-dev-runtime";Ds.registerPlugin(Es);function Vs({logo:e,title:t="Forgot Password?",subtitle:r="No worries, we'll send you reset instructions.",forgotPasswordAction:n,onBackToLogin:a,backToLoginHref:i,showBackground:o=!0,className:s}){let l=Sr,c=Xs(null),d=Xs(null);return Es(()=>{if(!d.current)return;Ds.fromTo(d.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:c}),Fr("main",{ref:c,className:f(l.container.base,s),"aria-label":"Forgot password page",children:[o&&Fr(lt,{},void 0,!1,void 0,this),Fr("div",{className:l.container.wrapper,children:Fr("article",{ref:d,className:f(l.card.base,l.card.padding,l.card.background,l.card.border,l.card.shadow,l.card.rounded),children:[Fr(di,{logo:e,title:t,subtitle:r},void 0,!1,void 0,this),Fr(li,{forgotPasswordAction:n,onBackToLogin:a,backToLoginHref:i},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as el}from"@gsap/react";import ci from"gsap";import{useRef as _c}from"react";import{batch as js,createStore as Yc}from"h-state";var qc={email:"",password:"",rememberMe:!1,isLoading:!1,error:null,captchaId:null,captchaAnswer:"",isAuthenticated:!1,user:null},{useStore:Gr}=Yc(qc,{setEmail:(e)=>(t)=>{if(e.email=t,e.error)e.error=null},setPassword:(e)=>(t)=>{if(e.password=t,e.error)e.error=null},setRememberMe:(e)=>(t)=>{e.rememberMe=t},setLoading:(e)=>(t)=>{e.isLoading=t},setError:(e)=>(t)=>{e.error=t},setCaptchaId:(e)=>(t)=>{e.captchaId=t},setCaptchaAnswer:(e)=>(t)=>{e.captchaAnswer=t},setAuthenticated:(e)=>(t,r)=>{js(()=>{e.isAuthenticated=t,e.user=r??null})},reset:(e)=>()=>{js(()=>{e.email="",e.password="",e.rememberMe=!1,e.isLoading=!1,e.error=null,e.captchaId=null,e.captchaAnswer=""})}});var Cr={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},checkbox:{wrapper:"flex items-center",label:"ml-2 text-sm text-zinc-600 dark:text-zinc-400 select-none cursor-pointer"},links:{container:"flex items-center justify-between mt-1",forgotPassword:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors cursor-pointer",signUp:{wrapper:"mt-6 text-center",text:"text-sm text-zinc-600 dark:text-zinc-400",link:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer"}},button:{wrapper:"mt-6"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},divider:{container:"relative my-6",line:"absolute inset-0 flex items-center",text:"relative flex justify-center text-sm"}};import{jsxDEV as ct}from"react/jsx-dev-runtime";ci.registerPlugin(el);function ui({loginAction:e,captchaGenerateAction:t,captchaConfig:r,showRememberMe:n=!0,showForgotPassword:a=!0,showSignUp:i=!0,forgotPasswordHref:o,signUpHref:s,onForgotPassword:l,onSignUp:c,onSuccess:d}){let u=Cr,w=_c(null),g=Gr(),{contextSafe:m}=el({scope:w}),S=e.state.isPending,b=r?.enabled&&t,z=m((T)=>{if(T.preventDefault(),!g.email||!g.password){g.setError("Please fill in all fields"),k();return}if(b&&(!g.captchaId||!g.captchaAnswer)){g.setError("Please complete the security check"),k();return}g.setError(null),e.start({payload:{email:g.email,password:g.password,rememberMe:g.rememberMe,captchaId:g.captchaId??void 0,captchaAnswer:g.captchaAnswer||void 0},onAfterHandle:(y)=>{let N=y;if(N.success===!1)g.setError(N.message||"Login failed. Please try again."),k();else if(N.success)g.reset(),d?.()},onErrorHandle:(y)=>{let N=y instanceof Error?y.message:"Login failed. Please try again.";g.setError(N),k()}})}),k=m(()=>{if(!w.current)return;ci.fromTo(w.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{ci.set(w.current,{x:0})}})}),R=()=>{if(l)l();else if(o)window.location.href=o},p=()=>{if(c)c();else if(s)window.location.href=s};return ct("form",{ref:w,onSubmit:z,className:u.form.container,noValidate:!0,children:[g.error&&ct("div",{className:u.error.container,role:"alert",children:ct("p",{className:u.error.text,children:g.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),ct("div",{className:u.form.spacing,children:[ct("div",{className:u.input.wrapper,children:ct(Fe,{type:"email",label:"Email",placeholder:"you@example.com",value:g.email,onChange:g.setEmail,disabled:S,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),ct("div",{className:u.input.wrapper,children:ct(Fe,{type:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:g.password,onChange:g.setPassword,disabled:S,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),b&&t&&ct(zn,{generateAction:t,config:r,onChallengeLoad:(T)=>{g.setCaptchaId(T.challengeId),g.setCaptchaAnswer("")},onAnswerChange:(T,y)=>{g.setCaptchaAnswer(y)},disabled:S,autoGenerate:!0},void 0,!1,void 0,this),(n||a)&&ct("div",{className:u.links.container,children:[n&&ct("div",{className:u.checkbox.wrapper,children:[ct(Dt,{checked:g.rememberMe,onChange:g.setRememberMe,disabled:S,size:"sm"},void 0,!1,void 0,this),ct("button",{type:"button",className:u.checkbox.label,onClick:()=>g.setRememberMe(!g.rememberMe),children:"Remember me"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),a&&ct("button",{type:"button",onClick:R,className:f(u.links.forgotPassword),disabled:S,children:"Forgot password?"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ct("div",{className:u.button.wrapper,children:ct(V,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:S,disabled:S,children:"Sign In"},void 0,!1,void 0,this)},void 0,!1,void 0,this),i&&ct("div",{className:u.links.signUp.wrapper,children:ct("span",{className:u.links.signUp.text,children:["Don't have an account?"," ",ct("button",{type:"button",onClick:p,className:u.links.signUp.link,disabled:S,children:"Sign up"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as _n}from"react/jsx-dev-runtime";function Jn({logo:e,title:t,subtitle:r}){let n=Cr;return _n("header",{className:n.header.container,children:[e&&_n("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this),t&&_n("h1",{className:f(n.header.title),children:t},void 0,!1,void 0,this),r&&_n("p",{className:f(n.header.subtitle),children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as al}from"@gsap/react";import il from"gsap";import{useEffect as Jc,useEffectEvent as tl,useRef as rl}from"react";import{jsxDEV as Rt,Fragment as nl}from"react/jsx-dev-runtime";il.registerPlugin(al);function ol({variant:e="default",logo:t,title:r="Welcome Back",subtitle:n="Sign in to your account to continue",loggedInTitle:a="You're Logged In",showRememberMe:i=!0,showForgotPassword:o=!0,showSignUp:s=!0,forgotPasswordHref:l,signUpHref:c,loginAction:d,meAction:u,logoutAction:w,captchaGenerateAction:g,config:m,onForgotPassword:S,onSignUp:b,onSuccess:z,onLogout:k,showBackground:R=!0,className:p}){let T=Cr,y=rl(null),N=rl(null),L=Gr(),O=tl(()=>{if(!u)return;u.start({payload:void 0,onAfterHandle:(E)=>{let _=E;if(_.success&&_.data?.user)L.setAuthenticated(!0,_.data.user)},onErrorHandle:()=>{L.setAuthenticated(!1,null)}})});Jc(()=>{O()},[]);let F=tl(()=>{if(!w)return;w.start({payload:void 0,onAfterHandle:()=>{L.setAuthenticated(!1,null),L.reset(),k?.()},onErrorHandle:()=>{}})});al(()=>{if(!N.current)return;il.fromTo(N.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:y});let Y=u?.state.isPending,re=w?.state.isPending;return Rt("main",{ref:y,className:f(T.container.base,p),"aria-label":"Login page",children:[R&&Rt(lt,{},void 0,!1,void 0,this),Rt("div",{className:T.container.wrapper,children:Rt("article",{ref:N,className:f(T.card.base,T.card.padding,T.card.background,T.card.border,T.card.shadow,T.card.rounded),children:Y?Rt("div",{className:"flex items-center justify-center py-12",children:Rt("div",{className:"w-8 h-8 border-2 border-zinc-300 dark:border-zinc-600 border-t-blue-500 rounded-full animate-spin"},void 0,!1,void 0,this)},void 0,!1,void 0,this):L.isAuthenticated&&L.user?Rt(nl,{children:[Rt(Jn,{logo:t,title:a,subtitle:`Signed in as ${L.user.email}`},void 0,!1,void 0,this),Rt("div",{className:"mt-6 space-y-4",children:[Rt(V,{variant:"nucleus",size:"lg",fullWidth:!0,onClick:z,children:"Continue to Dashboard"},void 0,!1,void 0,this),w&&Rt(V,{variant:"outline",size:"lg",fullWidth:!0,onClick:F,loading:re,disabled:re,children:"Sign Out"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):Rt(nl,{children:[Rt(Jn,{logo:t,title:r,subtitle:n},void 0,!1,void 0,this),Rt(ui,{loginAction:d,captchaGenerateAction:g,captchaConfig:m?.login?.captcha,showRememberMe:i,showForgotPassword:o,showSignUp:s,forgotPasswordHref:l,signUpHref:c,onForgotPassword:S,onSignUp:b,onSuccess:z},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as sl}from"@gsap/react";import ll from"gsap";import{useEffect as Xc,useEffectEvent as Ec,useRef as pi}from"react";import{batch as Kc,createStore as Qc}from"h-state";var Zc={step:"verifying",message:"Please wait while we verify your magic link..."},{useStore:Kn}=Qc(Zc,{setStep:(e)=>(t)=>{e.step=t},setMessage:(e)=>(t)=>{e.message=t},reset:(e)=>()=>{Kc(()=>{e.step="verifying",e.message="Please wait while we verify your magic link..."})}});var Qn={container:{base:"min-h-screen flex items-center justify-center p-4 bg-gradient-to-br from-zinc-50 via-white to-zinc-100 dark:from-zinc-950 dark:via-zinc-900 dark:to-zinc-950"},card:{base:"w-full max-w-md p-8",background:"bg-white dark:bg-zinc-900",border:"border border-zinc-200 dark:border-zinc-800",shadow:"shadow-xl shadow-zinc-200/50 dark:shadow-zinc-950/50",rounded:"rounded-2xl"},content:{wrapper:"flex flex-col items-center text-center space-y-4"},states:{verifying:{spinner:"w-12 h-12 border-4 border-zinc-200 dark:border-zinc-700 border-t-blue-500 rounded-full animate-spin",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-zinc-500 dark:text-zinc-400"},success:{iconWrapper:"w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",icon:"w-8 h-8 text-green-600 dark:text-green-400",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-green-600 dark:text-green-400",redirectText:"text-xs text-zinc-400 dark:text-zinc-500 animate-pulse"},error:{iconWrapper:"w-16 h-16 rounded-full bg-red-100 dark:bg-red-900/30 flex items-center justify-center",icon:"w-8 h-8 text-red-600 dark:text-red-400",title:"text-xl font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-red-600 dark:text-red-400"}},backButton:"mt-6 px-6 py-2.5 text-sm font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/20 rounded-lg transition-colors duration-200"};import{jsxDEV as st,Fragment as mi}from"react/jsx-dev-runtime";ll.registerPlugin(sl);function Dc(e,t){if(!e?.message)return t;try{let n=JSON.parse(e.message).message||"";if(n.includes("Failed query")||n.includes("select")||n.includes("params:"))return"An error occurred. Please try again later.";return n||t}catch{if(e.message.includes("Failed query")||e.message.includes("select"))return"An error occurred. Please try again later.";return e.message}}function dl({token:e,verifyAction:t,onSuccess:r,onError:n,onBackToLogin:a,backToLoginHref:i,redirectDelay:o=2000,className:s,texts:l}){let c=Qn,d=pi(null),u=pi(null),w=pi(!1),g=Kn(),m=Ec((b)=>{if(!b){g.setStep("error"),g.setMessage("Invalid magic link. No token provided.");return}if(w.current)return;w.current=!0,t.start({payload:{token:b},onAfterHandle:(z)=>{if(!z){g.setStep("error"),g.setMessage("Verification failed. Please try again."),n?.();return}if(z.success&&z.data)g.setStep("success"),g.setMessage(l?.successSubtitle||"You have been logged in successfully!"),setTimeout(()=>{r?.(z)},o);else g.setStep("error"),g.setMessage("Verification failed. The link may be expired or invalid."),n?.()},onErrorHandle:(z)=>{g.setStep("error"),g.setMessage(Dc(z,"Verification failed. The link may be expired or invalid.")),n?.()}})});Xc(()=>{if(e)m(e);else g.setStep("error"),g.setMessage("Invalid magic link. No token provided.");return()=>{g.reset()}},[e]),sl(()=>{if(!u.current)return;ll.fromTo(u.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:d});let S=()=>{if(a)a();else if(i)window.location.href=i};return st("main",{ref:d,className:f(c.container.base,s),children:st("article",{ref:u,className:f(c.card.base,c.card.background,c.card.border,c.card.shadow,c.card.rounded),children:st("div",{className:c.content.wrapper,children:[g.step==="verifying"&&st(mi,{children:[st("div",{className:c.states.verifying.spinner},void 0,!1,void 0,this),st("h1",{className:c.states.verifying.title,children:l?.verifyingTitle||"Verifying Magic Link"},void 0,!1,void 0,this),st("p",{className:c.states.verifying.subtitle,children:l?.verifyingSubtitle||g.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g.step==="success"&&st(mi,{children:[st("div",{className:c.states.success.iconWrapper,children:st("svg",{className:c.states.success.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:st("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),st("h1",{className:c.states.success.title,children:l?.successTitle||"Login Successful!"},void 0,!1,void 0,this),st("p",{className:c.states.success.subtitle,children:g.message},void 0,!1,void 0,this),st("p",{className:c.states.success.redirectText,children:"Redirecting..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g.step==="error"&&st(mi,{children:[st("div",{className:c.states.error.iconWrapper,children:st("svg",{className:c.states.error.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:st("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),st("h1",{className:c.states.error.title,children:l?.errorTitle||"Verification Failed"},void 0,!1,void 0,this),st("p",{className:c.states.error.subtitle,children:g.message},void 0,!1,void 0,this),(a||i)&&st("button",{type:"button",onClick:S,className:c.backButton,children:l?.backToLogin||"Back to Login"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}import{useGSAP as Rl}from"@gsap/react";import Ml from"gsap";import{useCallback as H0,useEffect as Hi,useMemo as U0,useRef as bn,useState as qt}from"react";import{createPortal as Ll}from"react-dom";import{useEffect as e0,useRef as t0,useState as er}from"react";function Yr(e){return e.replace(/([a-z])([A-Z])/g,"$1_$2").replace(/[\s-]+/g,"_").toUpperCase()}function gi(e){if(e.endsWith("ies"))return`${e.slice(0,-3)}y`;if(e.endsWith("ses"))return`${e.slice(0,-2)}`;if(e.endsWith("s"))return e.slice(0,-1);return e}function bi(e,t){let r=Yr(e),n=Yr(gi(e));switch(t){case"GET":return`GET_${r}`;case"POST":return`ADD_${n}`;case"PUT":return`UPDATE_${n}`;case"PATCH":return`PATCH_${n}`;case"DELETE":return`DELETE_${n}`}}function fi(e,t){let r=Yr(e);switch(t){case"POST":return`BULK_ADD_${r}`;case"PUT":return`BULK_UPDATE_${r}`;case"DELETE":return`BULK_DELETE_${r}`}}function Vc(e){return`GET_${Yr(gi(e))}_BY_ID`}function jc(e){return`GET_${Yr(e)}_DISTINCT`}function hi({entity:e,apiActions:t,pageSize:r=20,initialSort:n=[],initialFilters:a=[]}){let i=e.table_name,[o,s]=er([]),[l,c]=er(null),[d,u]=er(!1),[w,g]=er(!1),[m,S]=er(null),[b,z]=er(""),[k,R]=er(n),[p,T]=er(a),[y,N]=er(1),L=t0(!0),O=bi,F=fi,Y=(H)=>{let U={page:H?.page??y,limit:r},C=H?.search??b;if(C){U.search=C;let ae=e.columns?.filter((ge)=>["text","varchar","char"].includes(ge.type)).map((ge)=>ge.name);if(ae&&ae.length>0)U.searchFields=ae.join(",")}let de=H?.sort??k;if(de.length>0)U.sort=JSON.stringify(de);let B=H?.filters??p;if(B.length>0)U.filters=JSON.stringify(B);return U},re=(H)=>{let U=O(i,"GET"),C=t[U];if(!C){console.error(`Endpoint ${U} not found`);return}u(!0),S(null);let de=H?.page??1;N(de),C.start({payload:Y({...H,page:de}),onAfterHandle:(B)=>{let ae=B;if(ae?.data?.items)s(ae.data.items),c(ae.data.meta??null);u(!1)},onErrorHandle:(B)=>{S(B),u(!1)}})},E=()=>{if(!l||!l.hasNextPage||w)return;let H=O(i,"GET"),U=t[H];if(!U)return;g(!0);let C=y+1;U.start({payload:Y({page:C}),onAfterHandle:(de)=>{let B=de;if(B?.data?.items&&B.data.items.length>0){let ae=B.data.items;s((ge)=>{let Ye=new Set(ge.map((Pe)=>Pe.id)),Ie=ae.filter((Pe)=>!Ye.has(Pe.id));return[...ge,...Ie]}),c(B.data.meta??null),N(C)}g(!1)},onErrorHandle:(de)=>{S(de),g(!1)}})},_=async(H)=>{let U=O(i,"POST"),C=t[U];if(!C)throw Error(`Endpoint ${U} not found`);return new Promise((de,B)=>{C.start({payload:H,onAfterHandle:()=>{re({page:1}),de()},onErrorHandle:(ae)=>{B(ae)}})})},A=async(H,U)=>{let C=O(i,"PUT"),de=t[C];if(!de)throw Error(`Endpoint ${C} not found`);return new Promise((B,ae)=>{de.start({payload:{_id:H,...U},onAfterHandle:()=>{re(),B()},onErrorHandle:(ge)=>{ae(ge)}})})},ee=async(H)=>{let U=O(i,"DELETE"),C=t[U];if(!C)throw Error(`Endpoint ${U} not found`);return new Promise((de,B)=>{C.start({payload:{_id:H},onAfterHandle:()=>{re(),de()},onErrorHandle:(ae)=>{B(ae)}})})},v=async(H)=>{let U=F(i,"POST"),C=t[U];if(!C)throw Error(`Endpoint ${U} not found`);return new Promise((de,B)=>{C.start({payload:H,onAfterHandle:()=>{re({page:1}),de()},onErrorHandle:(ae)=>{B(ae)}})})},G=async(H)=>{let U=F(i,"DELETE"),C=t[U];if(!C)throw Error(`Endpoint ${U} not found`);return new Promise((de,B)=>{C.start({payload:H,onAfterHandle:()=>{re(),de()},onErrorHandle:(ae)=>{B(ae)}})})},K=()=>{re()};e0(()=>{if(L.current)L.current=!1,re()},[]);let se=l?.hasNextPage??!1;return{items:o,meta:l,isLoading:d,isLoadingMore:w,error:m,loadData:re,loadMore:E,hasMore:se,addItem:_,updateItem:A,deleteItem:ee,bulkAdd:v,bulkDelete:G,search:b,setSearch:z,sort:k,setSort:R,filters:p,setFilters:T,currentPage:y,setCurrentPage:N,refetch:K}}function zt(e){return e.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/\b\w/g,(t)=>t.toUpperCase())}function Zn(e){if(e.primaryKey&&e.type==="serial")return!0;if(e.primaryKey&&e.type==="bigserial")return!0;if(e.primaryKey&&e.type==="smallserial")return!0;if(e.generatedAlwaysAs)return!0;if(e.generatedAlwaysAsIdentity)return!0;if(["created_at","updated_at","deleted_at"].includes(e.name))return!0;return!1}function yi(e,t){if(Zn(e))return!0;if(e.primaryKey)return!0;if(e.name==="id")return!0;if(t==="add"){if(e.defaultRaw?.includes("gen_random_uuid"))return!0;if(e.generatedByDefaultAsIdentity)return!0}return!1}function ln(e){return!!e.references}function ki(e){return e.type==="json"||e.type==="jsonb"}function Xn(e){return!!e.array}function En(e){if(e.enumValues||e.enum)return"select";switch(e.type){case"integer":case"smallint":case"bigint":case"serial":case"smallserial":case"bigserial":case"real":case"doublePrecision":case"numeric":case"decimal":case"money":return"number";case"boolean":return"boolean";case"date":case"time":case"timestamp":case"timestamptz":return"date";case"json":case"jsonb":return"json";case"bytea":case"vector":case"geometry":case"geography":return"hidden";default:return"text"}}function r0(e){if(e.default!==void 0)return e.default;switch(En(e)){case"number":return e.nullable?null:0;case"boolean":return!1;case"date":return null;case"select":return e.nullable?null:"";case"json":return e.nullable?null:{};default:return""}}var n0=["text","varchar","char"],a0=["integer","smallint","bigint","serial","smallserial","bigserial","real","doublePrecision","numeric","decimal","money"],i0=["date","time","timestamp","timestamptz"];function o0(e){return n0.includes(e.type)}function s0(e){if((e.enumValues?.length??0)>0)return!0;if((e.enum?.values?.length??0)>0)return!0;if(e.type==="customType"&&e.enum)return!0;return!1}function wi(e){return e.type==="boolean"}function l0(e){return a0.includes(e.type)}function d0(e){return i0.includes(e.type)}function cl(e){if(e.enumValues?.length)return e.enumValues;if(e.enum?.values?.length)return e.enum.values;return[]}function ul(e){return e.filter(o0)}function pl(e){return e.filter((t)=>s0(t)||wi(t))}function ml(e){return e.filter((t)=>l0(t)&&!t.primaryKey)}function gl(e){return e.filter((t)=>d0(t))}import{useGSAP as Ni}from"@gsap/react";import Pi from"gsap";import{useEffect as m0,useRef as dn,useState as xi}from"react";var dr={container:{base:"relative w-full select-none",orientation:{horizontal:"py-2",vertical:"px-2 h-32"},disabled:"opacity-40 pointer-events-none"},label:{base:"block font-medium text-zinc-700 dark:text-zinc-300 mb-3",size:{sm:"text-xs",md:"text-sm",lg:"text-base"}},track:{container:{base:"relative cursor-pointer",size:{sm:"h-0.5",md:"h-1",lg:"h-1.5"},orientation:{horizontal:"w-full",vertical:"h-full w-1"}},background:{base:"absolute inset-0 rounded-full",variant:{default:"bg-zinc-200 dark:bg-zinc-700",filled:"bg-zinc-300 dark:bg-zinc-600",minimal:"bg-zinc-100 dark:bg-zinc-800"},disabled:"bg-zinc-100 dark:bg-zinc-800"},range:{base:"absolute rounded-full",variant:{default:"bg-zinc-900 dark:bg-white",filled:"bg-zinc-800 dark:bg-zinc-100",minimal:"bg-zinc-600 dark:bg-zinc-400"},disabled:"bg-zinc-400 dark:bg-zinc-500"}},thumb:{base:"absolute rounded-full cursor-grab active:cursor-grabbing touch-none z-10",size:{sm:"w-2.5 h-2.5",md:"w-3.5 h-3.5",lg:"w-4 h-4"},variant:{default:"bg-zinc-900 dark:bg-white",filled:"bg-zinc-800 dark:bg-zinc-100",minimal:"bg-white dark:bg-zinc-900 border border-zinc-300 dark:border-zinc-600"},states:{hover:"",active:"",focus:"outline-none ring-2 ring-zinc-400/50 dark:ring-zinc-500/50",disabled:"cursor-not-allowed"},shadow:"shadow-sm"},tooltip:{base:"absolute pointer-events-none bg-zinc-900 dark:bg-white text-white dark:text-zinc-900 font-medium rounded whitespace-nowrap left-1/2 -translate-x-1/2",size:{sm:"px-1.5 py-0.5 text-[10px] -top-6",md:"px-2 py-0.5 text-xs -top-7",lg:"px-2 py-1 text-xs -top-8"},arrow:"after:absolute after:top-full after:left-1/2 after:-translate-x-1/2 after:border-4 after:border-transparent after:border-t-zinc-900 dark:after:border-t-white"},ticks:{container:"absolute inset-x-0 flex justify-between pointer-events-none mt-2",tick:"w-px h-1 bg-zinc-300 dark:bg-zinc-600",label:"text-[10px] text-zinc-400 dark:text-zinc-500 mt-0.5"},labels:{container:"flex justify-between mt-1.5",label:"text-[10px] text-zinc-400 dark:text-zinc-500"}};import{clsx as c0}from"clsx";import{twMerge as u0}from"tailwind-merge";var Mt=(...e)=>u0(c0(e));import{forwardRef as p0}from"react";import{jsxDEV as vi}from"react/jsx-dev-runtime";var Dn=p0(({min:e,max:t,value:r,size:n,variant:a,orientation:i,disabled:o},s)=>{let l=dr,c=t-e,d=(r.min-e)/c*100,u=(r.max-e)/c*100,w=i==="horizontal";return vi("div",{ref:s,className:Mt(l.track.container.base,l.track.container.size[n],l.track.container.orientation[i]),children:[vi("div",{className:Mt(l.track.background.base,l.track.background.variant[a],o&&l.track.background.disabled)},void 0,!1,void 0,this),vi("div",{className:Mt(l.track.range.base,l.track.range.variant[a],o&&l.track.range.disabled,w?"top-0 bottom-0":"left-0 right-0"),style:w?{left:`${d}%`,right:`${100-u}%`}:{bottom:`${d}%`,top:`${100-u}%`}},void 0,!1,void 0,this)]},void 0,!0,void 0,this)});Dn.displayName="RangeTrack";import{jsxDEV as Nt}from"react/jsx-dev-runtime";Pi.registerPlugin(Ni);var zi=(e,t,r)=>Math.min(Math.max(e,t),r),bl=(e,t,r)=>{let n=Math.round((e-r)/t);return r+n*t};function Vn({value:e,defaultValue:t,min:r=0,max:n=100,step:a=1,minRange:i=0,disabled:o=!1,readOnly:s=!1,size:l="md",variant:c="default",orientation:d="horizontal",showTooltip:u=!1,showLabels:w=!1,showTicks:g=!1,tickCount:m=5,debounceMs:S=0,formatValue:b,onChange:z,onChangeCommit:k,label:R,minLabel:p,maxLabel:T,ariaLabel:y,ariaLabelMin:N,ariaLabelMax:L,className:O,...F}){let Y=dr,re=dn(null),E=dn(null),_=dn(null),A=dn(null),[ee,v]=xi(t||{min:r+(n-r)*0.25,max:r+(n-r)*0.75}),[G,K]=xi(null),[se,H]=xi(null);Ni(()=>{if(_.current)Pi.to(_.current,{scale:G==="min"?1.3:se==="min"?1.15:1,duration:0.2,ease:G==="min"?"power2.out":"elastic.out(1, 0.4)"})},[G,se]),Ni(()=>{if(A.current)Pi.to(A.current,{scale:G==="max"?1.3:se==="max"?1.15:1,duration:0.2,ease:G==="max"?"power2.out":"elastic.out(1, 0.4)"})},[G,se]);let U=e??ee,C=e!==void 0,de=(P)=>{if(s)return;let j=zi(bl(P.min,a,r),r,P.max-i),Z=zi(bl(P.max,a,r),P.min+i,n),me={min:j,max:Z};if(!C)v(me);z?.(me)},B=(P,j)=>{if(!E.current)return r;let Z=E.current.getBoundingClientRect(),me=d==="horizontal",J;if(me)J=(P-Z.left)/Z.width;else J=1-(j-Z.top)/Z.height;return J=zi(J,0,1),r+J*(n-r)},ae=(P)=>{if(o||s)return;let j=B(P.clientX,P.clientY),Z=Math.abs(j-U.min),me=Math.abs(j-U.max);if(Z<=me)de({...U,min:j});else de({...U,max:j})},ge=dn(null),Ye=(P)=>{if(o||s)return;K(P)},Ie=()=>{if(G)if(K(null),S>0){if(ge.current)clearTimeout(ge.current);ge.current=setTimeout(()=>{k?.(U)},S)}else k?.(U)};m0(()=>{if(!G)return;let P=(Z)=>{Z.preventDefault();let me="touches"in Z?Z.touches[0]?.clientX??0:Z.clientX,J="touches"in Z?Z.touches[0]?.clientY??0:Z.clientY,te=B(me,J);if(G==="min")de({...U,min:Math.min(te,U.max-i)});else de({...U,max:Math.max(te,U.min+i)})},j=()=>{Ie()};return document.addEventListener("mousemove",P),document.addEventListener("mouseup",j),document.addEventListener("touchmove",P,{passive:!1}),document.addEventListener("touchend",j),()=>{document.removeEventListener("mousemove",P),document.removeEventListener("mouseup",j),document.removeEventListener("touchmove",P),document.removeEventListener("touchend",j)}},[G,U,r,n,i]);let Pe=(P,j)=>{if(o||s)return;let Z=j==="min"?U.min:U.max,me=Z;switch(P.key){case"ArrowRight":case"ArrowUp":me=Z+a;break;case"ArrowLeft":case"ArrowDown":me=Z-a;break;case"PageUp":me=Z+a*10;break;case"PageDown":me=Z-a*10;break;case"Home":me=r;break;case"End":me=n;break;default:return}if(P.preventDefault(),j==="min")de({...U,min:me});else de({...U,max:me})},pe=(U.min-r)/(n-r)*100,ke=(U.max-r)/(n-r)*100,Te=u&&(G==="min"||se==="min"),we=u&&(G==="max"||se==="max"),be=g?Array.from({length:m},(P,j)=>r+j/(m-1)*(n-r)):[];return Nt("div",{ref:re,className:Mt(Y.container.base,Y.container.orientation[d],o&&Y.container.disabled,O),...F,children:[R&&Nt("span",{className:Mt(Y.label.base,Y.label.size[l]),id:`${F.id||"range"}-label`,children:R},void 0,!1,void 0,this),Nt("div",{ref:E,className:"relative",onClick:ae,"aria-hidden":"true",children:[Nt(Dn,{min:r,max:n,value:U,size:l,variant:c,orientation:d,disabled:o},void 0,!1,void 0,this),Nt("div",{ref:_,role:"slider",tabIndex:o?-1:0,"aria-label":N||y||"Minimum value","aria-valuemin":r,"aria-valuemax":U.max-i,"aria-valuenow":U.min,"aria-valuetext":b?b(U.min):String(U.min),"aria-disabled":o,"aria-orientation":d,className:Mt(Y.thumb.base,Y.thumb.size[l],Y.thumb.variant[c],Y.thumb.shadow,!o&&Y.thumb.states.hover,G==="min"&&Y.thumb.states.active,o&&Y.thumb.states.disabled),style:{left:`${pe}%`,top:"50%",transform:"translate(-50%, -50%)"},onMouseDown:(P)=>{P.preventDefault(),P.stopPropagation(),Ye("min")},onTouchStart:(P)=>{P.stopPropagation(),Ye("min")},onMouseEnter:()=>H("min"),onMouseLeave:()=>H(null),onKeyDown:(P)=>Pe(P,"min"),onFocus:()=>H("min"),onBlur:()=>H(null),children:Te&&Nt("span",{className:Mt(Y.tooltip.base,Y.tooltip.size[l],Y.tooltip.arrow),"aria-hidden":"true",children:b?b(U.min):U.min},void 0,!1,void 0,this)},void 0,!1,void 0,this),Nt("div",{ref:A,role:"slider",tabIndex:o?-1:0,"aria-label":L||y||"Maximum value","aria-valuemin":U.min+i,"aria-valuemax":n,"aria-valuenow":U.max,"aria-valuetext":b?b(U.max):String(U.max),"aria-disabled":o,"aria-orientation":d,className:Mt(Y.thumb.base,Y.thumb.size[l],Y.thumb.variant[c],Y.thumb.shadow,!o&&Y.thumb.states.hover,G==="max"&&Y.thumb.states.active,o&&Y.thumb.states.disabled),style:{left:`${ke}%`,top:"50%",transform:"translate(-50%, -50%)"},onMouseDown:(P)=>{P.preventDefault(),P.stopPropagation(),Ye("max")},onTouchStart:(P)=>{P.stopPropagation(),Ye("max")},onMouseEnter:()=>H("max"),onMouseLeave:()=>H(null),onKeyDown:(P)=>Pe(P,"max"),onFocus:()=>H("max"),onBlur:()=>H(null),children:we&&Nt("span",{className:Mt(Y.tooltip.base,Y.tooltip.size[l],Y.tooltip.arrow),"aria-hidden":"true",children:b?b(U.max):U.max},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),g&&Nt("div",{className:Y.ticks.container,style:{top:"100%",marginTop:"8px"},children:be.map((P,j)=>Nt("div",{className:"flex flex-col items-center",children:[Nt("div",{className:Y.ticks.tick},void 0,!1,void 0,this),Nt("span",{className:Y.ticks.label,children:b?b(P):P},void 0,!1,void 0,this)]},j,!0,void 0,this))},void 0,!1,void 0,this),w&&Nt("div",{className:Y.labels.container,children:[Nt("span",{className:Y.labels.label,children:p||(b?b(r):r)},void 0,!1,void 0,this),Nt("span",{className:Y.labels.label,children:T||(b?b(n):n)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as fl}from"@gsap/react";import Si from"gsap";import{forwardRef as g0,useRef as b0}from"react";import{jsxDEV as f0}from"react/jsx-dev-runtime";Si.registerPlugin(fl);var hl=g0(({position:e,value:t,min:r,max:n,size:a,variant:i,disabled:o,isDragging:s,onDragStart:l,onDragEnd:c,ariaLabel:d,ariaValueText:u},w)=>{let g=dr,m=b0(null),S=(t-r)/(n-r)*100;return fl(()=>{if(!m.current)return;if(s)Si.to(m.current,{scale:1.2,duration:0.15,ease:"power2.out"});else Si.to(m.current,{scale:1,duration:0.2,ease:"elastic.out(1, 0.5)"})},[s]),f0("div",{ref:(b)=>{if(m.current=b,typeof w==="function")w(b);else if(w)w.current=b},role:"slider",tabIndex:o?-1:0,"aria-label":d||`${e} value`,"aria-valuemin":r,"aria-valuemax":n,"aria-valuenow":t,"aria-valuetext":u||String(t),"aria-disabled":o,"data-position":e,className:Mt(g.thumb.base,g.thumb.size[a],g.thumb.variant[i],g.thumb.shadow,!o&&g.thumb.states.hover,s&&g.thumb.states.active,o&&g.thumb.states.disabled),style:{left:`${S}%`},onMouseDown:(b)=>{if(b.preventDefault(),!o)l()},onTouchStart:(b)=>{if(b.preventDefault(),!o)l()},onMouseUp:c,onTouchEnd:c,onKeyDown:()=>{if(o)return}},void 0,!1,void 0,this)});hl.displayName="RangeThumb";import{useGSAP as h0}from"@gsap/react";import y0 from"gsap";import{useRef as yw}from"react";import{jsxDEV as xw}from"react/jsx-dev-runtime";y0.registerPlugin(h0);import{useGSAP as xl}from"@gsap/react";import jn from"gsap";import{useEffect as Ri,useId as N0,useRef as un,useState as Mi}from"react";var cn={container:{base:"relative flex flex-col",spacing:"gap-1"},wrapper:{base:"relative flex items-center w-full",border:{base:"border border-gray-300 dark:border-gray-600",focused:"border-blue-500 dark:border-blue-400 ring-2 ring-blue-500/20",error:"border-red-500 dark:border-red-400",disabled:"border-gray-200 dark:border-gray-700"},background:{light:"bg-white",dark:"dark:bg-gray-800"},padding:{sm:"px-3 py-2",md:"px-4 py-3",lg:"px-5 py-4"},rounded:"rounded-lg",shadow:"shadow-sm",transition:"transition-all duration-200 ease-out"},input:{base:"flex-1 bg-transparent border-none outline-none w-full",text:{size:"text-base",color:{light:"text-gray-900",dark:"dark:text-white"}},placeholder:{light:"placeholder:text-gray-400",dark:"dark:placeholder:text-gray-500"}},label:{base:"block",text:{size:"text-sm font-medium",color:{light:"text-gray-700",dark:"dark:text-gray-300"}},spacing:"mb-1.5"},icon:{base:"flex items-center justify-center flex-shrink-0",size:{sm:"w-4 h-4",md:"w-5 h-5",lg:"w-6 h-6"},color:{light:"text-gray-400",dark:"dark:text-gray-500",focused:"text-blue-500 dark:text-blue-400"},spacing:{left:"mr-3",right:"ml-3"}},clearButton:{base:"flex items-center justify-center cursor-pointer",size:"w-5 h-5",color:{light:"text-gray-400",dark:"dark:text-gray-500",hover:"hover:text-gray-600 dark:hover:text-gray-300"},transition:"transition-colors duration-150"},dropdown:{base:"absolute left-0 right-0 z-50 overflow-hidden",background:{light:"bg-white",dark:"dark:bg-gray-800"},border:{light:"border border-gray-200",dark:"dark:border-gray-700"},rounded:"rounded-lg",shadow:"shadow-lg",maxHeight:"max-h-64 overflow-y-auto",spacing:{top:"mb-2",bottom:"mt-2"},position:{top:"bottom-full",bottom:"top-full"}},item:{base:"cursor-pointer",padding:"px-4 py-3",text:{size:"text-base",color:{light:"text-gray-900",dark:"dark:text-white"}},hover:{light:"hover:bg-gray-50",dark:"dark:hover:bg-gray-700"},active:{light:"bg-blue-50",dark:"dark:bg-blue-900/30"},transition:"transition-colors duration-150",rounded:""},loading:{base:"flex items-center justify-center py-4",size:"w-6 h-6",color:"text-blue-500"},empty:{base:"flex items-center justify-center",text:{size:"text-sm",color:{light:"text-gray-500",dark:"dark:text-gray-400"}},padding:"py-4 px-4"}};import{clsx as k0}from"clsx";import{twMerge as w0}from"tailwind-merge";function Pt(...e){return w0(k0(e))}function Ci(e,t){let r=null;return{call:(...i)=>{if(r)clearTimeout(r);r=setTimeout(()=>{e(...i),r=null},t)},cancel:()=>{if(r)clearTimeout(r),r=null}}}var v0=[/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,/javascript:/gi,/on\w+\s*=/gi,/<iframe/gi,/<object/gi,/<embed/gi,/<link/gi,/data:/gi,/vbscript:/gi],x0={"&":"&","<":"<",">":">",'"':""","'":"'","/":"/","`":"`","=":"="};function yl(e){let t=e;for(let r of v0)t=t.replace(r,"");return t}function kl(e){return e.replace(/[&<>"'`=/]/g,(t)=>x0[t]||t)}function Ti(e,t={}){let{trim:r=!0,escapeHtml:n=!1,maxLength:a,removeScripts:i=!0}=t,o=e;if(i)o=yl(o);if(r)o=o.trim();if(n)o=kl(o);if(a&&o.length>a)o=o.slice(0,a);return o}import{useGSAP as wl}from"@gsap/react";import vl from"gsap";import{useRef as z0}from"react";import{jsxDEV as Yt}from"react/jsx-dev-runtime";vl.registerPlugin(wl);function Li({results:e,renderItem:t,onSelect:r,loading:n=!1,emptyMessage:a="No results found",className:i,itemClassName:o,position:s,activeIndex:l,onActiveIndexChange:c}){let d=z0(null),u=cn;wl(()=>{if(!d.current)return;vl.fromTo(d.current,{opacity:0,y:s==="bottom"?-8:8,scale:0.98},{opacity:1,y:0,scale:1,duration:0.2,ease:"power2.out"})},[s]);let w=(S)=>{r?.(S)},g=(S)=>{c(S)},m=(S)=>Yt("span",{children:String(S.data)},void 0,!1,void 0,this);if(n)return Yt("div",{className:Pt(u.dropdown.base,u.dropdown.background.light,u.dropdown.background.dark,u.dropdown.border.light,u.dropdown.border.dark,u.dropdown.rounded,u.dropdown.shadow,s==="top"&&u.dropdown.position.top,s==="top"&&u.dropdown.spacing.top,s==="bottom"&&u.dropdown.position.bottom,s==="bottom"&&u.dropdown.spacing.bottom,i),children:Yt("div",{className:u.loading.base,children:Yt("svg",{className:Pt(u.loading.size,u.loading.color,"animate-spin"),xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[Yt("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Yt("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this);if(e.length===0)return Yt("div",{className:Pt(u.dropdown.base,u.dropdown.background.light,u.dropdown.background.dark,u.dropdown.border.light,u.dropdown.border.dark,u.dropdown.rounded,u.dropdown.shadow,s==="top"&&u.dropdown.position.top,s==="top"&&u.dropdown.spacing.top,s==="bottom"&&u.dropdown.position.bottom,s==="bottom"&&u.dropdown.spacing.bottom,i),children:Yt("div",{className:Pt(u.empty.base,u.empty.text.size,u.empty.text.color.light,u.empty.text.color.dark,u.empty.padding),children:a},void 0,!1,void 0,this)},void 0,!1,void 0,this);return Yt("div",{ref:d,className:Pt(u.dropdown.base,u.dropdown.background.light,u.dropdown.background.dark,u.dropdown.border.light,u.dropdown.border.dark,u.dropdown.rounded,u.dropdown.shadow,u.dropdown.maxHeight,s==="top"&&u.dropdown.position.top,s==="top"&&u.dropdown.spacing.top,s==="bottom"&&u.dropdown.position.bottom,s==="bottom"&&u.dropdown.spacing.bottom,i),children:e.map((S,b)=>Yt("button",{type:"button",onClick:()=>w(S),onMouseEnter:()=>g(b),className:Pt("w-full text-left",u.item.base,u.item.padding,u.item.text.size,u.item.text.color.light,u.item.text.color.dark,u.item.hover.light,u.item.hover.dark,u.item.transition,u.item.rounded,l===b&&u.item.active.light,l===b&&u.item.active.dark,o),children:t?t(S,b):m(S)},S.id,!1,void 0,this))},void 0,!1,void 0,this)}import{jsxDEV as St}from"react/jsx-dev-runtime";jn.registerPlugin(xl);function ea({value:e,onChange:t,onSearch:r,results:n,renderItem:a,onSelect:i,placeholder:o="Search...",label:s,debounceMs:l=300,minSearchLength:c=1,disabled:d=!1,loading:u=!1,emptyMessage:w="No results found",className:g,inputClassName:m,dropdownClassName:S,itemClassName:b,showClearButton:z=!0,leftIcon:k,rightIcon:R,disableDropdown:p=!1,showSearchIcon:T=!0,maxLength:y=200,sanitize:N=!0,trimOnSearch:L=!0,preventXSS:O=!0}){let[F,Y]=Mi(!1),[re,E]=Mi(-1),[_,A]=Mi("bottom"),ee=un(null),v=un(null),G=un(null),K=un(null),se=un(r),H=N0();se.current=r;let U=cn,C=!p&&F&&n!==void 0&&n.length>=0&&e.length>=c,{contextSafe:de}=xl({scope:v});Ri(()=>{return K.current=Ci((pe)=>{if(pe.length>=c||pe.length===0){let ke=N?Ti(pe,{trim:L,escapeHtml:O,maxLength:y,removeScripts:!0}):pe;se.current(ke)}},l),()=>{K.current?.cancel()}},[l,c,N,L,O,y]),Ri(()=>{if(!C)return;let pe=()=>{if(!G.current)return;let ke=G.current.getBoundingClientRect(),Te=window.innerHeight-ke.bottom,we=ke.top;if(Te<256&&we>Te)A("top");else A("bottom")};return pe(),window.addEventListener("scroll",pe,!0),window.addEventListener("resize",pe),()=>{window.removeEventListener("scroll",pe,!0),window.removeEventListener("resize",pe)}},[C]),Ri(()=>{E(-1)},[n]);let B=de(()=>{if(d)return;if(Y(!0),v.current)jn.to(v.current,{scale:1.01,duration:0.15,ease:"power2.out"})}),ae=de(()=>{if(setTimeout(()=>{Y(!1),E(-1)},150),v.current)jn.to(v.current,{scale:1,duration:0.15,ease:"power2.out"})}),ge=(pe)=>{let ke=pe.target.value;t(ke),K.current?.call(ke)},Ye=de(()=>{if(t(""),K.current?.call(""),ee.current?.focus(),v.current)jn.fromTo(v.current,{scale:0.98},{scale:1,duration:0.2,ease:"elastic.out(1, 0.5)"})}),Ie=(pe)=>{if(!n||n.length===0)return;switch(pe.key){case"ArrowDown":pe.preventDefault(),E((ke)=>ke<n.length-1?ke+1:0);break;case"ArrowUp":pe.preventDefault(),E((ke)=>ke>0?ke-1:n.length-1);break;case"Enter":{pe.preventDefault();let ke=n[re];if(re>=0&&re<n.length&&ke)Pe(ke);break}case"Escape":pe.preventDefault(),Y(!1),ee.current?.blur();break}},Pe=(pe)=>{i?.(pe),Y(!1),E(-1)};return St("div",{ref:G,className:Pt(U.container.base,U.container.spacing,g),children:[s&&St("label",{htmlFor:H,className:Pt(U.label.base,U.label.text.size,U.label.text.color.light,U.label.text.color.dark,U.label.spacing),children:s},void 0,!1,void 0,this),St("div",{className:"relative",children:[St("div",{ref:v,className:Pt(U.wrapper.base,U.wrapper.border.base,U.wrapper.background.light,U.wrapper.background.dark,U.wrapper.padding.md,U.wrapper.rounded,U.wrapper.shadow,U.wrapper.transition,F&&U.wrapper.border.focused,d&&U.wrapper.border.disabled),children:[(k||T)&&St("span",{className:Pt(U.icon.base,U.icon.size.md,U.icon.color.light,U.icon.color.dark,U.icon.spacing.left,F&&U.icon.color.focused),children:k||St("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-full h-full","aria-hidden":"true",children:[St("circle",{cx:"11",cy:"11",r:"8"},void 0,!1,void 0,this),St("path",{d:"m21 21-4.3-4.3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),St("input",{ref:ee,id:H,type:"text",value:e,onChange:ge,onFocus:B,onBlur:ae,onKeyDown:Ie,disabled:d,placeholder:o,maxLength:y,autoComplete:"off",spellCheck:!1,autoCapitalize:"off",autoCorrect:"off","aria-label":s||o,role:"combobox","aria-expanded":C,"aria-autocomplete":"list","aria-haspopup":"listbox",className:Pt(U.input.base,U.input.text.size,U.input.text.color.light,U.input.text.color.dark,U.input.placeholder.light,U.input.placeholder.dark,m)},void 0,!1,void 0,this),z&&e&&St("button",{type:"button",onClick:Ye,className:Pt(U.clearButton.base,U.clearButton.size,U.clearButton.color.light,U.clearButton.color.dark,U.clearButton.color.hover,U.clearButton.transition),"aria-label":"Clear search",children:St("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"w-full h-full","aria-hidden":"true",children:[St("line",{x1:"18",y1:"6",x2:"6",y2:"18"},void 0,!1,void 0,this),St("line",{x1:"6",y1:"6",x2:"18",y2:"18"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),R&&St("span",{className:Pt(U.icon.base,U.icon.size.md,U.icon.color.light,U.icon.color.dark,U.icon.spacing.right,F&&U.icon.color.focused),children:R},void 0,!1,void 0,this)]},void 0,!0,void 0,this),C&&St(Li,{results:n,renderItem:a,onSelect:Pe,loading:u,emptyMessage:w,className:S,itemClassName:b,position:_,activeIndex:re,onActiveIndexChange:E},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Cl}from"@gsap/react";import Tl from"gsap";import{useEffect as Wi,useRef as mn,useState as gn}from"react";var tr={container:{base:"relative w-full"},label:{base:"block font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",size:{sm:"text-xs",md:"text-sm",lg:"text-base"},required:'after:content-["*"] after:ml-0.5 after:text-red-500',error:"text-red-600 dark:text-red-400"},trigger:{base:"relative w-full flex items-center justify-between gap-2 rounded-lg border bg-white dark:bg-zinc-900 text-left cursor-pointer transition-all duration-150",size:{sm:"px-2.5 py-1.5 text-sm min-h-[32px]",md:"px-3 py-2 text-sm min-h-[40px]",lg:"px-4 py-2.5 text-base min-h-[48px]"},variant:{default:"border-zinc-300 dark:border-zinc-600",filled:"border-transparent bg-zinc-100 dark:bg-zinc-800",ghost:"border-transparent bg-transparent"},states:{hover:"hover:border-zinc-400 dark:hover:border-zinc-500",focus:"focus:outline-none focus:ring-2 focus:ring-zinc-400/50 dark:focus:ring-zinc-500/50 focus:border-zinc-400 dark:focus:border-zinc-500",disabled:"opacity-50 cursor-not-allowed pointer-events-none",error:"border-red-500 dark:border-red-400 focus:ring-red-400/50",open:"ring-2 ring-zinc-400/50 dark:ring-zinc-500/50 border-zinc-400 dark:border-zinc-500"}},placeholder:{base:"text-zinc-400 dark:text-zinc-500 truncate"},value:{base:"text-zinc-900 dark:text-white truncate flex items-center gap-2"},icon:{base:"flex-shrink-0 text-zinc-400 dark:text-zinc-500 transition-transform duration-200",size:{sm:"w-4 h-4",md:"w-4 h-4",lg:"w-5 h-5"},open:"rotate-180"},clearButton:{base:"flex-shrink-0 p-0.5 rounded text-zinc-400 dark:text-zinc-500 transition-colors",hover:"hover:text-zinc-600 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800"},dropdown:{base:"absolute left-0 right-0 z-50 bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 rounded-lg shadow-lg overflow-hidden",position:{top:"bottom-full mb-1",bottom:"top-full mt-1"},size:{sm:"py-1",md:"py-1.5",lg:"py-2"}},search:{container:"px-2 pb-1.5 border-b border-zinc-100 dark:border-zinc-800",input:"w-full px-2.5 py-1.5 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-md outline-none focus:ring-1 focus:ring-zinc-400/50 dark:focus:ring-zinc-500/50 text-zinc-900 dark:text-white placeholder:text-zinc-400 dark:placeholder:text-zinc-500",icon:"absolute left-4.5 top-1/2 -translate-y-1/2 w-4 h-4 text-zinc-400"},option:{base:"relative flex items-center gap-2 cursor-pointer transition-colors duration-100",size:{sm:"px-2.5 py-1.5 text-sm",md:"px-3 py-2 text-sm",lg:"px-4 py-2.5 text-base"},states:{hover:"bg-zinc-50 dark:bg-zinc-800",selected:"bg-zinc-100 dark:bg-zinc-800 text-zinc-900 dark:text-white",highlighted:"bg-zinc-100 dark:bg-zinc-800",disabled:"opacity-50 cursor-not-allowed pointer-events-none"},icon:"flex-shrink-0 w-4 h-4",checkmark:"ml-auto flex-shrink-0 w-4 h-4 text-zinc-900 dark:text-white"},empty:{base:"px-3 py-6 text-center text-sm text-zinc-400 dark:text-zinc-500"},loading:{base:"px-3 py-6 flex items-center justify-center gap-2 text-sm text-zinc-400 dark:text-zinc-500",spinner:"w-4 h-4 animate-spin"},helper:{base:"mt-1.5 text-xs text-zinc-500 dark:text-zinc-400",error:"text-red-600 dark:text-red-400"}};import{clsx as P0}from"clsx";import{twMerge as S0}from"tailwind-merge";var It=(...e)=>S0(P0(e));import{useGSAP as Pl}from"@gsap/react";import Sl from"gsap";import{forwardRef as C0,useEffect as zl,useRef as T0,useState as Nl}from"react";import{createPortal as L0}from"react-dom";import{jsxDEV as R0}from"react/jsx-dev-runtime";Sl.registerPlugin(Pl);var ta=C0(({isOpen:e,position:t,size:r,maxHeight:n,children:a,triggerRef:i},o)=>{let s=tr,l=T0(null),[c,d]=Nl(!1),[u,w]=Nl({});if(zl(()=>{d(!0)},[]),zl(()=>{if(!e||!i?.current)return;let m=()=>{let S=i.current?.getBoundingClientRect();if(!S)return;w({position:"fixed",left:S.left,width:S.width,maxHeight:n,overflowY:"auto",zIndex:9999,...t==="top"?{bottom:window.innerHeight-S.top+4}:{top:S.bottom+4}})};return m(),window.addEventListener("scroll",m,!0),window.addEventListener("resize",m),()=>{window.removeEventListener("scroll",m,!0),window.removeEventListener("resize",m)}},[e,t,n,i]),Pl(()=>{if(!l.current)return;if(e)Sl.fromTo(l.current,{opacity:0,y:t==="bottom"?-8:8,scale:0.96},{opacity:1,y:0,scale:1,duration:0.2,ease:"power2.out"})},[e,t]),!e||!c)return null;let g=R0("div",{ref:(m)=>{if(l.current=m,typeof o==="function")o(m);else if(o)o.current=m},role:"listbox",className:It(s.dropdown.base,s.dropdown.size[r],!i&&s.dropdown.position[t]),style:i?u:{maxHeight:n,overflowY:"auto"},children:a},void 0,!1,void 0,this);if(i)return L0(g,document.body);return g});ta.displayName="SelectDropdown";import{jsxDEV as pn}from"react/jsx-dev-runtime";function Ii({option:e,isSelected:t,isHighlighted:r,size:n,onClick:a,onMouseEnter:i}){let o=tr;return pn("div",{role:"option",tabIndex:e.disabled?-1:0,"aria-selected":t,"aria-disabled":e.disabled,onClick:e.disabled?void 0:a,onKeyDown:(s)=>{if(s.key==="Enter"||s.key===" "){if(s.preventDefault(),!e.disabled)a()}},onMouseEnter:i,className:It(o.option.base,o.option.size[n],!e.disabled&&o.option.states.hover,t&&o.option.states.selected,r&&!t&&o.option.states.highlighted,e.disabled&&o.option.states.disabled),children:[e.icon&&pn("span",{className:o.option.icon,children:e.icon},void 0,!1,void 0,this),pn("span",{className:"truncate",children:e.label},void 0,!1,void 0,this),t&&pn("svg",{className:o.option.checkmark,viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:pn("path",{fillRule:"evenodd",d:"M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{forwardRef as M0}from"react";import{jsxDEV as I0}from"react/jsx-dev-runtime";var ra=M0(({isOpen:e,disabled:t,loading:r,size:n,variant:a,hasValue:i,hasError:o,onClick:s,onKeyDown:l,children:c},d)=>{let u=tr;return I0("button",{ref:d,type:"button",role:"combobox","aria-expanded":e,"aria-haspopup":"listbox","aria-disabled":t,disabled:t,onClick:s,onKeyDown:l,className:It(u.trigger.base,u.trigger.size[n],u.trigger.variant[a],!t&&u.trigger.states.hover,u.trigger.states.focus,t&&u.trigger.states.disabled,o&&u.trigger.states.error,e&&u.trigger.states.open),children:c},void 0,!1,void 0,this)});ra.displayName="SelectTrigger";import{jsxDEV as Qe,Fragment as W0}from"react/jsx-dev-runtime";Tl.registerPlugin(Cl);function Ot({options:e,value:t,defaultValue:r,placeholder:n="Select...",disabled:a=!1,readOnly:i=!1,loading:o=!1,clearable:s=!1,searchable:l=!1,size:c="md",variant:d="default",position:u="auto",maxHeight:w=240,emptyText:g="No options",loadingText:m="Loading...",searchPlaceholder:S="Search...",onChange:b,onSearch:z,onOpen:k,onClose:R,renderOption:p,renderValue:T,label:y,error:N,helperText:L,required:O=!1,name:F,ariaLabel:Y,className:re,...E}){let _=tr,A=mn(null),ee=mn(null),v=mn(null),G=mn(null),[K,se]=gn(!1),[H,U]=gn(r),[C,de]=gn(""),[B,ae]=gn(-1),[ge,Ye]=gn("bottom"),Ie=t!==void 0?t:H,Pe=t!==void 0,pe=e.find((te)=>te.value===Ie),ke=l&&C?e.filter((te)=>te.label.toLowerCase().includes(C.toLowerCase())):e,Te=()=>{if(u!=="auto"){Ye(u);return}if(!ee.current)return;let te=ee.current.getBoundingClientRect(),D=window.innerHeight-te.bottom,We=te.top,M=Math.min(w+50,300);if(D<M&&We>D)Ye("top");else Ye("bottom")},we=()=>{if(a||i)return;Te(),se(!0),ae(-1),k?.()},be=()=>{se(!1),de(""),ae(-1),R?.()},P=(te)=>{if(te.disabled)return;if(!Pe)U(te.value);b?.(te.value),be(),ee.current?.focus()},j=(te)=>{if(te.stopPropagation(),!Pe)U(void 0);b?.(void 0)},Z=(te)=>{let D=te.target.value;de(D),ae(-1),z?.(D)},me=(te)=>{switch(te.key){case"Enter":case" ":if(te.preventDefault(),K){if(B>=0&&ke[B])P(ke[B])}else we();break;case"ArrowDown":if(te.preventDefault(),!K)we();else ae((D)=>D<ke.length-1?D+1:0);break;case"ArrowUp":if(te.preventDefault(),!K)we();else ae((D)=>D>0?D-1:ke.length-1);break;case"Escape":if(K)te.preventDefault(),be();break;case"Tab":if(K)be();break;case"Home":if(K)te.preventDefault(),ae(0);break;case"End":if(K)te.preventDefault(),ae(ke.length-1);break}};Wi(()=>{if(!K)return;let te=(We)=>{let M=We.target,ie=A.current?.contains(M),Ne=v.current?.contains(M);if(!ie&&!Ne)be()},D=(We)=>{if(We.key==="Escape")be()};return document.addEventListener("mousedown",te),document.addEventListener("keydown",D),()=>{document.removeEventListener("mousedown",te),document.removeEventListener("keydown",D)}},[K]),Wi(()=>{if(K&&l&&G.current)G.current.focus()},[K,l]),Wi(()=>{if(K&&B>=0&&v.current){let te=v.current.querySelector(`[data-index="${B}"]`);if(te)te.scrollIntoView({block:"nearest"})}},[B,K]);let J=mn(null);return Cl(()=>{if(J.current)Tl.to(J.current,{rotation:K?180:0,duration:0.2,ease:"power2.out"})},[K]),Qe("div",{ref:A,className:It(_.container.base,re),...E,children:[y&&Qe("span",{className:It(_.label.base,_.label.size[c],O&&_.label.required,N&&_.label.error),id:`${E.id||"select"}-label`,children:y},void 0,!1,void 0,this),Qe(ra,{ref:ee,isOpen:K,disabled:a,loading:o,size:c,variant:d,hasValue:!!pe,hasError:!!N,onClick:()=>K?be():we(),onKeyDown:me,children:[Qe("span",{className:pe?_.value.base:_.placeholder.base,children:pe?T?T(pe):pe.icon?Qe(W0,{children:[pe.icon,pe.label]},void 0,!0,void 0,this):pe.label:n},void 0,!1,void 0,this),Qe("div",{className:"flex items-center gap-1",children:[s&&Ie!==void 0&&Ie!==""&&!a&&Qe("span",{role:"button",tabIndex:0,onClick:j,onKeyDown:(te)=>{if(te.key==="Enter"||te.key===" ")te.preventDefault(),j(te)},className:It(_.clearButton.base,_.clearButton.hover),"aria-label":"Clear selection",children:Qe("svg",{className:"w-4 h-4",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:Qe("path",{d:"M6.28 5.22a.75.75 0 00-1.06 1.06L8.94 10l-3.72 3.72a.75.75 0 101.06 1.06L10 11.06l3.72 3.72a.75.75 0 101.06-1.06L11.06 10l3.72-3.72a.75.75 0 00-1.06-1.06L10 8.94 6.28 5.22z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),o?Qe("svg",{className:It(_.loading.spinner,_.icon.size[c]),viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[Qe("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Qe("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Qe("svg",{ref:J,className:It(_.icon.base,_.icon.size[c]),viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true",children:Qe("path",{fillRule:"evenodd",d:"M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),F&&Qe("input",{type:"hidden",name:F,value:String(Ie??"")},void 0,!1,void 0,this),Qe(ta,{ref:v,isOpen:K,position:ge,size:c,maxHeight:w,triggerRef:ee,children:[l&&Qe("div",{className:_.search.container,children:Qe("input",{ref:G,type:"text",value:C,onChange:Z,placeholder:S,className:_.search.input,onClick:(te)=>te.stopPropagation()},void 0,!1,void 0,this)},void 0,!1,void 0,this),o?Qe("div",{className:_.loading.base,children:[Qe("svg",{className:_.loading.spinner,viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[Qe("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Qe("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m]},void 0,!0,void 0,this):ke.length===0?Qe("div",{className:_.empty.base,children:g},void 0,!1,void 0,this):ke.map((te,D)=>Qe("div",{"data-index":D,children:p?Qe("div",{onClick:()=>P(te),onKeyDown:(We)=>{if(We.key==="Enter")P(te)},role:"option",tabIndex:0,"aria-selected":te.value===Ie,children:p(te,te.value===Ie)},void 0,!1,void 0,this):Qe(Ii,{option:te,isSelected:te.value===Ie,isHighlighted:D===B,size:c,onClick:()=>P(te),onMouseEnter:()=>ae(D)},void 0,!1,void 0,this)},String(te.value),!1,void 0,this))]},void 0,!0,void 0,this),(L||N)&&Qe("p",{className:It(_.helper.base,N&&_.helper.error),children:N||L},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as $,Fragment as A0}from"react/jsx-dev-runtime";Ml.registerPlugin(Rl);var et={container:"w-full h-full flex flex-col min-h-0",header:{base:"mb-4",title:"text-xl font-semibold text-zinc-900 dark:text-white",description:"mt-1 text-sm text-zinc-500 dark:text-zinc-400"},toolbar:{base:"flex flex-col gap-3 mb-4",row:"flex flex-wrap items-center gap-3",search:"flex-1 min-w-[200px] max-w-md",searchFields:"flex flex-wrap items-center gap-2",filters:"flex flex-wrap items-center gap-2",actions:"flex items-center gap-2 ml-auto"},table:{container:"w-full flex-1 overflow-auto rounded-lg border border-zinc-200 dark:border-zinc-700 min-h-0 relative",table:"w-full text-sm table-fixed",thead:"bg-zinc-50 dark:bg-zinc-800 sticky top-0 z-10",th:"px-3 py-2.5 text-left text-xs font-medium text-zinc-600 dark:text-zinc-400 uppercase tracking-wider bg-zinc-50 dark:bg-zinc-800",thSortable:"cursor-pointer hover:bg-zinc-100 dark:hover:bg-zinc-700 select-none",tbody:"divide-y divide-zinc-100 dark:divide-zinc-800",tr:"hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors",trSelected:"bg-blue-50 dark:bg-blue-900/20",td:"px-3 py-2.5 text-sm text-zinc-700 dark:text-zinc-300 truncate relative",empty:"px-4 py-12 text-center text-zinc-500 dark:text-zinc-400",loading:"px-4 py-8 text-center text-zinc-500"},pagination:{base:"flex items-center justify-between py-3 text-sm border-t border-zinc-200 dark:border-zinc-700",info:"text-zinc-500 dark:text-zinc-400",buttons:"flex items-center gap-2"},modal:{overlay:"fixed inset-0 z-50 flex items-center justify-center bg-black/60 backdrop-blur-sm p-4 animate-in fade-in duration-200",container:"w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700 animate-in zoom-in-95 slide-in-from-bottom-4 duration-200",header:"mb-6 flex items-center justify-between border-b border-zinc-100 dark:border-zinc-800 pb-4",title:"text-lg font-semibold text-zinc-900 dark:text-white",closeButton:"rounded-full p-1 text-zinc-500 hover:bg-zinc-100 hover:text-zinc-700 dark:hover:bg-zinc-800 dark:hover:text-zinc-300"},button:{base:"inline-flex items-center justify-center rounded-lg font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500",secondary:"bg-zinc-100 text-zinc-900 hover:bg-zinc-200 dark:bg-zinc-800 dark:text-zinc-100 dark:hover:bg-zinc-700",danger:"bg-red-600 text-white hover:bg-red-700 focus:ring-red-500",success:"bg-green-600 text-white hover:bg-green-700 focus:ring-green-500",ghost:"text-zinc-600 hover:bg-zinc-100 dark:text-zinc-400 dark:hover:bg-zinc-800",sizes:{sm:"px-3 py-1.5 text-sm",md:"px-4 py-2 text-sm",lg:"px-5 py-2.5 text-base"}},input:{base:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 placeholder-zinc-400 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-100 dark:placeholder-zinc-500",label:"mb-1.5 block text-sm font-medium text-zinc-700 dark:text-zinc-300",error:"mt-1 text-xs text-red-500 dark:text-red-400"},select:{base:"w-full rounded-lg border border-zinc-300 bg-white px-3 py-2 text-sm text-zinc-900 focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 dark:border-zinc-600 dark:bg-zinc-800 dark:text-zinc-100"},checkbox:{base:"h-4 w-4 rounded border-zinc-300 text-blue-600 focus:ring-blue-500 dark:border-zinc-600 dark:bg-zinc-800"},skeleton:{base:"animate-pulse rounded bg-zinc-200 dark:bg-zinc-700",row:"h-12"}};function B0({entity:e,apiActions:t,title:r,description:n,pageSize:a=20,searchable:i=!0,searchFields:o,filterable:s=!0,sortable:l=!0,selectable:c=!0,showAdd:d=!0,showEdit:u=!0,showDelete:w=!0,showBulkAdd:g=!1,showBulkDelete:m=!0,columnConfigs:S,fieldConfigs:b,excludeColumns:z=[],excludeFields:k=[],onRowClick:R,renderHeader:p,renderToolbar:T,className:y}){let N=e.table_name,L=bn(null),[O,F]=qt(!1),[Y,re]=qt([]),[E,_]=qt({isOpen:!1,mode:"add"}),[A,ee]=qt({}),[v,G]=qt({}),[K,se]=qt({isOpen:!1,table:"",data:null});Hi(()=>{F(!0)},[]);let{items:H,meta:U,isLoading:C,isLoadingMore:de,loadData:B,loadMore:ae,hasMore:ge,addItem:Ye,updateItem:Ie,deleteItem:Pe,bulkDelete:pe,search:ke,setSearch:Te,setSort:we,filters:be,setFilters:P}=hi({entity:e,apiActions:t,pageSize:a}),j=e.add_base_columns?[{name:"id",type:"uuid",primaryKey:!0},{name:"created_at",type:"timestamptz"},{name:"updated_at",type:"timestamptz"}]:[],Z=new Set((e.columns??[]).map((h)=>h.name)),me=j.filter((h)=>!Z.has(h.name)),J=[...e.columns??[],...me],te=J.filter((h)=>{if(Zn(h))return!1;if(z.includes(h.name))return!1;if(S?.[h.name]?.hidden)return!1;return!0}),D=(h)=>J.filter((I)=>{if(yi(I,h))return!1;if(k.includes(I.name))return!1;if(b?.[I.name]?.hidden)return!1;return!0}),[We,M]=qt({}),[ie,Ne]=qt({}),De=U0(()=>J.filter((h)=>ln(h)),[J]),rt=bn(new Set),Ve=H0((h)=>{if(!h.references)return;let I=h.references.table;if(rt.current.has(I))return;rt.current.add(I);let X=`GET_${I.toUpperCase()}`,ne=t[X];if(ne)ne.start({payload:{limit:100},onAfterHandle:(oe)=>{let Be=(oe?.data?.items??[]).map((_e)=>({id:String(_e.id??""),label:String(_e.name??_e.title??_e.label??_e.id??""),data:_e}));M((_e)=>({..._e,[I]:Be})),Ne((_e)=>({..._e,[I]:!1}))},onErrorHandle:()=>{Ne((oe)=>({...oe,[I]:!1}))}})},[t]),$t=(h,I)=>{let ne=(We[h]??[]).find((oe)=>oe.id===I);if(ne)se({isOpen:!0,table:h,data:ne.data})},Tt=()=>{se({isOpen:!1,table:"",data:null})};Hi(()=>{for(let h of De)Ve(h)},[De,Ve]),Rl(()=>{if(L.current)Ml.fromTo(L.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,ease:"power2.out"})},[]);let mr=(h)=>{Te(h),B({search:h,page:1})},_t=()=>{re([])},W=()=>{let h={};for(let I of D("add")){let X=I.enumValues??I.enum?.values;if(I.default!==void 0)h[I.name]=I.default;else if(X&&X.length>0)h[I.name]=X[0];else if(I.type==="boolean")h[I.name]=!1;else h[I.name]=""}ee(h),G({}),_({isOpen:!0,mode:"add"})},le=(h)=>{let I={},X=h;for(let ne of J){let oe=ne.name,ve=oe.replace(/_([a-z])/g,(Ke,Be)=>Be.toUpperCase());if(ne.references?.foreignKey){let Ke=ne.references.foreignKey;if(Ke in X){I[oe]=X[Ke];continue}}if(oe in X)I[oe]=X[oe];else if(ve in X)I[oe]=X[ve];else{let Ke=`${ve}Id`;if(Ke in X)I[oe]=X[Ke];else I[oe]=void 0}}ee(I),G({}),_({isOpen:!0,mode:"edit",data:h})},qe=()=>{_({isOpen:!1,mode:"add"}),ee({}),G({}),gr(null)},Le=()=>{let h={};for(let I of D(E.mode)){let X=A[I.name],ne=X===void 0||X===null||X==="";if(I.notNull&&ne){h[I.name]="This field is required";continue}if(!ne&&I.validation){if(I.validation.minLength&&String(X).length<I.validation.minLength)h[I.name]=`Minimum ${I.validation.minLength} characters`;if(I.validation.maxLength&&String(X).length>I.validation.maxLength)h[I.name]=`Maximum ${I.validation.maxLength} characters`;if(I.validation.min!==void 0&&Number(X)<I.validation.min)h[I.name]=`Minimum value is ${I.validation.min}`;if(I.validation.max!==void 0&&Number(X)>I.validation.max)h[I.name]=`Maximum value is ${I.validation.max}`}}return G(h),Object.keys(h).length===0},[Re,gr]=qt(null),br=(h)=>{let I={},X=D(E.mode),ne=["integer","smallint","bigint","real","doublePrecision","numeric","decimal","money"];for(let oe of X){let ve=h[oe.name],Ke=oe.references?.foreignKey??oe.name;if(ve===void 0||ve===null||ve===""){if(!oe.notNull)I[Ke]=null;continue}if(Xn(oe))I[Ke]=Array.isArray(ve)?ve.join(","):String(ve);else if(ne.includes(oe.type))I[Ke]=Number(ve);else I[Ke]=ve}return I},Qr=async()=>{if(!Le())return;gr(null);let h=br(A);try{if(E.mode==="add")await Ye(h);else{let I=E.data?.id;if(I)await Ie(I,h)}qe()}catch(I){let X="An error occurred",ne=(oe)=>{if(typeof oe==="string")return oe;if(oe&&typeof oe==="object"){let ve=oe;if(ve.summary)return String(ve.summary);if(ve.message)return String(ve.message);if(ve.errors&&Array.isArray(ve.errors))return ve.errors.map((Ke)=>ne(Ke)).join(", ")}return JSON.stringify(oe)};try{let oe=I;if(oe.errors&&Array.isArray(oe.errors)&&oe.errors.length>0)X=oe.errors.map((ve)=>ne(ve)).join(", ");else if(oe.message)try{let ve=JSON.parse(oe.message);X=ne(ve)}catch{X=oe.message}else X=ne(I)}catch{X=String(I)}gr(X)}},Rr=async(h)=>{if(window.confirm("Are you sure you want to delete this item?"))await Pe(h)},Zr=async()=>{if(Y.length===0)return;if(window.confirm(`Are you sure you want to delete ${Y.length} items?`)){let h=Y.map((I)=>I.id);await pe(h),re([])}},fr=(h,I)=>{let X=S?.[h.name];if(X?.cellRenderer)return X.cellRenderer({value:I,row:{}});if(I===null||I===void 0)return $("span",{className:"text-zinc-400",children:"-"},void 0,!1,void 0,this);if(h.type==="boolean")return I?"Yes":"No";if(h.type==="timestamp"||h.type==="timestamptz"||h.type==="date")return new Date(I).toLocaleDateString();if(h.type==="json"||h.type==="jsonb")return $("code",{className:"text-xs",children:[JSON.stringify(I).slice(0,50),"..."]},void 0,!0,void 0,this);if(ln(h)&&h.references){let ne=h.references.table,ve=(We[ne]??[]).find((Ke)=>Ke.id===String(I));if(ve)return $("button",{type:"button",onClick:(Ke)=>{Ke.stopPropagation(),$t(ne,ve.id)},className:"group inline-flex items-center gap-1.5 rounded-md border border-zinc-200 bg-zinc-50 px-2 py-1 text-xs font-medium text-zinc-700 transition-all hover:border-zinc-300 hover:bg-zinc-100 dark:border-zinc-700 dark:bg-zinc-800 dark:text-zinc-300 dark:hover:border-zinc-600 dark:hover:bg-zinc-700",children:[$("span",{className:"max-w-[120px] truncate",children:ve.label},void 0,!1,void 0,this),$("svg",{className:"h-3 w-3 text-zinc-400 transition-transform group-hover:translate-x-0.5 group-hover:text-zinc-600 dark:group-hover:text-zinc-300",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true",children:$("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return $("span",{className:"text-zinc-400",children:"-"},void 0,!1,void 0,this)}return String(I)},$e=(h)=>{let I=b?.[h.name],X=I?.label??zt(h.name),ne=A[h.name],oe=v[h.name],ve=En(h);if(I?.render)return $("div",{className:"mb-4",children:[$("label",{htmlFor:`field-${h.name}`,className:et.input.label,children:X},void 0,!1,void 0,this),I.render({value:ne,onChange:(Be)=>ee((_e)=>({..._e,[h.name]:Be}))}),oe&&$("p",{className:et.input.error,children:oe},void 0,!1,void 0,this)]},h.name,!0,void 0,this);if(ve==="boolean")return $("div",{className:"mb-4",children:[$("label",{htmlFor:`field-${h.name}`,className:et.input.label,children:X},void 0,!1,void 0,this),$(Dt,{checked:Boolean(ne),onChange:(Be)=>ee((_e)=>({..._e,[h.name]:Be})),disabled:I?.disabled,size:"sm"},void 0,!1,void 0,this),oe&&$("p",{className:et.input.error,children:oe},void 0,!1,void 0,this)]},h.name,!0,void 0,this);let Ke=h.enumValues??h.enum?.values;if(ve==="select"&&Ke)return $("div",{className:"mb-4",children:[$("label",{htmlFor:`field-${h.name}`,className:et.input.label,children:X},void 0,!1,void 0,this),$(Ot,{value:String(ne??""),onChange:(Be)=>ee((_e)=>({..._e,[h.name]:Be})),options:Ke.map((Be)=>({value:Be,label:zt(Be)})),placeholder:`Select ${X.toLowerCase()}`,size:"sm"},void 0,!1,void 0,this),oe&&$("p",{className:et.input.error,children:oe},void 0,!1,void 0,this)]},h.name,!0,void 0,this);if(ln(h)&&h.references){let Be=h.references.table,_e=We[Be]??[],mt=ie[Be]??!1,Bt=ne?String(ne):void 0;return $("div",{className:"mb-4",children:[$("label",{htmlFor:`ref-${h.name}`,className:et.input.label,children:X},void 0,!1,void 0,this),$(Ot,{value:Bt,onChange:(Ut)=>ee((Mr)=>({...Mr,[h.name]:Ut??null})),options:_e.map((Ut)=>({value:Ut.id,label:Ut.label})),placeholder:mt?"Loading...":`Select ${X.toLowerCase()}`,size:"sm",clearable:!0},void 0,!1,void 0,this),oe&&$("p",{className:et.input.error,children:oe},void 0,!1,void 0,this)]},h.name,!0,void 0,this)}if(ki(h)){let Be=typeof ne==="object"?JSON.stringify(ne,null,2):String(ne??"{}");return $("div",{className:"mb-4",children:[$("label",{htmlFor:`json-${h.name}`,className:et.input.label,children:X},void 0,!1,void 0,this),$("textarea",{id:`json-${h.name}`,value:Be,onChange:(_e)=>{try{let mt=JSON.parse(_e.target.value);ee((Bt)=>({...Bt,[h.name]:mt})),G((Bt)=>{let Ut={...Bt};return delete Ut[h.name],Ut})}catch{ee((mt)=>({...mt,[h.name]:_e.target.value})),G((mt)=>({...mt,[h.name]:"Invalid JSON"}))}},placeholder:I?.placeholder??"Enter JSON...",className:f(et.input.base,"min-h-[100px] font-mono text-xs"),disabled:I?.disabled,readOnly:I?.readOnly},void 0,!1,void 0,this),oe&&$("p",{className:et.input.error,children:oe},void 0,!1,void 0,this)]},h.name,!0,void 0,this)}if(Xn(h)){let Be=Array.isArray(ne)?ne:[],_e=`array-${h.name}`;return $("div",{className:"mb-4",children:[$("label",{htmlFor:_e,className:et.input.label,children:X},void 0,!1,void 0,this),$("div",{className:"flex flex-wrap gap-1 rounded-lg border border-zinc-300 bg-white p-2 dark:border-zinc-600 dark:bg-zinc-800",children:[Be.map((mt,Bt)=>$("span",{className:"inline-flex items-center gap-1 rounded bg-blue-100 px-2 py-0.5 text-xs text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:[mt,$("button",{type:"button",onClick:()=>{let Ut=Be.filter((Mr,gd)=>gd!==Bt);ee((Mr)=>({...Mr,[h.name]:Ut}))},className:"ml-1 text-blue-600 hover:text-blue-800 dark:text-blue-300",children:"\xD7"},void 0,!1,void 0,this)]},Bt,!0,void 0,this)),$("input",{id:_e,type:"text",className:"min-w-[100px] flex-1 border-none bg-transparent text-sm outline-none",placeholder:Be.length===0?I?.placeholder??"Type and press Enter":"",onKeyDown:(mt)=>{if(mt.key==="Enter"){mt.preventDefault();let Bt=mt.currentTarget,Ut=Bt.value.trim();if(Ut)ee((Mr)=>({...Mr,[h.name]:[...Be,Ut]})),Bt.value=""}},disabled:I?.disabled,readOnly:I?.readOnly},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$("p",{className:"mt-1 text-xs text-zinc-500",children:"Press Enter to add"},void 0,!1,void 0,this),oe&&$("p",{className:et.input.error,children:oe},void 0,!1,void 0,this)]},h.name,!0,void 0,this)}return $("div",{className:"mb-4",children:[$(Fe,{type:ve==="number"?"number":"text",label:X,value:String(ne??""),onChange:(Be)=>{let _e=ve==="number"?Be===""?"":Number(Be):Be;ee((mt)=>({...mt,[h.name]:_e}))},placeholder:I?.placeholder??`Enter ${X.toLowerCase()}`,disabled:I?.disabled,readOnly:I?.readOnly},void 0,!1,void 0,this),oe&&$("p",{className:et.input.error,children:oe},void 0,!1,void 0,this)]},h.name,!0,void 0,this)},Ft=bn(null),hr=ul(J),fn=pl(J),vt=ml(J),hn=gl(J),[ao,ya]=qt(()=>{let h={};for(let I of hr)h[I.name]=!0;return h}),Jt=bn(ae);Jt.current=ae;let Kt=bn({hasMore:ge,isLoadingMore:de,isLoading:C});Kt.current={hasMore:ge,isLoadingMore:de,isLoading:C},Hi(()=>{let h=Ft.current;if(!h)return;let I=()=>{let{scrollTop:X,scrollHeight:ne,clientHeight:oe}=h,ve=100,Ke=ne<=oe||ne-X-oe<100,{hasMore:Be,isLoadingMore:_e,isLoading:mt}=Kt.current;if(Ke&&Be&&!_e&&!mt)Jt.current()};return I(),h.addEventListener("scroll",I),()=>h.removeEventListener("scroll",I)},[H.length]);let Qt=(h,I)=>{if(!I)P(be.filter((X)=>X.field!==h));else if(be.find((ne)=>ne.field===h))P(be.map((ne)=>ne.field===h?{...ne,value:I}:ne));else P([...be,{field:h,operator:"eq",value:I}]);B({filters:I?[...be.filter((X)=>X.field!==h),{field:h,operator:"eq",value:I}]:be.filter((X)=>X.field!==h),page:1})},xt=(h)=>{let I=be.find((X)=>X.field===h);return I?String(I.value):""},yn=(h)=>{ya((I)=>({...I,[h]:!I[h]}))},pd=(h)=>{let I=S?.[h.name];if(I?.width)return`${I.width}px`;switch(h.type){case"uuid":return"140px";case"boolean":return"80px";case"integer":case"smallint":case"bigint":return"90px";case"numeric":case"decimal":case"real":case"doublePrecision":return"100px";case"timestamp":case"timestamptz":case"date":return"120px";case"json":case"jsonb":return"100px";default:return"150px"}},ka=r??zt(N),md=(h,I,X)=>{let ne=h;if(X?.references?.foreignKey){let Ke=X.references.foreignKey;if(Ke in ne)return ne[Ke]}if(I in ne)return ne[I];let oe=I.replace(/_([a-z])/g,(Ke,Be)=>Be.toUpperCase());if(oe in ne)return ne[oe];let ve=`${oe}Id`;if(ve in ne)return ne[ve];return};return $("div",{ref:L,className:f(et.container,y),children:[p?p():$("div",{className:et.header.base,children:[$("h2",{className:et.header.title,children:ka},void 0,!1,void 0,this),n&&$("p",{className:et.header.description,children:n},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&$("div",{className:"mb-6 rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 p-4",children:[$(ea,{value:ke,onChange:Te,onSearch:mr,placeholder:`Search ${ka.toLowerCase()}...`,loading:C,debounceMs:400,disableDropdown:!0,showSearchIcon:!0,showClearButton:!0},void 0,!1,void 0,this),hr.length>0&&$("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[$("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:"Search in:"},void 0,!1,void 0,this),hr.map((h)=>$("label",{htmlFor:`search-field-${h.name}`,className:"flex items-center gap-1.5 px-2.5 py-1 rounded-full bg-zinc-100 dark:bg-zinc-800 hover:bg-zinc-200 dark:hover:bg-zinc-700 cursor-pointer transition-colors",children:[$(Dt,{checked:ao[h.name]??!1,onChange:()=>yn(h.name),size:"sm"},void 0,!1,void 0,this),$("span",{className:"text-xs font-medium text-zinc-700 dark:text-zinc-300",children:zt(h.name)},void 0,!1,void 0,this)]},h.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(d||Y.length>0)&&$("div",{className:"mb-6 flex items-center gap-3",children:[Y.length>0&&m&&$(V,{variant:"danger",size:"sm",onClick:Zr,children:["Delete (",Y.length,")"]},void 0,!0,void 0,this),d&&!e.excluded_methods?.includes("POST")&&$(V,{variant:"success",size:"sm",onClick:W,children:["Add"," ",zt(N.endsWith("s")?N.slice(0,-1):N)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),s&&(fn.length>0||vt.length>0||hn.length>0)&&$("div",{className:"rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-900 p-6",children:[$("div",{className:"mb-6 flex items-center justify-between",children:[$("h3",{className:"text-sm font-semibold text-zinc-900 dark:text-white",children:"Filters"},void 0,!1,void 0,this),be.length>0&&$("button",{type:"button",onClick:()=>P([]),className:"text-xs px-2 py-1 rounded text-emerald-600 hover:bg-emerald-50 dark:hover:bg-emerald-950 dark:text-emerald-400 font-medium transition-colors",children:"Clear"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-8",children:[fn.map((h)=>{let I=cl(h),X=wi(h)?[{value:"",label:"All"},{value:"true",label:"Yes"},{value:"false",label:"No"}]:[{value:"",label:"All"},...I.map((ne)=>({value:ne,label:zt(ne)}))];return $("div",{className:"flex flex-col gap-2",children:[$("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:zt(h.name)},void 0,!1,void 0,this),$(Ot,{value:xt(h.name)||void 0,onChange:(ne)=>Qt(h.name,ne??""),options:X,placeholder:"All",size:"sm",clearable:!0},void 0,!1,void 0,this)]},h.name,!0,void 0,this)}),vt.map((h)=>{let I=Number(xt(`${h.name}_min`))||0,X=Number(xt(`${h.name}_max`))||1e4;return $("div",{className:"flex flex-col gap-3",children:[$("div",{className:"flex items-center justify-between",children:[$("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:zt(h.name)},void 0,!1,void 0,this),$("span",{className:"text-xs font-semibold text-zinc-700 dark:text-zinc-300",children:[I," - ",X]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),$(Vn,{min:0,max:1e4,step:h.type==="numeric"||h.type==="decimal"?0.01:1,value:{min:I,max:X},onChange:(ne)=>{Qt(`${h.name}_min`,String(ne.min)),Qt(`${h.name}_max`,String(ne.max))},showTooltip:!0,size:"md"},void 0,!1,void 0,this)]},h.name,!0,void 0,this)}),hn.map((h)=>$("div",{className:"flex flex-col gap-2",children:[$("span",{className:"text-xs font-medium text-zinc-600 dark:text-zinc-400",children:zt(h.name)},void 0,!1,void 0,this),$(An,{mode:"range",value:{start:xt(`${h.name}_from`)?new Date(xt(`${h.name}_from`)):null,end:xt(`${h.name}_to`)?new Date(xt(`${h.name}_to`)):null},onChange:(I)=>{Qt(`${h.name}_from`,I.start?.toISOString().split("T")[0]??""),Qt(`${h.name}_to`,I.end?.toISOString().split("T")[0]??"")},placeholder:"Select range"},void 0,!1,void 0,this)]},h.name,!0,void 0,this))]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),T?.({selectedRows:Y,onClearSelection:_t}),$("div",{className:"mt-6 flex-1 min-h-0 overflow-x-auto",children:$(Bn,{data:H,columns:te.map((h)=>{let I=S?.[h.name],X=pd(h);return{key:`col_${h.name}`,header:I?.header??zt(h.name),width:Number.parseInt(X,10)||150,sortable:l&&I?.sortable!==!1,resizable:!0,cellRenderer:({row:ne})=>{let oe=md(ne,h.name,h);return fr(h,oe)}}}),actionColumns:u||w?[{key:"actions",header:"Actions",width:120,renderer:({row:h})=>{let I=h.id??"";return $("div",{className:"flex items-center gap-2",children:[u&&!e.excluded_methods?.includes("PUT")&&$(V,{variant:"outline",size:"xs",onClick:()=>le(h),children:"Edit"},void 0,!1,void 0,this),w&&!e.excluded_methods?.includes("DELETE")&&$(V,{variant:"ghost",size:"xs",onClick:()=>Rr(I),className:"text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-950",children:"Delete"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}}]:void 0,keyExtractor:(h)=>h.id??String(Math.random()),callbacks:{onSort:(h,I)=>{if(I)we([{field:String(h),direction:I}]),B({sort:[{field:String(h),direction:I}]});else we([]),B({sort:[]})},onLoadMore:ae,onCellClick:R?({row:h})=>{R(h)}:void 0},config:{hasClickAction:Boolean(R),isFrontendSort:!1,enableInfiniteScroll:!0,autoFetchUntilScroll:!0,enableSelection:c},isLoading:C&&H.length===0,isPending:C&&H.length===0,isLoadingMore:de,hasMoreData:ge,emptyMessage:`No ${ka.toLowerCase()} found`,selectionToolbar:c?({selectedData:h,onClearSelection:I})=>$(A0,{children:m&&h.length>0&&$(V,{variant:"danger",size:"sm",onClick:()=>{let X=h.map((ne)=>ne.id).filter(Boolean);if(X.length>0&&window.confirm(`Delete ${X.length} items?`))pe(X).then(()=>I())},children:["Delete (",h.length,")"]},void 0,!0,void 0,this)},void 0,!1,void 0,this):void 0},void 0,!1,void 0,this)},void 0,!1,void 0,this),(U||de)&&$("div",{className:et.pagination.base,children:[$("span",{className:et.pagination.info,children:U?`Showing ${H.length} of ${U.totalItems} items`:""},void 0,!1,void 0,this),de&&$("span",{className:"flex items-center gap-2 text-zinc-500 dark:text-zinc-400",children:[$("svg",{className:"h-4 w-4 animate-spin",viewBox:"0 0 24 24",fill:"none","aria-hidden":"true",children:[$("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),$("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),"Loading more..."]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),O&&E.isOpen&&Ll($("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",padding:"1rem"},onClick:qe,onKeyDown:(h)=>h.key==="Escape"&&qe(),role:"dialog","aria-modal":"true",children:$("div",{className:"w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700",onClick:(h)=>h.stopPropagation(),onKeyDown:(h)=>{if(h.stopPropagation(),h.key==="Escape")qe()},role:"document",children:[$("div",{className:et.modal.header,children:[$("h3",{className:et.modal.title,children:[E.mode==="add"?"Add":"Edit"," ",zt(N.endsWith("s")?N.slice(0,-1):N)]},void 0,!0,void 0,this),$(V,{variant:"ghost",size:"sm",onClick:qe,children:"\u2715"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$("form",{onSubmit:(h)=>{h.preventDefault(),Qr()},children:[Re&&$("div",{className:"mb-4 rounded-lg bg-red-50 p-3 text-sm text-red-600 dark:bg-red-900/20 dark:text-red-400",children:Re},void 0,!1,void 0,this),D(E.mode).map((h)=>$e(h)),$("div",{className:"mt-6 flex justify-end gap-2",children:[$(V,{variant:"secondary",size:"sm",onClick:qe,children:"Cancel"},void 0,!1,void 0,this),$(V,{variant:"primary",size:"sm",type:"submit",children:E.mode==="add"?"Create":"Update"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),document.body),O&&K.isOpen&&K.data&&Ll($("div",{style:{position:"fixed",inset:0,zIndex:9999,display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"rgba(0,0,0,0.6)",backdropFilter:"blur(4px)",padding:"1rem"},onClick:Tt,onKeyDown:(h)=>h.key==="Escape"&&Tt(),role:"dialog","aria-modal":"true",children:$("div",{className:"w-full max-w-lg rounded-2xl bg-white p-6 shadow-2xl dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-700",onClick:(h)=>h.stopPropagation(),onKeyDown:(h)=>{if(h.stopPropagation(),h.key==="Escape")Tt()},role:"document",children:[$("div",{className:et.modal.header,children:[$("h3",{className:et.modal.title,children:[zt(K.table.endsWith("s")?K.table.slice(0,-1):K.table)," ","Details"]},void 0,!0,void 0,this),$(V,{variant:"ghost",size:"sm",onClick:Tt,children:"\u2715"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),$("div",{className:"space-y-3",children:Object.entries(K.data).map(([h,I])=>{if(h==="id"||h.endsWith("At")||h.endsWith("By"))return null;return $("div",{className:"flex flex-col gap-1",children:[$("span",{className:"text-xs font-medium text-zinc-500 dark:text-zinc-400",children:zt(h)},void 0,!1,void 0,this),$("span",{className:"text-sm text-zinc-900 dark:text-zinc-100",children:I===null||I===void 0?"-":typeof I==="object"?JSON.stringify(I):String(I)},void 0,!1,void 0,this)]},h,!0,void 0,this)})},void 0,!1,void 0,this),$("div",{className:"mt-6 flex justify-end",children:$(V,{variant:"secondary",size:"sm",onClick:Tt,children:"Close"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),document.body)]},void 0,!0,void 0,this)}var rr={container:{base:"relative min-h-screen w-full",wrapper:"relative z-10 w-full max-w-4xl mx-auto px-4 py-6 sm:px-6 sm:py-8 lg:px-8"},card:{base:"w-full",padding:"p-4 sm:p-6 lg:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-xl shadow-black/5 dark:shadow-black/20",rounded:"rounded-xl sm:rounded-2xl"},header:{container:"flex flex-col sm:flex-row items-center sm:items-start gap-4 sm:gap-6 pb-6 border-b border-zinc-200 dark:border-zinc-700/50",avatar:{wrapper:"relative flex-shrink-0",image:"w-20 h-20 sm:w-24 sm:h-24 rounded-full object-cover ring-4 ring-white dark:ring-zinc-800 shadow-lg",placeholder:"w-20 h-20 sm:w-24 sm:h-24 rounded-full bg-gradient-to-br from-blue-500 to-purple-600 flex items-center justify-center text-white text-2xl sm:text-3xl font-bold ring-4 ring-white dark:ring-zinc-800 shadow-lg",uploadButton:"absolute -bottom-1 -right-1 p-1.5 sm:p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-700 transition-colors cursor-pointer"},info:{container:"flex-1 text-center sm:text-left",name:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white",email:"text-sm sm:text-base text-zinc-600 dark:text-zinc-400 mt-1",meta:"flex flex-wrap justify-center sm:justify-start gap-3 sm:gap-4 mt-3 text-xs sm:text-sm text-zinc-500 dark:text-zinc-400"}},section:{container:"mt-6 sm:mt-8",title:"text-base sm:text-lg font-semibold text-zinc-900 dark:text-white",titleWrapper:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-2 sm:gap-4 mb-4",addButton:"text-xs sm:text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors",content:"space-y-3 sm:space-y-4",empty:{container:"flex flex-col items-center justify-center py-8 sm:py-12 text-center bg-zinc-50 dark:bg-zinc-800/30 rounded-xl",icon:"w-10 h-10 sm:w-12 sm:h-12 text-zinc-300 dark:text-zinc-600 mb-3",text:"text-sm text-zinc-500 dark:text-zinc-400"}},profileForm:{container:"mt-4 sm:mt-6",grid:"grid grid-cols-1 sm:grid-cols-2 gap-3 sm:gap-4",field:{container:"space-y-1 sm:space-y-1.5",label:"block text-xs sm:text-sm font-medium text-zinc-700 dark:text-zinc-300",input:"w-full px-3 py-2 text-sm rounded-lg border border-zinc-300 dark:border-zinc-600 bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white placeholder-zinc-400 focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all",error:"text-xs text-red-500 mt-1"},actions:"flex flex-col-reverse sm:flex-row justify-end gap-2 sm:gap-3 mt-4 sm:mt-6"},itemCard:{base:"group relative transition-all duration-200",padding:"p-3 sm:p-4",background:"bg-white dark:bg-zinc-800/60",border:"border border-zinc-200 dark:border-zinc-700/50",rounded:"rounded-lg sm:rounded-xl",hover:"hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-600",header:{container:"flex items-start gap-3",icon:"flex-shrink-0 w-8 h-8 sm:w-10 sm:h-10 rounded-lg bg-zinc-100 dark:bg-zinc-700 flex items-center justify-center text-zinc-500 dark:text-zinc-400",title:"font-medium text-sm sm:text-base text-zinc-900 dark:text-white",subtitle:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 mt-0.5",actions:"flex items-center gap-1 sm:gap-2 ml-auto opacity-0 group-hover:opacity-100 transition-opacity"},details:{container:"mt-2 sm:mt-3 space-y-1 sm:space-y-1.5 text-xs sm:text-sm",row:"flex items-center justify-between",label:"text-zinc-500 dark:text-zinc-400",value:"text-zinc-700 dark:text-zinc-300 truncate ml-2 text-right"}},modal:{overlay:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center p-4",container:"bg-white dark:bg-zinc-800 rounded-xl sm:rounded-2xl shadow-2xl max-w-md w-full p-4 sm:p-6 max-h-[90vh] overflow-y-auto",title:"text-base sm:text-lg font-semibold text-zinc-900 dark:text-white mb-4",form:"space-y-3 sm:space-y-4",actions:"flex flex-col-reverse sm:flex-row gap-2 sm:gap-3 justify-end mt-4 sm:mt-6"},loading:{container:"flex flex-col items-center justify-center py-12 sm:py-16",spinner:"w-8 h-8 border-2 border-zinc-200 border-t-blue-600 rounded-full animate-spin",text:"mt-3 sm:mt-4 text-sm text-zinc-500 dark:text-zinc-400"},error:{container:"p-3 sm:p-4 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-xs sm:text-sm text-red-600 dark:text-red-400"},accountSettings:{container:"space-y-2",item:"w-full flex items-center justify-between p-3 rounded-lg border border-zinc-200 dark:border-zinc-700 hover:bg-zinc-50 dark:hover:bg-zinc-800/50 transition-colors text-left",iconWrapper:"w-10 h-10 rounded-full flex items-center justify-center",content:"flex items-center gap-3",title:"text-sm font-medium text-zinc-900 dark:text-white",description:"text-xs text-zinc-500 dark:text-zinc-400",arrow:"w-5 h-5 text-zinc-400"}};import{jsxDEV as He}from"react/jsx-dev-runtime";function na({address:e,onEdit:t,onDelete:r,isUpdating:n,isDeleting:a,allowEdit:i=!0}){let o=rr,s=e.id.startsWith("temp-"),l=()=>{return[e.street,e.apartment,e.neighborhood,e.district,e.city,e.state,e.province,e.zip,e.country].filter(Boolean).join(", ")||"No address details"},c=()=>{if(e.type==="home"||e.type==="residential")return He("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[He("title",{children:"Home"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12l8.954-8.955c.44-.439 1.152-.439 1.591 0L21.75 12M4.5 9.75v10.125c0 .621.504 1.125 1.125 1.125H9.75v-4.875c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125V21h4.125c.621 0 1.125-.504 1.125-1.125V9.75M8.25 21h8.25"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.type==="work"||e.type==="office")return He("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[He("title",{children:"Work"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 21h16.5M4.5 3h15M5.25 3v18m13.5-18v18M9 6.75h1.5m-1.5 3h1.5m-1.5 3h1.5m3-6H15m-1.5 3H15m-1.5 3H15M9 21v-3.375c0-.621.504-1.125 1.125-1.125h3.75c.621 0 1.125.504 1.125 1.125V21"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return He("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[He("title",{children:"Location"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return He("article",{className:f(o.itemCard.base,o.itemCard.padding,o.itemCard.background,o.itemCard.border,o.itemCard.rounded,o.itemCard.hover),children:[He("div",{className:o.itemCard.header.container,children:[He("div",{className:o.itemCard.header.icon,children:c()},void 0,!1,void 0,this),He("div",{className:"flex-1 min-w-0",children:[He("h3",{className:o.itemCard.header.title,children:e.name},void 0,!1,void 0,this),He("p",{className:o.itemCard.header.subtitle,children:e.type||"Address"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&He("div",{className:o.itemCard.header.actions,children:[He(V,{variant:"ghost",size:"sm",onClick:()=>t(e),disabled:n||a||s,className:"p-1.5","aria-label":"Edit address",children:He("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[He("title",{children:"Edit"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),He(V,{variant:"ghost",size:"sm",onClick:()=>r(e.id),disabled:n||a||s,className:"p-1.5 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20","aria-label":"Delete address",children:a?He("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[He("title",{children:"Deleting"},void 0,!1,void 0,this),He("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),He("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):He("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[He("title",{children:"Delete"},void 0,!1,void 0,this),He("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),He("div",{className:o.itemCard.details.container,children:He("p",{className:"text-zinc-600 dark:text-zinc-400 text-sm leading-relaxed",children:l()},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Me}from"react/jsx-dev-runtime";function aa({phone:e,onEdit:t,onDelete:r,isUpdating:n,isDeleting:a,allowEdit:i=!0}){let o=rr,s=e.id.startsWith("temp-"),l=()=>{let d=[e.countryCode,e.number];if(e.extension)d.push(`ext. ${e.extension}`);return d.join(" ")},c=()=>{if(e.type==="mobile")return Me("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Me("title",{children:"Mobile"},void 0,!1,void 0,this),Me("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 1.5H8.25A2.25 2.25 0 006 3.75v16.5a2.25 2.25 0 002.25 2.25h7.5A2.25 2.25 0 0018 20.25V3.75a2.25 2.25 0 00-2.25-2.25H13.5m-3 0V3h3V1.5m-3 0h3m-3 18.75h3"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.type==="office")return Me("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Me("title",{children:"Office"},void 0,!1,void 0,this),Me("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(e.type==="fax")return Me("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Me("title",{children:"Fax"},void 0,!1,void 0,this),Me("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.72 13.829c-.24.03-.48.062-.72.096m.72-.096a42.415 42.415 0 0110.56 0m-10.56 0L6.34 18m10.94-4.171c.24.03.48.062.72.096m-.72-.096L17.66 18m0 0l.229 2.523a1.125 1.125 0 01-1.12 1.227H7.231c-.662 0-1.18-.568-1.12-1.227L6.34 18m11.318 0h1.091A2.25 2.25 0 0021 15.75V9.456c0-1.081-.768-2.015-1.837-2.175a48.055 48.055 0 00-1.913-.247M6.34 18H5.25A2.25 2.25 0 013 15.75V9.456c0-1.081.768-2.015 1.837-2.175a48.041 48.041 0 011.913-.247m10.5 0a48.536 48.536 0 00-10.5 0m10.5 0V3.375c0-.621-.504-1.125-1.125-1.125h-8.25c-.621 0-1.125.504-1.125 1.125v3.659M18 10.5h.008v.008H18V10.5zm-3 0h.008v.008H15V10.5z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Me("svg",{className:"w-5 h-5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Me("title",{children:"Phone"},void 0,!1,void 0,this),Me("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)};return Me("article",{className:f(o.itemCard.base,o.itemCard.padding,o.itemCard.background,o.itemCard.border,o.itemCard.rounded,o.itemCard.hover),children:[Me("div",{className:o.itemCard.header.container,children:[Me("div",{className:o.itemCard.header.icon,children:c()},void 0,!1,void 0,this),Me("div",{className:"flex-1 min-w-0",children:[Me("h3",{className:o.itemCard.header.title,children:e.name},void 0,!1,void 0,this),Me("p",{className:o.itemCard.header.subtitle,children:e.type||"Phone"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),i&&Me("div",{className:o.itemCard.header.actions,children:[Me(V,{variant:"ghost",size:"sm",onClick:()=>t(e),disabled:n||a||s,className:"p-1.5","aria-label":"Edit phone",children:Me("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Me("title",{children:"Edit"},void 0,!1,void 0,this),Me("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.862 4.487l1.687-1.688a1.875 1.875 0 112.652 2.652L10.582 16.07a4.5 4.5 0 01-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 011.13-1.897l8.932-8.931zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0115.75 21H5.25A2.25 2.25 0 013 18.75V8.25A2.25 2.25 0 015.25 6H10"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Me(V,{variant:"ghost",size:"sm",onClick:()=>r(e.id),disabled:n||a||s,className:"p-1.5 text-red-500 hover:text-red-600 hover:bg-red-50 dark:hover:bg-red-900/20","aria-label":"Delete phone",children:a?Me("svg",{className:"w-4 h-4 animate-spin",viewBox:"0 0 24 24",fill:"none",children:[Me("title",{children:"Deleting"},void 0,!1,void 0,this),Me("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),Me("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Me("svg",{className:"w-4 h-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[Me("title",{children:"Delete"},void 0,!1,void 0,this),Me("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Me("div",{className:o.itemCard.details.container,children:Me("p",{className:"text-zinc-900 dark:text-white font-medium",children:l()},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as at}from"react/jsx-dev-runtime";function ia({user:e,profile:t,profilePicture:r,fileProxyBasePath:n="/file-proxy",onUploadPicture:a,isUploading:i=!1}){let o=rr,s=()=>{if(t?.firstName&&t?.lastName)return`${t.firstName[0]}${t.lastName[0]}`.toUpperCase();if(e?.email&&e.email.length>0)return e.email[0]?.toUpperCase()||"?";return"?"},l=()=>{if(t?.firstName&&t?.lastName)return`${t.firstName} ${t.lastName}`;return"No name set"},c=(d)=>{if(!d)return"N/A";return(typeof d==="string"?new Date(d):d).toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})};return at("header",{className:o.header.container,children:[at("div",{className:o.header.avatar.wrapper,children:[r?.id?at("img",{src:`${n}/${r.id}`,alt:l(),className:o.header.avatar.image},void 0,!1,void 0,this):at("div",{className:o.header.avatar.placeholder,children:s()},void 0,!1,void 0,this),a&&at("button",{type:"button",onClick:a,disabled:i,className:o.header.avatar.uploadButton,"aria-label":"Upload profile picture",children:i?at("svg",{className:"w-4 h-4 animate-spin text-zinc-500",viewBox:"0 0 24 24",fill:"none",children:[at("title",{children:"Uploading"},void 0,!1,void 0,this),at("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"},void 0,!1,void 0,this),at("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):at("svg",{className:"w-4 h-4 text-zinc-500",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[at("title",{children:"Upload"},void 0,!1,void 0,this),at("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 9a2 2 0 012-2h.93a2 2 0 001.664-.89l.812-1.22A2 2 0 0110.07 4h3.86a2 2 0 011.664.89l.812 1.22A2 2 0 0018.07 7H19a2 2 0 012 2v9a2 2 0 01-2 2H5a2 2 0 01-2-2V9z"},void 0,!1,void 0,this),at("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 13a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),at("div",{className:o.header.info.container,children:[at("h1",{className:o.header.info.name,children:l()},void 0,!1,void 0,this),at("p",{className:o.header.info.email,children:e?.email||"No email"},void 0,!1,void 0,this),at("div",{className:o.header.info.meta,children:[e?.verifiedAt&&at("span",{className:"flex items-center gap-1",children:[at("svg",{className:"w-3.5 h-3.5 text-green-500",viewBox:"0 0 24 24",fill:"currentColor",children:[at("title",{children:"Verified"},void 0,!1,void 0,this),at("path",{fillRule:"evenodd",d:"M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z",clipRule:"evenodd"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),"Verified"]},void 0,!0,void 0,this),e?.lastLoginAt&&at("span",{children:["Last login: ",c(e.lastLoginAt)]},void 0,!0,void 0,this),e?.createdAt&&at("span",{children:["Member since: ",c(e.createdAt)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Il}from"@gsap/react";import Wl from"gsap";import{useEffect as G0,useEffectEvent as Y0,useRef as sa,useState as Tr}from"react";import{batch as O0,createStore as $0}from"h-state";var F0={user:null,profile:null,addresses:[],phones:[],files:[],roles:[],profilePicture:null,isEditingProfile:!1},{useStore:oa}=$0(F0,{setUser:(e)=>(t)=>{e.user=t},setProfile:(e)=>(t)=>{if(t===null)e.profile=null;else if(e.profile)e.profile={...e.profile,...t};else e.profile=t},setAddresses:(e)=>(t)=>{e.addresses=t},setPhones:(e)=>(t)=>{e.phones=t},setFiles:(e)=>(t)=>{e.files=t},setRoles:(e)=>(t)=>{e.roles=t},setProfilePicture:(e)=>(t)=>{e.profilePicture=t},setEditingProfile:(e)=>(t)=>{e.isEditingProfile=t},addAddress:(e)=>(t)=>{e.addresses=[...e.addresses,t]},updateAddress:(e)=>(t)=>{e.addresses=e.addresses.map((r)=>r.id===t.id?{...r,...t}:r)},removeAddress:(e)=>(t)=>{e.addresses=e.addresses.filter((r)=>r.id!==t)},addPhone:(e)=>(t)=>{e.phones=[...e.phones,t]},updatePhone:(e)=>(t)=>{e.phones=e.phones.map((r)=>r.id===t.id?{...r,...t}:r)},removePhone:(e)=>(t)=>{e.phones=e.phones.filter((r)=>r.id!==t)},addFile:(e)=>(t)=>{if(e.files=[...e.files,t],t.type==="profile_picture"){let n=e.files.filter((a)=>a.type==="profile_picture").sort((a,i)=>new Date(i.updatedAt).getTime()-new Date(a.updatedAt).getTime())[0];e.profilePicture=n||t}},updateFile:(e)=>(t)=>{if(e.files=e.files.map((r)=>r.id===t.id?t:r),t.type==="profile_picture")e.profilePicture=t;else if(e.profilePicture?.id===t.id)e.profilePicture=null},removeFile:(e)=>(t)=>{let r=e.files.find((n)=>n.id===t);if(e.files=e.files.filter((n)=>n.id!==t),r?.type==="profile_picture"&&e.profilePicture?.id===t)e.profilePicture=null},reset:(e)=>()=>{O0(()=>{e.user=null,e.profile=null,e.addresses=[],e.phones=[],e.files=[],e.roles=[],e.profilePicture=null,e.isEditingProfile=!1})}});import{jsxDEV as x,Fragment as q0}from"react/jsx-dev-runtime";Wl.registerPlugin(Il);function Hl({meAction:e,addProfileAction:t,updateProfileAction:r,addAddressAction:n,updateAddressAction:a,deleteAddressAction:i,addPhoneAction:o,updatePhoneAction:s,deletePhoneAction:l,uploadFileAction:c,updateFileAction:d,deleteFileAction:u,fileProxyBasePath:w="/file-proxy",onProfileUpdated:g,onAddressAdded:m,onAddressUpdated:S,onAddressDeleted:b,onPhoneAdded:z,onPhoneUpdated:k,onPhoneDeleted:R,onFileUploaded:p,onFileUpdated:T,onFileDeleted:y,onProfilePictureChanged:N,showBackground:L=!1,allowProfileEdit:O=!0,allowAddressEdit:F=!0,allowPhoneEdit:Y=!0,allowFileUpload:re=!0,changePasswordHref:E,devicesHref:_,onChangePassword:A,onViewDevices:ee}){let v=rr,G=sa(null),K=sa(null),se=sa(null),H=oa(),[U,C]=Tr(null),[de,B]=Tr(null),[ae,ge]=Tr(!1),[Ye,Ie]=Tr(!1),Pe=sa(null),[pe,ke]=Tr({}),[Te,we]=Tr({}),[be,P]=Tr({}),j=Y0(()=>{e.start({payload:void 0,onAfterHandle:(W)=>{let le=W.data;if(!le?.user?.id)return;let{user:qe,profile:Le,addresses:Re,phones:gr,files:br,roles:Qr}=le;H.setUser(qe),H.setProfile(Le),H.setAddresses(Re),H.setPhones(gr),H.setFiles(br),H.setRoles(Qr||[]);let Rr=br.filter((fr)=>fr.type==="profile_picture"),Zr=Rr.length>0?Rr.sort((fr,$e)=>new Date($e.updatedAt).getTime()-new Date(fr.updatedAt).getTime())[0]:null;if(H.setProfilePicture(Zr||null),Le)ke({firstName:Le.firstName,lastName:Le.lastName})}})});G0(()=>{j()},[]),Il(()=>{if(!K.current)return;Wl.fromTo(K.current,{opacity:0,y:30},{opacity:1,y:0,duration:0.6,ease:"power3.out"})},{scope:G});let Z=()=>{if(!H.user?.id)return;let W=!!H.profile?.id,le=H.profile,qe={...le,...pe};if(H.setProfile(qe),H.setEditingProfile(!1),W&&le?.id)r.start({payload:{id:le.id,...pe},onAfterHandle:(Le)=>{let Re=Le.data;if(Re)H.setProfile(Re),g?.(Re)},onErrorHandle:()=>{H.setProfile(le)}});else t.start({payload:{userId:H.user.id,...pe},onAfterHandle:(Le)=>{let Re=Le.data;if(Re)H.setProfile(Re),g?.(Re)},onErrorHandle:()=>{H.setProfile(le)}})},me=()=>{if(!H.user?.id)return;let W=`temp-${Date.now()}`,le={id:W,...Te,ownerType:"user",ownerId:H.user.id,name:Te.name||"New Address"};H.addAddress(le),ge(!1),we({}),n.start({payload:{...Te,ownerType:"user",ownerId:H.user.id,name:Te.name||"New Address"},onAfterHandle:(qe)=>{let Le=qe.data;if(Le)H.removeAddress(W),H.addAddress(Le),m?.(Le)},onErrorHandle:()=>{H.removeAddress(W)}})},J=()=>{if(!U?.id)return;let W=U.id,le=H.addresses.find((Le)=>Le.id===W),qe={...le,...Te,id:W};H.updateAddress(qe),C(null),ge(!1),we({}),a.start({payload:{id:W,...Te},onAfterHandle:(Le)=>{let Re=Le.data;if(Re)H.updateAddress(Re),S?.(Re)},onErrorHandle:()=>{if(le)H.updateAddress(le)}})},te=(W)=>{i.start({payload:{id:W},onAfterHandle:()=>{H.removeAddress(W),b?.(W)}})},D=()=>{if(!H.user?.id)return;let W=`temp-${Date.now()}`,le={id:W,...be,ownerType:"user",ownerId:H.user.id,name:be.name||"New Phone",number:be.number||"",countryCode:be.countryCode||"+1"};H.addPhone(le),Ie(!1),P({}),o.start({payload:{...be,ownerType:"user",ownerId:H.user.id,name:be.name||"New Phone",number:be.number||"",countryCode:be.countryCode||"+1"},onAfterHandle:(qe)=>{let Le=qe.data;if(Le)H.removePhone(W),H.addPhone(Le),z?.(Le)},onErrorHandle:()=>{H.removePhone(W)}})},We=()=>{if(!de?.id)return;let W=de.id,le=H.phones.find((Le)=>Le.id===W),qe={...le,...be,id:W};H.updatePhone(qe),B(null),Ie(!1),P({}),s.start({payload:{id:W,...be},onAfterHandle:(Le)=>{let Re=Le.data;if(Re)H.updatePhone(Re),k?.(Re)},onErrorHandle:()=>{if(le)H.updatePhone(le)}})},M=(W)=>{l.start({payload:{id:W},onAfterHandle:()=>{H.removePhone(W),R?.(W)}})},ie=(W)=>{let le=W.target.files?.[0];if(!le||!c)return;let qe=new FormData;qe.append("files",le),qe.append("data",JSON.stringify({type:"profile_picture"})),c.start({payload:qe,onAfterHandle:(Le)=>{let Re=Le.data;if(Re)H.addFile(Re),p?.(Re),N?.(Re)}})},Ne=(W)=>{if(!d)return;let le=H.files.find((Le)=>Le.id===W.id),qe={...W,type:"profile_picture"};H.updateFile(qe),d.start({payload:{id:W.id,type:"profile_picture"},onAfterHandle:(Le)=>{let Re=Le.data;if(Re)H.updateFile(Re),T?.(Re),N?.(Re)},onErrorHandle:()=>{if(le)H.updateFile(le)}})},De=(W)=>{if(!u)return;u.start({payload:{id:W},onAfterHandle:()=>{H.removeFile(W),y?.(W)}})},rt=(W)=>`${w}/${W.id}`,Ve=(W)=>{return["image","profile_picture"].includes(W.type||"")||W.mimeType?.startsWith("image/")},$t=(W)=>{C(W),we({name:W.name,street:W.street,city:W.city,state:W.state,zip:W.zip,country:W.country}),ge(!0)},Tt=(W)=>{B(W),P({name:W.name,number:W.number,countryCode:W.countryCode,type:W.type,extension:W.extension}),Ie(!0)},mr=()=>{C(null),we({}),ge(!0)},_t=()=>{B(null),P({}),Ie(!0)};return x("main",{ref:G,className:f(v.container.base),"aria-label":"Profile page",children:[L&&x(lt,{},void 0,!1,void 0,this),x("div",{className:v.container.wrapper,children:x("article",{ref:K,className:f(v.card.base,v.card.padding,v.card.background,v.card.border,v.card.shadow,v.card.rounded),children:e.state.isPending?x("div",{className:v.loading.container,children:[x("div",{className:v.loading.spinner},void 0,!1,void 0,this),x("p",{className:v.loading.text,children:"Loading profile..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this):x(q0,{children:[x(ia,{user:H.user||void 0,profile:H.profile||void 0,profilePicture:H.profilePicture||void 0,fileProxyBasePath:w,onUploadPicture:re&&c?()=>se.current?.click():void 0,isUploading:c?.state.isPending},void 0,!1,void 0,this),x("input",{ref:se,type:"file",accept:"image/*",className:"hidden",onChange:ie},void 0,!1,void 0,this),x("section",{className:v.section.container,children:[x("div",{className:v.section.titleWrapper,children:[x("h2",{className:v.section.title,children:"Profile Information"},void 0,!1,void 0,this),O&&!H.isEditingProfile&&x("button",{type:"button",onClick:()=>H.setEditingProfile(!0),className:v.section.addButton,children:"Edit"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.isEditingProfile?x("div",{className:v.profileForm.container,children:[x("div",{className:v.profileForm.grid,children:[x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"firstName",className:v.profileForm.field.label,children:"First Name"},void 0,!1,void 0,this),x("input",{id:"firstName",type:"text",value:pe.firstName||"",onChange:(W)=>ke((le)=>({...le,firstName:W.target.value})),className:v.profileForm.field.input,placeholder:"Enter first name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"lastName",className:v.profileForm.field.label,children:"Last Name"},void 0,!1,void 0,this),x("input",{id:"lastName",type:"text",value:pe.lastName||"",onChange:(W)=>ke((le)=>({...le,lastName:W.target.value})),className:v.profileForm.field.input,placeholder:"Enter last name"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.actions,children:[x(V,{variant:"outline",size:"sm",onClick:()=>H.setEditingProfile(!1),children:"Cancel"},void 0,!1,void 0,this),x(V,{variant:"primary",size:"sm",onClick:Z,disabled:r.state.isPending||t.state.isPending,children:r.state.isPending||t.state.isPending?"Saving...":"Save Changes"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this):x("div",{className:v.profileForm.grid,children:[x("div",{children:[x("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"First Name"},void 0,!1,void 0,this),x("p",{className:"text-sm font-medium text-zinc-900 dark:text-white",children:H.profile?.firstName||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("div",{children:[x("p",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:"Last Name"},void 0,!1,void 0,this),x("p",{className:"text-sm font-medium text-zinc-900 dark:text-white",children:H.profile?.lastName||"Not set"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x("section",{className:v.section.container,children:[x("div",{className:v.section.titleWrapper,children:[x("h2",{className:v.section.title,children:"Addresses"},void 0,!1,void 0,this),F&&x("button",{type:"button",onClick:mr,className:v.section.addButton,children:"+ Add Address"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.addresses.length===0?x("div",{className:v.section.empty.container,children:[x("svg",{className:v.section.empty.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[x("title",{children:"No addresses"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 10.5a3 3 0 11-6 0 3 3 0 016 0z"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("p",{className:v.section.empty.text,children:"No addresses added yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):x("div",{className:v.section.content,children:H.addresses.map((W)=>x(na,{address:W,onEdit:$t,onDelete:te,isUpdating:a.state.isPending,isDeleting:i.state.isPending,allowEdit:F},W.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("section",{className:v.section.container,children:[x("div",{className:v.section.titleWrapper,children:[x("h2",{className:v.section.title,children:"Phone Numbers"},void 0,!1,void 0,this),Y&&x("button",{type:"button",onClick:_t,className:v.section.addButton,children:"+ Add Phone"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.phones.length===0?x("div",{className:v.section.empty.container,children:[x("svg",{className:v.section.empty.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[x("title",{children:"No phones"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 6.75c0 8.284 6.716 15 15 15h2.25a2.25 2.25 0 002.25-2.25v-1.372c0-.516-.351-.966-.852-1.091l-4.423-1.106c-.44-.11-.902.055-1.173.417l-.97 1.293c-.282.376-.769.542-1.21.38a12.035 12.035 0 01-7.143-7.143c-.162-.441.004-.928.38-1.21l1.293-.97c.363-.271.527-.734.417-1.173L6.963 3.102a1.125 1.125 0 00-1.091-.852H4.5A2.25 2.25 0 002.25 4.5v2.25z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("p",{className:v.section.empty.text,children:"No phone numbers added yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):x("div",{className:v.section.content,children:H.phones.map((W)=>x(aa,{phone:W,onEdit:Tt,onDelete:M,isUpdating:s.state.isPending,isDeleting:l.state.isPending,allowEdit:Y},W.id,!1,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("section",{className:v.section.container,children:[x("div",{className:v.section.titleWrapper,children:[x("h2",{className:v.section.title,children:"My Files"},void 0,!1,void 0,this),re&&c&&x("button",{type:"button",onClick:()=>se.current?.click(),className:v.section.addButton,children:"+ Upload File"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.files.length===0?x("div",{className:v.section.empty.container,children:[x("svg",{className:v.section.empty.icon,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[x("title",{children:"No files"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("p",{className:v.section.empty.text,children:"No files uploaded yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):x("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-3 sm:gap-4",children:H.files.map((W)=>x("div",{className:f("group relative rounded-lg overflow-hidden border border-zinc-200 dark:border-zinc-700","hover:border-zinc-300 dark:hover:border-zinc-600 transition-all",W.type==="profile_picture"&&"ring-2 ring-blue-500"),children:[Ve(W)?x("img",{src:rt(W),alt:W.originalName||W.name,className:"w-full aspect-square object-cover"},void 0,!1,void 0,this):x("div",{className:"w-full aspect-square bg-zinc-100 dark:bg-zinc-800 flex items-center justify-center",children:x("svg",{className:"w-8 h-8 text-zinc-400",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",children:[x("title",{children:"File"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),x("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-all flex items-center justify-center opacity-0 group-hover:opacity-100",children:x("div",{className:"flex gap-1",children:[Ve(W)&&H.profilePicture?.id!==W.id&&d&&x("button",{type:"button",onClick:()=>Ne(W),disabled:d.state.isPending,className:"p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md hover:bg-zinc-100 dark:hover:bg-zinc-700 transition-colors",title:"Set as profile picture",children:x("svg",{className:"w-4 h-4 text-blue-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[x("title",{children:"Set as profile"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 6a3.75 3.75 0 11-7.5 0 3.75 3.75 0 017.5 0zM4.501 20.118a7.5 7.5 0 0114.998 0A17.933 17.933 0 0112 21.75c-2.676 0-5.216-.584-7.499-1.632z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),u&&x("button",{type:"button",onClick:()=>De(W.id),disabled:u.state.isPending,className:"p-2 bg-white dark:bg-zinc-800 rounded-full shadow-md hover:bg-red-50 dark:hover:bg-red-900/30 transition-colors",title:"Delete file",children:x("svg",{className:"w-4 h-4 text-red-600",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[x("title",{children:"Delete"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),W.type==="profile_picture"&&x("div",{className:"absolute top-1 left-1 px-1.5 py-0.5 bg-blue-500 text-white text-xs rounded-full",children:"Profile"},void 0,!1,void 0,this),x("div",{className:"p-2 bg-white dark:bg-zinc-800",children:x("p",{className:"text-xs text-zinc-700 dark:text-zinc-300 truncate",children:W.originalName||W.name},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},W.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),H.roles.length>0&&x("section",{className:v.section.container,children:[x("div",{className:v.section.titleWrapper,children:x("h2",{className:v.section.title,children:"My Roles"},void 0,!1,void 0,this)},void 0,!1,void 0,this),x("div",{className:"flex flex-wrap gap-2",children:H.roles.map((W)=>x("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 border border-purple-200 dark:border-purple-800",children:[x("svg",{className:"w-3.5 h-3.5",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2","aria-hidden":"true",children:x("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75L11.25 15 15 9.75m-3-7.036A11.959 11.959 0 013.598 6 11.99 11.99 0 003 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),W.name]},W.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(E||A||_||ee)&&x("section",{className:v.section.container,children:[x("div",{className:v.section.titleWrapper,children:x("h2",{className:v.section.title,children:"Account Settings"},void 0,!1,void 0,this)},void 0,!1,void 0,this),x("div",{className:v.accountSettings.container,children:[(E||A)&&x("button",{type:"button",onClick:()=>{if(A)A();else if(E)window.location.href=E},className:v.accountSettings.item,children:[x("div",{className:v.accountSettings.content,children:[x("div",{className:f(v.accountSettings.iconWrapper,"bg-blue-100 dark:bg-blue-900/30"),children:x("svg",{className:"w-5 h-5 text-blue-600 dark:text-blue-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[x("title",{children:"Change Password"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),x("div",{children:[x("p",{className:v.accountSettings.title,children:"Change Password"},void 0,!1,void 0,this),x("p",{className:v.accountSettings.description,children:"Update your account password"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x("svg",{className:v.accountSettings.arrow,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[x("title",{children:"Go"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),(_||ee)&&x("button",{type:"button",onClick:()=>{if(ee)ee();else if(_)window.location.href=_},className:v.accountSettings.item,children:[x("div",{className:v.accountSettings.content,children:[x("div",{className:f(v.accountSettings.iconWrapper,"bg-green-100 dark:bg-green-900/30"),children:x("svg",{className:"w-5 h-5 text-green-600 dark:text-green-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[x("title",{children:"Devices"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9.75 17L9 20l-1 1h8l-1-1-.75-3M3 13h18M5 17h14a2 2 0 002-2V5a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),x("div",{children:[x("p",{className:v.accountSettings.title,children:"Active Sessions"},void 0,!1,void 0,this),x("p",{className:v.accountSettings.description,children:"Manage your logged-in devices"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x("svg",{className:v.accountSettings.arrow,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:[x("title",{children:"Go"},void 0,!1,void 0,this),x("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),ae&&x("div",{className:v.modal.overlay,onMouseDown:(W)=>{Pe.current=W.target},onClick:(W)=>{if(W.target===W.currentTarget&&Pe.current===W.target)ge(!1)},onKeyDown:(W)=>W.key==="Escape"&&ge(!1),role:"dialog","aria-modal":"true",children:x("div",{className:v.modal.container,role:"document",children:[x("h2",{className:v.modal.title,children:U?"Edit Address":"Add Address"},void 0,!1,void 0,this),x("div",{className:v.modal.form,children:[x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"addressName",className:v.profileForm.field.label,children:"Name"},void 0,!1,void 0,this),x("input",{id:"addressName",type:"text",value:Te.name||"",onChange:(W)=>we((le)=>({...le,name:W.target.value})),className:v.profileForm.field.input,placeholder:"e.g., Home, Work"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"street",className:v.profileForm.field.label,children:"Street"},void 0,!1,void 0,this),x("input",{id:"street",type:"text",value:Te.street||"",onChange:(W)=>we((le)=>({...le,street:W.target.value})),className:v.profileForm.field.input,placeholder:"Street address"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.grid,children:[x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"city",className:v.profileForm.field.label,children:"City"},void 0,!1,void 0,this),x("input",{id:"city",type:"text",value:Te.city||"",onChange:(W)=>we((le)=>({...le,city:W.target.value})),className:v.profileForm.field.input,placeholder:"City"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"state",className:v.profileForm.field.label,children:"State/Province"},void 0,!1,void 0,this),x("input",{id:"state",type:"text",value:Te.state||"",onChange:(W)=>we((le)=>({...le,state:W.target.value})),className:v.profileForm.field.input,placeholder:"State"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.grid,children:[x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"zip",className:v.profileForm.field.label,children:"ZIP Code"},void 0,!1,void 0,this),x("input",{id:"zip",type:"text",value:Te.zip||"",onChange:(W)=>we((le)=>({...le,zip:W.target.value})),className:v.profileForm.field.input,placeholder:"ZIP"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"country",className:v.profileForm.field.label,children:"Country"},void 0,!1,void 0,this),x("input",{id:"country",type:"text",value:Te.country||"",onChange:(W)=>we((le)=>({...le,country:W.target.value})),className:v.profileForm.field.input,placeholder:"Country"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.modal.actions,children:[x(V,{variant:"outline",size:"sm",onClick:()=>ge(!1),children:"Cancel"},void 0,!1,void 0,this),x(V,{variant:"primary",size:"sm",onClick:U?J:me,disabled:n.state.isPending||a.state.isPending,children:n.state.isPending||a.state.isPending?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ye&&x("div",{className:v.modal.overlay,onMouseDown:(W)=>{Pe.current=W.target},onClick:(W)=>{if(W.target===W.currentTarget&&Pe.current===W.target)Ie(!1)},onKeyDown:(W)=>W.key==="Escape"&&Ie(!1),role:"dialog","aria-modal":"true",children:x("div",{className:v.modal.container,role:"document",children:[x("h2",{className:v.modal.title,children:de?"Edit Phone":"Add Phone"},void 0,!1,void 0,this),x("div",{className:v.modal.form,children:[x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"phoneName",className:v.profileForm.field.label,children:"Name"},void 0,!1,void 0,this),x("input",{id:"phoneName",type:"text",value:be.name||"",onChange:(W)=>P((le)=>({...le,name:W.target.value})),className:v.profileForm.field.input,placeholder:"e.g., Mobile, Work"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"phoneType",className:v.profileForm.field.label,children:"Type"},void 0,!1,void 0,this),x("select",{id:"phoneType",value:be.type||"",onChange:(W)=>{let le=W.target.value;P((qe)=>({...qe,type:le||void 0}))},className:v.profileForm.field.input,children:[x("option",{value:"",children:"Select type"},void 0,!1,void 0,this),x("option",{value:"mobile",children:"Mobile"},void 0,!1,void 0,this),x("option",{value:"office",children:"Office"},void 0,!1,void 0,this),x("option",{value:"fax",children:"Fax"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.grid,children:[x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"countryCode",className:v.profileForm.field.label,children:"Country Code"},void 0,!1,void 0,this),x("input",{id:"countryCode",type:"text",value:be.countryCode||"+1",onChange:(W)=>P((le)=>({...le,countryCode:W.target.value})),className:v.profileForm.field.input,placeholder:"+1"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"phoneNumber",className:v.profileForm.field.label,children:"Number"},void 0,!1,void 0,this),x("input",{id:"phoneNumber",type:"tel",value:be.number||"",onChange:(W)=>P((le)=>({...le,number:W.target.value})),className:v.profileForm.field.input,placeholder:"Phone number"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.profileForm.field.container,children:[x("label",{htmlFor:"extension",className:v.profileForm.field.label,children:"Extension (optional)"},void 0,!1,void 0,this),x("input",{id:"extension",type:"text",value:be.extension||"",onChange:(W)=>P((le)=>({...le,extension:W.target.value})),className:v.profileForm.field.input,placeholder:"Extension"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),x("div",{className:v.modal.actions,children:[x(V,{variant:"outline",size:"sm",onClick:()=>Ie(!1),children:"Cancel"},void 0,!1,void 0,this),x(V,{variant:"primary",size:"sm",onClick:de?We:D,disabled:o.state.isPending||s.state.isPending,children:o.state.isPending||s.state.isPending?"Saving...":"Save"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var nr={container:{base:"relative min-h-screen w-full flex items-center justify-center py-8 sm:py-12",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center"},form:{container:"w-full",spacing:"space-y-4",row:"grid grid-cols-1 sm:grid-cols-2 gap-4"},input:{wrapper:"w-full"},checkbox:{wrapper:"flex items-start",label:"ml-2 text-sm text-zinc-600 dark:text-zinc-400 select-none cursor-pointer leading-tight"},links:{container:"flex items-center justify-between mt-1",terms:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors cursor-pointer",signIn:{wrapper:"mt-6 text-center",text:"text-sm text-zinc-600 dark:text-zinc-400",link:"text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer"}},button:{wrapper:"mt-6"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},passwordStrength:{container:"mt-2",bar:{wrapper:"flex gap-1",segment:"h-1 flex-1 rounded-full transition-colors duration-300",active:{weak:"bg-red-500",fair:"bg-orange-500",good:"bg-yellow-500",strong:"bg-lime-500",veryStrong:"bg-green-500"},inactive:"bg-zinc-200 dark:bg-zinc-700"},requirements:{container:"mt-3 space-y-1",item:"flex items-center gap-2 text-xs transition-colors duration-200",met:"text-green-600 dark:text-green-400",unmet:"text-zinc-400 dark:text-zinc-500",icon:{met:"text-green-500",unmet:"text-zinc-300 dark:text-zinc-600"}}},divider:{container:"relative my-6",line:"absolute inset-0 flex items-center",text:"relative flex justify-center text-sm"}};import{jsxDEV as Wt}from"react/jsx-dev-runtime";var _0=()=>Wt("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:Wt("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this),J0=()=>Wt("svg",{className:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:Wt("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this);function la({strength:e,showRequirements:t=!0,passwordMinLength:r=8,requireUppercase:n=!0,requireLowercase:a=!0,requireNumber:i=!0,requireSpecialChar:o=!0}){let s=nr.passwordStrength,l=(d)=>{if(d>=e.score)return s.bar.inactive;if(e.score===1)return s.bar.active.weak;if(e.score===2)return s.bar.active.fair;if(e.score===3)return s.bar.active.good;if(e.score===4)return s.bar.active.strong;return s.bar.active.veryStrong},c=[{key:"minLength",label:`At least ${r} characters`,met:e.hasMinLength,show:!0},{key:"uppercase",label:"One uppercase letter",met:e.hasUppercase,show:n},{key:"lowercase",label:"One lowercase letter",met:e.hasLowercase,show:a},{key:"number",label:"One number",met:e.hasNumber,show:i},{key:"special",label:"One special character",met:e.hasSpecialChar,show:o}].filter((d)=>d.show);return Wt("div",{className:s.container,children:[Wt("div",{className:s.bar.wrapper,role:"progressbar","aria-valuenow":e.score,"aria-valuemin":0,"aria-valuemax":5,"aria-label":"Password strength",children:[0,1,2,3,4].map((d)=>Wt("div",{className:f(s.bar.segment,l(d))},d,!1,void 0,this))},void 0,!1,void 0,this),t&&Wt("ul",{className:s.requirements.container,"aria-label":"Password requirements",children:c.map((d)=>Wt("li",{className:f(s.requirements.item,d.met?s.requirements.met:s.requirements.unmet),children:[Wt("span",{className:d.met?s.requirements.icon.met:s.requirements.icon.unmet,children:d.met?Wt(_0,{},void 0,!1,void 0,this):Wt(J0,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Wt("span",{children:d.label},void 0,!1,void 0,this)]},d.key,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ul}from"@gsap/react";import Ui from"gsap";import{useRef as E0}from"react";import{batch as K0,createStore as Q0}from"h-state";var Z0=(e,t=8)=>{let r=e.length>=t,n=/[A-Z]/.test(e),a=/[a-z]/.test(e),i=/[0-9]/.test(e),o=/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(e),s=0;if(r)s+=1;if(n)s+=1;if(a)s+=1;if(i)s+=1;if(o)s+=1;return{score:s,hasMinLength:r,hasUppercase:n,hasLowercase:a,hasNumber:i,hasSpecialChar:o}},X0={email:"",password:"",confirmPassword:"",firstName:"",lastName:"",acceptTerms:!1,isLoading:!1,error:null,passwordStrength:{score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}},{useStore:da}=Q0(X0,{setEmail:(e)=>(t)=>{if(e.email=t,e.error)e.error=null},setPassword:(e)=>(t,r=8)=>{if(e.password=t,e.passwordStrength=Z0(t,r),e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setFirstName:(e)=>(t)=>{if(e.firstName=t,e.error)e.error=null},setLastName:(e)=>(t)=>{if(e.lastName=t,e.error)e.error=null},setAcceptTerms:(e)=>(t)=>{if(e.acceptTerms=t,e.error)e.error=null},setLoading:(e)=>(t)=>{e.isLoading=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{K0(()=>{e.email="",e.password="",e.confirmPassword="",e.firstName="",e.lastName="",e.acceptTerms=!1,e.isLoading=!1,e.error=null,e.passwordStrength={score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}})}});import{jsxDEV as Ze,Fragment as D0}from"react/jsx-dev-runtime";Ui.registerPlugin(Ul);function Bi({registerAction:e,showFirstName:t=!1,showLastName:r=!1,showTerms:n=!0,showSignIn:a=!0,termsHref:i,privacyHref:o,signInHref:s,onTermsClick:l,onPrivacyClick:c,onSignIn:d,onSuccess:u,passwordMinLength:w=8,requireUppercase:g=!0,requireLowercase:m=!0,requireNumber:S=!0,requireSpecialChar:b=!1,createProfileOnRegister:z=!1}){let k=nr,R=E0(null),p=da(),{contextSafe:T}=Ul({scope:R}),y=e.state.isPending,N=()=>{if(!p.email)return"Email is required";if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(p.email))return"Please enter a valid email address";if(!p.password)return"Password is required";if(p.password.length<w)return`Password must be at least ${w} characters`;if(g&&!p.passwordStrength.hasUppercase)return"Password must contain at least one uppercase letter";if(m&&!p.passwordStrength.hasLowercase)return"Password must contain at least one lowercase letter";if(S&&!p.passwordStrength.hasNumber)return"Password must contain at least one number";if(b&&!p.passwordStrength.hasSpecialChar)return"Password must contain at least one special character";if(!p.confirmPassword)return"Please confirm your password";if(p.password!==p.confirmPassword)return"Passwords do not match";if(n&&!p.acceptTerms)return"You must accept the terms and conditions";return null},L=T((E)=>{E.preventDefault();let _=N();if(_){p.setError(_),O();return}p.setError(null),e.start({payload:{email:p.email,password:p.password,...t&&p.firstName?{firstName:p.firstName}:{},...r&&p.lastName?{lastName:p.lastName}:{},...z?{createProfile:!0}:{}},onAfterHandle:()=>{p.reset(),u?.()},onErrorHandle:(A)=>{let ee="Registration failed. Please try again.";if(A&&typeof A==="object"){if("message"in A&&typeof A.message==="string")try{let v=JSON.parse(A.message);ee=v.message||v.error||A.message}catch{ee=A.message}else if("error"in A&&typeof A.error==="string")ee=A.error}else if(A instanceof Error)ee=A.message;p.setError(ee),O()}})}),O=T(()=>{if(!R.current)return;Ui.fromTo(R.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{Ui.set(R.current,{x:0})}})}),F=()=>{if(l)l();else if(i)window.location.href=i},Y=()=>{if(c)c();else if(o)window.location.href=o},re=()=>{if(d)d();else if(s)window.location.href=s};return Ze("form",{ref:R,onSubmit:L,className:k.form.container,noValidate:!0,children:[p.error&&Ze("div",{className:k.error.container,role:"alert",children:Ze("p",{className:k.error.text,children:p.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ze("div",{className:k.form.spacing,children:[(t||r)&&Ze("div",{className:k.form.row,children:[t&&Ze("div",{className:k.input.wrapper,children:Ze(Fe,{type:"text",label:"First Name",placeholder:"John",value:p.firstName,onChange:p.setFirstName,disabled:y,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),r&&Ze("div",{className:k.input.wrapper,children:Ze(Fe,{type:"text",label:"Last Name",placeholder:"Doe",value:p.lastName,onChange:p.setLastName,disabled:y,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ze("div",{className:k.input.wrapper,children:Ze(Fe,{type:"email",label:"Email",placeholder:"you@example.com",value:p.email,onChange:p.setEmail,disabled:y,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ze("div",{className:k.input.wrapper,children:[Ze(Fe,{type:"password",label:"Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:p.password,onChange:(E)=>p.setPassword(E,w),disabled:y,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this),p.password&&Ze(la,{strength:p.passwordStrength,passwordMinLength:w,requireUppercase:g,requireLowercase:m,requireNumber:S,requireSpecialChar:b},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ze("div",{className:k.input.wrapper,children:Ze(Fe,{type:"password",label:"Confirm Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:p.confirmPassword,onChange:p.setConfirmPassword,disabled:y,enableValidation:!1,fullWidth:!0,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),n&&Ze("div",{className:k.checkbox.wrapper,children:[Ze(Dt,{checked:p.acceptTerms,onChange:p.setAcceptTerms,disabled:y,size:"sm"},void 0,!1,void 0,this),Ze("span",{className:k.checkbox.label,children:["I agree to the"," ",Ze("button",{type:"button",onClick:F,className:k.links.terms,children:"Terms of Service"},void 0,!1,void 0,this),(o||c)&&Ze(D0,{children:[" ","and"," ",Ze("button",{type:"button",onClick:Y,className:k.links.terms,children:"Privacy Policy"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ze("div",{className:k.button.wrapper,children:Ze(V,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:y,disabled:y,children:"Create Account"},void 0,!1,void 0,this)},void 0,!1,void 0,this),a&&Ze("div",{className:k.links.signIn.wrapper,children:Ze("span",{className:k.links.signIn.text,children:["Already have an account?"," ",Ze("button",{type:"button",onClick:re,className:k.links.signIn.link,disabled:y,children:"Sign in"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as ca}from"react/jsx-dev-runtime";function Ai({logo:e,title:t="Create Account",subtitle:r="Sign up to get started"}){let n=nr;return ca("header",{className:n.header.container,children:[e&&ca("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this),ca("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),r&&ca("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Al}from"@gsap/react";import Ol from"gsap";import{useRef as Bl}from"react";import{jsxDEV as qr}from"react/jsx-dev-runtime";Ol.registerPlugin(Al);function $l({variant:e="default",logo:t,title:r="Create Account",subtitle:n="Sign up to get started with your account",showFirstName:a,showLastName:i,showTerms:o=!0,showSignIn:s=!0,termsHref:l,privacyHref:c,signInHref:d,registerAction:u,onTermsClick:w,onPrivacyClick:g,onSignIn:m,onSuccess:S,showBackground:b=!0,className:z,passwordMinLength:k,requireUppercase:R,requireLowercase:p,requireNumber:T,requireSpecialChar:y,config:N}){let L=N?.register?.showFirstName??a??!1,O=N?.register?.showLastName??i??!1,F=N?.register?.termsUrl??l,Y=N?.register?.privacyUrl??c,re=N?.passwordPolicy?.minLength??k??8,E=N?.passwordPolicy?.requireUppercase??R??!0,_=N?.passwordPolicy?.requireLowercase??p??!0,A=N?.passwordPolicy?.requireNumber??T??!0,ee=N?.passwordPolicy?.requireSpecialChar??y??!1,v=N?.register?.createProfileOnRegister??(L||O),G=nr,K=Bl(null),se=Bl(null);return Al(()=>{if(!se.current)return;Ol.fromTo(se.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:K}),qr("main",{ref:K,className:f(G.container.base,z),"aria-label":"Registration page",children:[b&&qr(lt,{},void 0,!1,void 0,this),qr("div",{className:G.container.wrapper,children:qr("article",{ref:se,className:f(G.card.base,G.card.padding,G.card.background,G.card.border,G.card.shadow,G.card.rounded),children:[qr(Ai,{logo:t,title:r,subtitle:n},void 0,!1,void 0,this),qr(Bi,{registerAction:u,showFirstName:L,showLastName:O,showTerms:o,showSignIn:s,termsHref:F,privacyHref:Y,signInHref:d,onTermsClick:w,onPrivacyClick:g,onSignIn:m,onSuccess:S,passwordMinLength:re,requireUppercase:E,requireLowercase:_,requireNumber:A,requireSpecialChar:ee,createProfileOnRegister:v},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Oi}from"@gsap/react";import pa from"gsap";import{useMemo as tu,useRef as Fl}from"react";var _r={minLength:8,maxLength:128,requireUppercase:!0,requireLowercase:!0,requireNumber:!0,requireSpecialChar:!1,specialChars:"!@#$%^&*()_+-=[]{}|;:,.<>?",preventCommonPasswords:!0,preventUserInfoInPassword:!0,showStrengthIndicator:!0};import{batch as V0,createStore as j0}from"h-state";var eu={newPassword:"",confirmPassword:"",step:"form",error:null},{useStore:ua}=j0(eu,{setNewPassword:(e)=>(t)=>{if(e.newPassword=t,e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},reset:(e)=>()=>{V0(()=>{e.newPassword="",e.confirmPassword="",e.step="form",e.error=null})}});var Lr={container:{base:"relative min-h-screen w-full flex items-center justify-center",wrapper:"relative z-10 w-full max-w-md px-4 sm:px-0"},card:{base:"w-full",padding:"p-6 sm:p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl shadow-black/10 dark:shadow-black/30",rounded:"rounded-2xl sm:rounded-3xl"},header:{container:"flex flex-col items-center mb-8",logoWrapper:"mb-4",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-blue-100 dark:bg-blue-900/30 flex items-center justify-center",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white text-center",subtitle:"mt-2 text-sm sm:text-base text-zinc-600 dark:text-zinc-400 text-center max-w-sm"},form:{container:"w-full",spacing:"space-y-4"},input:{wrapper:"w-full"},button:{wrapper:"mt-6"},links:{container:"mt-6 text-center",backToLogin:"text-sm text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-medium transition-colors cursor-pointer inline-flex items-center gap-1"},error:{container:"mb-4 p-3 rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800",text:"text-sm text-red-600 dark:text-red-400 text-center"},success:{container:"flex flex-col items-center text-center",iconWrapper:"mb-4 w-16 h-16 rounded-full bg-green-100 dark:bg-green-900/30 flex items-center justify-center",title:"text-xl font-semibold text-zinc-900 dark:text-white mb-2",message:"text-sm text-zinc-600 dark:text-zinc-400 max-w-sm"},requirements:{container:"mt-3 p-3 rounded-lg bg-zinc-50 dark:bg-zinc-800/50",title:"text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-2",list:"space-y-1",item:"text-xs flex items-center gap-2",itemValid:"text-green-600 dark:text-green-400",itemInvalid:"text-zinc-400 dark:text-zinc-500"}};import{jsxDEV as Ce}from"react/jsx-dev-runtime";pa.registerPlugin(Oi);function Gl({className:e}){return Ce("svg",{className:f("w-4 h-4",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ce("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 19l-7-7m0 0l7-7m-7 7h18"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function ru({className:e}){return Ce("svg",{className:f("w-8 h-8 text-green-600 dark:text-green-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ce("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function nu({className:e}){return Ce("svg",{className:f("w-3 h-3",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ce("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function au({className:e}){return Ce("svg",{className:f("w-3 h-3",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ce("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function $i({token:e,resetPasswordAction:t,onBackToLogin:r,backToLoginHref:n,passwordPolicy:a={}}){let i=Lr,o=Fl(null),s=Fl(null),l=ua(),c={..._r,...a},d=tu(()=>{let b=[{key:"length",label:`At least ${c.minLength} characters`,test:(z)=>z.length>=c.minLength}];if(c.requireUppercase)b.push({key:"uppercase",label:"One uppercase letter",test:(z)=>/[A-Z]/.test(z)});if(c.requireLowercase)b.push({key:"lowercase",label:"One lowercase letter",test:(z)=>/[a-z]/.test(z)});if(c.requireNumber)b.push({key:"number",label:"One number",test:(z)=>/\d/.test(z)});if(c.requireSpecialChar)b.push({key:"special",label:"One special character",test:(z)=>{let k=c.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");return new RegExp(`[${k}]`).test(z)}});return b},[c.minLength,c.requireUppercase,c.requireLowercase,c.requireNumber,c.requireSpecialChar,c.specialChars]),{contextSafe:u}=Oi({scope:o}),w=t.state.isPending,g=u((b)=>{if(b.preventDefault(),!l.newPassword||!l.confirmPassword){l.setError("Please fill in all fields"),m();return}if(l.newPassword!==l.confirmPassword){l.setError("Passwords do not match"),m();return}if(!d.every((k)=>k.test(l.newPassword))){l.setError("Password does not meet all requirements"),m();return}l.setError(null),t.start({payload:{token:e,newPassword:l.newPassword,confirmPassword:l.confirmPassword},onAfterHandle:()=>{l.setStep("success")},onErrorHandle:(k)=>{let R=k instanceof Error?k.message:"Failed to reset password. Please try again.";l.setError(R),m()}})}),m=u(()=>{if(!o.current)return;pa.fromTo(o.current,{x:-10},{x:10,duration:0.08,repeat:5,yoyo:!0,ease:"power2.inOut",onComplete:()=>{pa.set(o.current,{x:0})}})});Oi(()=>{if(l.step==="success"&&s.current)pa.fromTo(s.current,{opacity:0,scale:0.9},{opacity:1,scale:1,duration:0.4,ease:"back.out(1.7)"})},{dependencies:[l.step]});let S=()=>{if(r)r();else if(n)window.location.href=n};if(l.step==="success")return Ce("div",{ref:s,className:i.success.container,children:[Ce("div",{className:i.success.iconWrapper,children:Ce(ru,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ce("h2",{className:i.success.title,children:"Password Reset Successful"},void 0,!1,void 0,this),Ce("p",{className:i.success.message,children:"Your password has been successfully reset. You can now log in with your new password."},void 0,!1,void 0,this),Ce("div",{className:i.links.container,children:Ce("button",{type:"button",onClick:S,className:i.links.backToLogin,children:[Ce(Gl,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return Ce("form",{ref:o,onSubmit:g,className:i.form.container,noValidate:!0,children:[l.error&&Ce("div",{className:i.error.container,role:"alert",children:Ce("p",{className:i.error.text,children:l.error},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ce("div",{className:i.form.spacing,children:[Ce("div",{className:i.input.wrapper,children:Ce(Fe,{type:"password",label:"New Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:l.newPassword,onChange:l.setNewPassword,disabled:w,enableValidation:!1,isNewPassword:!0,showPasswordStrength:c.showStrengthIndicator,maxInputLength:c.maxLength,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ce("div",{className:i.input.wrapper,children:Ce(Fe,{type:"password",label:"Confirm Password",placeholder:"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",value:l.confirmPassword,onChange:l.setConfirmPassword,disabled:w,enableValidation:!1,isNewPassword:!0,confirmValue:l.newPassword,fullWidth:!0,showTypeIcon:!1,wrapperClassName:"!bg-transparent border-zinc-300 dark:border-zinc-600",inputClassName:"placeholder:text-zinc-400 dark:placeholder:text-zinc-500 !bg-transparent"},void 0,!1,void 0,this)},void 0,!1,void 0,this),l.newPassword&&Ce("div",{className:i.requirements.container,children:[Ce("p",{className:i.requirements.title,children:"Password requirements:"},void 0,!1,void 0,this),Ce("ul",{className:i.requirements.list,children:d.map((b)=>{let z=b.test(l.newPassword);return Ce("li",{className:f(i.requirements.item,z?i.requirements.itemValid:i.requirements.itemInvalid),children:[z?Ce(nu,{},void 0,!1,void 0,this):Ce(au,{},void 0,!1,void 0,this),b.label]},b.key,!0,void 0,this)})},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ce("div",{className:i.button.wrapper,children:Ce(V,{type:"submit",variant:"nucleus",size:"lg",fullWidth:!0,loading:w,disabled:w,children:"Reset Password"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ce("div",{className:i.links.container,children:Ce("button",{type:"button",onClick:S,className:i.links.backToLogin,disabled:w,children:[Ce(Gl,{},void 0,!1,void 0,this),"Back to login"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as cr}from"react/jsx-dev-runtime";function iu({className:e}){return cr("svg",{className:f("w-8 h-8 text-blue-600 dark:text-blue-400",e),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:cr("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}function Fi({logo:e,title:t,subtitle:r}){let n=Lr;return cr("header",{className:n.header.container,children:[e?cr("div",{className:n.header.logoWrapper,children:e},void 0,!1,void 0,this):cr("div",{className:n.header.iconWrapper,children:cr(iu,{},void 0,!1,void 0,this)},void 0,!1,void 0,this),cr("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),cr("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as ql}from"@gsap/react";import _l from"gsap";import{useRef as Yl}from"react";import{jsxDEV as Jr}from"react/jsx-dev-runtime";_l.registerPlugin(ql);function Jl({logo:e,title:t="Reset Password",subtitle:r="Enter your new password below.",token:n,resetPasswordAction:a,onBackToLogin:i,backToLoginHref:o,showBackground:s=!0,className:l,passwordPolicy:c}){let d=Lr,u=Yl(null),w=Yl(null);return ql(()=>{if(!w.current)return;_l.fromTo(w.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:u}),Jr("main",{ref:u,className:f(d.container.base,l),"aria-label":"Reset password page",children:[s&&Jr(lt,{},void 0,!1,void 0,this),Jr("div",{className:d.container.wrapper,children:Jr("article",{ref:w,className:f(d.card.base,d.card.padding,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:[Jr(Fi,{logo:e,title:t,subtitle:r},void 0,!1,void 0,this),Jr($i,{token:n,resetPasswordAction:a,onBackToLogin:i,backToLoginHref:o,passwordPolicy:c},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}var ur={container:{base:"min-h-screen flex items-center justify-center bg-gradient-to-br from-zinc-50 via-zinc-100 to-zinc-200 dark:from-zinc-900 dark:via-zinc-900 dark:to-zinc-800 px-4 sm:px-6 lg:px-8",wrapper:"w-full max-w-md relative z-10"},card:{base:"relative overflow-hidden",padding:"p-6 sm:p-8 lg:p-10",background:"bg-white dark:bg-zinc-800",border:"border border-zinc-200 dark:border-zinc-700",shadow:"shadow-xl",rounded:"rounded-2xl"},header:{wrapper:"text-center mb-6 sm:mb-8",logo:"mx-auto mb-4 sm:mb-6",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-2 sm:mb-3",subtitle:"text-sm sm:text-base text-zinc-600 dark:text-zinc-400"},form:{wrapper:"space-y-4 sm:space-y-5",inputGroup:"space-y-1",label:"block text-sm font-medium text-zinc-700 dark:text-zinc-300",input:"w-full px-3 sm:px-4 py-2 sm:py-3 border border-zinc-300 dark:border-zinc-600 rounded-xl bg-white dark:bg-zinc-700 text-zinc-900 dark:text-white placeholder-zinc-400 dark:placeholder-zinc-500 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent transition-all duration-200",error:"text-sm text-red-500 dark:text-red-400 mt-1",submitButton:"w-full py-2.5 sm:py-3 px-4 bg-blue-600 hover:bg-blue-700 disabled:bg-blue-400 text-white font-medium rounded-xl transition-colors duration-200 shadow-sm hover:shadow-md",backLink:"w-full mt-3 sm:mt-4 text-center",backLinkText:"text-sm text-blue-600 dark:text-blue-400 hover:underline cursor-pointer"},alert:{error:"mb-4 p-3 sm:p-4 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-xl text-red-600 dark:text-red-400 text-sm",success:"text-center"},states:{verifying:{wrapper:"text-center py-8",iconWrapper:"mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-blue-100 dark:bg-blue-900/30 rounded-full flex items-center justify-center mb-6",spinner:"animate-spin rounded-full h-8 w-8 sm:h-10 sm:w-10 border-3 border-blue-600 border-t-transparent",title:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-white mb-3",subtitle:"text-zinc-600 dark:text-zinc-400 text-sm sm:text-base"},error:{iconWrapper:"mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 sm:w-10 sm:h-10 text-red-500 dark:text-red-400",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-3",subtitle:"text-zinc-600 dark:text-zinc-400 mb-2 text-sm sm:text-base",errorMessage:"text-red-500 dark:text-red-400 text-sm mb-4 px-4 py-2 bg-red-50 dark:bg-red-900/20 rounded-lg",helpText:"text-zinc-500 dark:text-zinc-500 text-sm mb-8",buttonPrimary:"w-full py-3 px-4 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-xl transition-colors duration-200 shadow-sm hover:shadow-md",buttonSecondary:"w-full py-3 px-4 bg-zinc-100 dark:bg-zinc-700 hover:bg-zinc-200 dark:hover:bg-zinc-600 text-zinc-700 dark:text-zinc-300 font-medium rounded-xl transition-colors duration-200"},success:{iconWrapper:"mx-auto w-16 h-16 sm:w-20 sm:h-20 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 sm:w-10 sm:h-10 text-green-500 dark:text-green-400",title:"text-2xl sm:text-3xl font-bold text-zinc-900 dark:text-white mb-3",subtitle:"text-zinc-600 dark:text-zinc-400 text-sm sm:text-base mb-6",redirectSpinner:"animate-spin rounded-full h-4 w-4 border-2 border-zinc-400 border-t-transparent",redirectText:"text-zinc-500 dark:text-zinc-400 text-sm"}},footer:"text-center text-zinc-500 dark:text-zinc-500 text-xs mt-6",layout:{textCenter:"text-center",buttonGroup:"space-y-3",redirectWrapper:"flex items-center justify-center gap-2"},passwordStrength:{container:"mt-3 space-y-3",bar:{wrapper:"flex gap-1",segment:"h-1 flex-1 rounded-full transition-colors duration-200",inactive:"bg-zinc-200 dark:bg-zinc-700",active:{weak:"bg-red-500",fair:"bg-orange-500",good:"bg-yellow-500",strong:"bg-green-500",veryStrong:"bg-emerald-500"}},requirements:{container:"space-y-1",item:"flex items-center gap-2 text-xs transition-colors duration-200",met:"text-green-600 dark:text-green-400",unmet:"text-zinc-400 dark:text-zinc-500",icon:{met:"text-green-600 dark:text-green-400",unmet:"text-zinc-400 dark:text-zinc-500"}}}};import{jsxDEV as b5}from"react/jsx-dev-runtime";import{batch as ou,createStore as su}from"h-state";var lu=(e,t=8)=>{let r=e.length>=t,n=/[A-Z]/.test(e),a=/[a-z]/.test(e),i=/[0-9]/.test(e),o=/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(e),s=0;if(r)s+=1;if(n)s+=1;if(a)s+=1;if(i)s+=1;if(o)s+=1;return{score:s,hasMinLength:r,hasUppercase:n,hasLowercase:a,hasNumber:i,hasSpecialChar:o}},du={newPassword:"",confirmPassword:"",step:"verifying",error:null,userId:null,passwordStrength:{score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}},{useStore:Kr}=su(du,{setNewPassword:(e)=>(t,r=8)=>{if(e.newPassword=t,e.passwordStrength=lu(t,r),e.error)e.error=null},setConfirmPassword:(e)=>(t)=>{if(e.confirmPassword=t,e.error)e.error=null},setStep:(e)=>(t)=>{e.step=t},setError:(e)=>(t)=>{e.error=t},setUserId:(e)=>(t)=>{e.userId=t},reset:(e)=>()=>{ou(()=>{e.newPassword="",e.confirmPassword="",e.step="verifying",e.error=null,e.userId=null,e.passwordStrength={score:0,hasMinLength:!1,hasUppercase:!1,hasLowercase:!1,hasNumber:!1,hasSpecialChar:!1}})}});import{jsxDEV as pr}from"react/jsx-dev-runtime";function Gi({passwordChangeAction:e,passwordSetAction:t,isInvite:r=!1,onSuccess:n,onBackToLogin:a,backToLoginHref:i,passwordPolicy:o={}}){let s=ur,l=Kr(),c={..._r,...o},d=r&&t?t:e,u=()=>{if(!l.newPassword)return"Password is required";if(l.newPassword.length<c.minLength)return`Password must be at least ${c.minLength} characters`;if(c.maxLength&&l.newPassword.length>c.maxLength)return`Password must be at most ${c.maxLength} characters`;if(c.requireUppercase&&!/[A-Z]/.test(l.newPassword))return"Password must contain at least one uppercase letter";if(c.requireLowercase&&!/[a-z]/.test(l.newPassword))return"Password must contain at least one lowercase letter";if(c.requireNumber&&!/[0-9]/.test(l.newPassword))return"Password must contain at least one number";if(c.requireSpecialChar){if(!new RegExp(`[${c.specialChars.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&")}]`).test(l.newPassword))return"Password must contain at least one special character"}if(!l.confirmPassword)return"Please confirm your password";if(l.newPassword!==l.confirmPassword)return"Passwords do not match";return null};return pr("form",{onSubmit:(g)=>{g.preventDefault();let m=u();if(m){l.setError(m);return}if(l.setError(null),!d){l.setError("No action configured");return}let S=()=>{if(l.setStep("success"),n)setTimeout(n,2000);else if(a)setTimeout(a,2000)},b=(z)=>{l.setError(z?.message||"Failed to set password")};if(r&&t&&l.userId)t.start({payload:{newPassword:l.newPassword,userId:l.userId},onAfterHandle:S,onErrorHandle:b});else if(e)e.start({payload:{currentPassword:"",newPassword:l.newPassword},onAfterHandle:S,onErrorHandle:b})},className:s.form.wrapper,children:[l.error&&pr("div",{className:s.alert.error,role:"alert",children:l.error},void 0,!1,void 0,this),pr(Fe,{type:"password",label:"New Password",value:l.newPassword,onChange:(g)=>l.setNewPassword(g,c.minLength),placeholder:"Enter your new password",isNewPassword:!0,showPasswordStrength:c.showStrengthIndicator,maxInputLength:c.maxLength,enableValidation:!1},void 0,!1,void 0,this),pr(Fe,{type:"password",label:"Confirm Password",value:l.confirmPassword,onChange:l.setConfirmPassword,placeholder:"Confirm your new password",isNewPassword:!0,confirmValue:l.newPassword,enableValidation:!1},void 0,!1,void 0,this),pr("button",{type:"submit",disabled:d?.state.isPending,className:s.form.submitButton,children:d?.state.isPending?"Setting Password...":"Set Password"},void 0,!1,void 0,this),pr("div",{className:s.form.backLink,children:i?pr("a",{href:i,className:s.form.backLinkText,children:"Back to login"},void 0,!1,void 0,this):a?pr("button",{type:"button",onClick:a,className:s.form.backLinkText,children:"Back to login"},void 0,!1,void 0,this):null},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as ma}from"react/jsx-dev-runtime";function Yi({logo:e,title:t,subtitle:r}){let n=ur;return ma("header",{className:n.header.wrapper,children:[e&&ma("div",{className:n.header.logo,children:e},void 0,!1,void 0,this),ma("h1",{className:n.header.title,children:t},void 0,!1,void 0,this),ma("p",{className:n.header.subtitle,children:r},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as Ql}from"@gsap/react";import Zl from"gsap";import{useEffect as cu,useEffectEvent as uu,useRef as Kl}from"react";import{jsxDEV as he}from"react/jsx-dev-runtime";Zl.registerPlugin(Ql);function Xl({logo:e,title:t="Set Password",subtitle:r="Enter your new password below.",inviteTitle:n="Set Your Password",inviteSubtitle:a="Welcome! Please set your password to complete your account setup.",token:i,isInvite:o=!1,magicLinkVerifyAction:s,passwordChangeAction:l,passwordSetAction:c,onBackToLogin:d,onSuccess:u,backToLoginHref:w,showBackground:g=!0,className:m,passwordPolicy:S}){let b=ur,z=Kl(null),k=Kl(null),R=Kr(),p=uu((N)=>{if(!N){R.setStep("error"),R.setError("Invalid or missing token");return}s.start({payload:{token:N},onAfterHandle:(L)=>{let F=L?.data?.user?.id;if(F)R.setUserId(F);R.setStep("form")},onErrorHandle:(L)=>{R.setStep("error"),R.setError(L?.message||"Token verification failed")}})});cu(()=>{return p(i),()=>{R.reset()}},[i]),Ql(()=>{if(!k.current)return;Zl.fromTo(k.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:z});let T=o?n:t,y=o?a:r;if(R.step==="verifying")return he("main",{ref:z,className:f(b.container.base,m),children:[g&&he(lt,{},void 0,!1,void 0,this),he("div",{className:b.container.wrapper,children:he("article",{ref:k,className:f(b.card.base,b.card.padding,b.card.background,b.card.border,b.card.shadow,b.card.rounded),children:he("div",{className:b.states.verifying.wrapper,children:[he("div",{className:b.states.verifying.iconWrapper,children:he("div",{className:b.states.verifying.spinner},void 0,!1,void 0,this)},void 0,!1,void 0,this),he("h1",{className:b.states.verifying.title,children:"Verifying Invitation"},void 0,!1,void 0,this),he("p",{className:b.states.verifying.subtitle,children:"Please wait while we verify your invitation link..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(R.step==="error")return he("main",{ref:z,className:f(b.container.base,m),children:[g&&he(lt,{},void 0,!1,void 0,this),he("div",{className:b.container.wrapper,children:he("article",{ref:k,className:f(b.card.base,b.card.padding,b.card.background,b.card.border,b.card.shadow,b.card.rounded),children:[he("div",{className:b.layout.textCenter,children:[he("div",{className:b.states.error.iconWrapper,children:he("svg",{className:b.states.error.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:he("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),he("h1",{className:b.states.error.title,children:"Invalid Link"},void 0,!1,void 0,this),he("p",{className:b.states.error.subtitle,children:o?"This invitation link is invalid or has expired.":"This link is invalid or has expired."},void 0,!1,void 0,this),R.error&&R.error!=="Token verification failed"&&he("p",{className:b.states.error.errorMessage,children:R.error},void 0,!1,void 0,this),he("p",{className:b.states.error.helpText,children:o?"Please contact your administrator to request a new invitation.":"Please request a new link or contact support."},void 0,!1,void 0,this),he("div",{className:b.layout.buttonGroup,children:w?he("a",{href:w,className:b.states.error.buttonPrimary,children:"Go to Login"},void 0,!1,void 0,this):he("button",{type:"button",onClick:d,className:b.states.error.buttonPrimary,children:"Go to Login"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),he("p",{className:b.footer,children:"Need help? Contact your system administrator."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);if(R.step==="success")return he("main",{ref:z,className:f(b.container.base,m),children:[g&&he(lt,{},void 0,!1,void 0,this),he("div",{className:b.container.wrapper,children:he("article",{ref:k,className:f(b.card.base,b.card.padding,b.card.background,b.card.border,b.card.shadow,b.card.rounded),children:he("div",{className:b.layout.textCenter,children:[he("div",{className:b.states.success.iconWrapper,children:he("svg",{className:b.states.success.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:he("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),he("h1",{className:b.states.success.title,children:"Password Set Successfully!"},void 0,!1,void 0,this),he("p",{className:b.states.success.subtitle,children:"Your account is now ready. Redirecting you to login..."},void 0,!1,void 0,this),he("div",{className:b.layout.redirectWrapper,children:[he("div",{className:b.states.success.redirectSpinner},void 0,!1,void 0,this),he("span",{className:b.states.success.redirectText,children:"Redirecting..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this);return he("main",{ref:z,className:f(b.container.base,m),"aria-label":"Set password page",children:[g&&he(lt,{},void 0,!1,void 0,this),he("div",{className:b.container.wrapper,children:he("article",{ref:k,className:f(b.card.base,b.card.padding,b.card.background,b.card.border,b.card.shadow,b.card.rounded),children:[he(Yi,{logo:e,title:T,subtitle:y},void 0,!1,void 0,this),he(Gi,{passwordChangeAction:l,passwordSetAction:c,isInvite:o,onSuccess:u,onBackToLogin:d,backToLoginHref:w,passwordPolicy:S},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as jl}from"@gsap/react";import qi from"gsap";import{useEffect as El,useRef as Dl,useState as Vl}from"react";import{jsxDEV as Ue,Fragment as pu}from"react/jsx-dev-runtime";qi.registerPlugin(jl);function _i({theme:e,isOpen:t,isLoading:r,onClose:n,onInvite:a}){let[i,o]=Vl(""),[s,l]=Vl(""),c=Dl(null),d=Dl(null);jl(()=>{if(!c.current||!d.current)return;if(t)qi.fromTo(c.current,{opacity:0},{opacity:1,duration:0.2,ease:"power2.out"}),qi.fromTo(d.current,{opacity:0,scale:0.95,y:20},{opacity:1,scale:1,y:0,duration:0.3,ease:"back.out(1.7)"})},{dependencies:[t]}),El(()=>{if(t)o(""),l("")},[t]),El(()=>{let m=(S)=>{if(S.key==="Escape"&&t&&!r)n()};return document.addEventListener("keydown",m),()=>document.removeEventListener("keydown",m)},[t,r,n]);let u=(m)=>{return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(m)},w=()=>{if(!i.trim()){l("Email is required");return}if(!u(i)){l("Please enter a valid email address");return}l(""),a(i.trim())},g=(m)=>{if(m.key==="Enter"&&!r)w()};if(!t)return null;return Ue(pu,{children:[Ue("div",{ref:c,className:f(e.modal.overlay),onClick:()=>!r&&n(),"aria-hidden":"true"},void 0,!1,void 0,this),Ue("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:Ue("div",{ref:d,className:f(e.modal.wrapper),role:"dialog","aria-modal":"true","aria-labelledby":"invite-modal-title",children:[Ue("div",{className:f(e.modal.header.wrapper),children:[Ue("div",{className:"flex items-center gap-3",children:[Ue("div",{className:f(e.modal.header.icon),children:Ue("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ue("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ue("div",{children:[Ue("h2",{id:"invite-modal-title",className:f(e.modal.header.title),children:"Invite User"},void 0,!1,void 0,this),Ue("p",{className:f(e.modal.header.subtitle),children:"Send an invitation email to add a new user"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ue(V,{variant:"ghost",size:"sm",onClick:n,disabled:r,"aria-label":"Close modal",iconOnly:!0,children:Ue("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ue("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ue("div",{className:f(e.modal.content),children:Ue("div",{className:"space-y-4",children:[Ue("div",{children:[Ue("label",{htmlFor:"invite-email",className:"block text-sm font-medium text-zinc-700 dark:text-zinc-300 mb-1.5",children:"Email Address"},void 0,!1,void 0,this),Ue(Fe,{id:"invite-email",type:"email",value:i,onChange:o,onKeyDown:g,placeholder:"colleague@company.com",size:"md",disabled:r,errorMessage:s||void 0,leftIcon:Ue("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ue("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Ue("div",{className:f(e.modal.infoBox),children:[Ue("svg",{className:"w-4 h-4 text-blue-500 flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ue("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Ue("p",{className:"text-sm text-zinc-600 dark:text-zinc-400",children:"The user will receive an email with a secure link to set their password and complete registration."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Ue("div",{className:f(e.modal.footer),children:[Ue(V,{variant:"outline",size:"md",onClick:n,disabled:r,children:"Cancel"},void 0,!1,void 0,this),Ue(V,{variant:"primary",size:"md",onClick:w,loading:r,leftIcon:Ue("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ue("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 19l9 2-9-18-9 18 9-2zm0 0v-8"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:"Send Invitation"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as Ct}from"react/jsx-dev-runtime";function Ji({theme:e,currentPage:t,totalPages:r,totalItems:n,pageSize:a,pageSizeOptions:i=[10,25,50,100],onPageChange:o,onPageSizeChange:s}){let l=(t-1)*a+1,c=Math.min(t*a,n),d=i.map((w)=>({value:String(w),label:`${w} / page`})),u=()=>{let w=[],g=5;if(r<=5)for(let m=1;m<=r;m++)w.push(m);else{if(w.push(1),t>3)w.push("ellipsis");let m=Math.max(2,t-1),S=Math.min(r-1,t+1);for(let b=m;b<=S;b++)w.push(b);if(t<r-2)w.push("ellipsis");if(r>1)w.push(r)}return w};if(n===0)return null;return Ct("div",{className:f(e.pagination.wrapper),children:[Ct("div",{className:f(e.pagination.info),children:[Ct("span",{className:"hidden sm:inline",children:["Showing ",l,"-",c," of ",n," users"]},void 0,!0,void 0,this),Ct("span",{className:"sm:hidden",children:[l,"-",c," / ",n]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Ct("div",{className:"flex items-center gap-3",children:[Ct(Ot,{options:d,value:String(a),onChange:(w)=>{if(w)s(Number(w))},size:"sm",className:"min-w-[100px]"},void 0,!1,void 0,this),Ct("div",{className:f(e.pagination.controls.wrapper),children:[Ct(V,{variant:"ghost",size:"sm",onClick:()=>o(t-1),disabled:t===1,"aria-label":"Previous page",iconOnly:!0,children:Ct("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ct("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),u().map((w,g)=>w==="ellipsis"?Ct("span",{className:"px-2 text-zinc-400 dark:text-zinc-600",children:"..."},`ellipsis-${g}`,!1,void 0,this):Ct(V,{variant:w===t?"primary":"ghost",size:"sm",onClick:()=>o(w),children:w},w,!1,void 0,this)),Ct(V,{variant:"ghost",size:"sm",onClick:()=>o(t+1),disabled:t===r,"aria-label":"Next page",iconOnly:!0,children:Ct("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ct("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as ed}from"@gsap/react";import td from"gsap";import{useRef as mu}from"react";import{jsxDEV as Ht}from"react/jsx-dev-runtime";td.registerPlugin(ed);function Ki({theme:e,totalUsers:t,verifiedUsers:r,lockedUsers:n,unverifiedUsers:a}){let i=mu(null);ed(()=>{if(!i.current)return;let s=i.current.querySelectorAll("[data-stat-card]");td.fromTo(s,{opacity:0,y:20,scale:0.95},{opacity:1,y:0,scale:1,duration:0.4,stagger:0.08,ease:"back.out(1.7)"})},{scope:i});let o=[{label:"Total Users",value:t,iconColor:"primary",icon:Ht("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 4.354a4 4 0 110 5.292M15 21H3v-1a6 6 0 0112 0v1zm0 0h6v-1a6 6 0 00-9-5.197M13 7a4 4 0 11-8 0 4 4 0 018 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{label:"Verified",value:r,iconColor:"success",icon:Ht("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{label:"Unverified",value:a,iconColor:"warning",icon:Ht("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},{label:"Locked",value:n,iconColor:"danger",icon:Ht("svg",{className:"w-4 h-4 sm:w-5 sm:h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Ht("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)}];return Ht("div",{ref:i,className:f(e.stats.wrapper),children:o.map((s)=>Ht("div",{"data-stat-card":!0,className:f(e.stats.card.base),children:[Ht("div",{className:f(e.stats.card.icon.wrapper,e.stats.card.icon[s.iconColor]),children:s.icon},void 0,!1,void 0,this),Ht("div",{className:f(e.stats.card.value),children:s.value},void 0,!1,void 0,this),Ht("div",{className:f(e.stats.card.label),children:s.label},void 0,!1,void 0,this)]},s.label,!0,void 0,this))},void 0,!1,void 0,this)}import{useEffect as ad,useRef as fu,useState as hu}from"react";import{useEffect as Qi,useRef as gu,useState as rd}from"react";import{createPortal as bu}from"react-dom";import{jsxDEV as tt}from"react/jsx-dev-runtime";function nd({isOpen:e,roles:t,userRoles:r,userId:n,onClose:a,onAssignRole:i,onRemoveRole:o}){let s=gu(null),[l,c]=rd(""),[d,u]=rd(!1);if(Qi(()=>{u(!0)},[]),Qi(()=>{let z=(k)=>{if(k.key==="Escape"&&e)a()};return document.addEventListener("keydown",z),()=>document.removeEventListener("keydown",z)},[e,a]),Qi(()=>{if(e)document.body.style.overflow="hidden",c("");else document.body.style.overflow="";return()=>{document.body.style.overflow=""}},[e]),!e||!d)return null;let w=r.filter((z)=>z.userId===n).map((z)=>z.roleId),g=t.filter((z)=>z.name.toLowerCase().includes(l.toLowerCase())),m=(z)=>{if(w.includes(z.id)){let R=r.find((p)=>p.userId===n&&p.roleId===z.id);if(R&&!R.id.startsWith("temp-")&&z.name!=="godmin")o(R.id)}else i(n,z.id)},S=(z)=>{if(z.name==="godmin")return!0;return r.find((R)=>R.userId===n&&R.roleId===z.id)?.id.startsWith("temp-")||!1},b=tt("div",{className:"fixed inset-0 flex items-center justify-center p-4",style:{zIndex:99999},children:[tt("div",{className:"fixed inset-0 bg-black/60",onClick:a,"aria-hidden":"true"},void 0,!1,void 0,this),tt("div",{ref:s,className:"relative bg-white dark:bg-zinc-900 rounded-xl shadow-2xl w-full max-w-md max-h-[80vh] flex flex-col border border-zinc-200 dark:border-zinc-700",children:[tt("div",{className:"flex items-center justify-between px-5 py-4 border-b border-zinc-200 dark:border-zinc-700",children:[tt("h3",{className:"text-base font-semibold text-zinc-900 dark:text-white",children:"Manage Roles"},void 0,!1,void 0,this),tt("button",{type:"button",onClick:a,className:"p-1 rounded-md text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors","aria-label":"Close",children:tt("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:tt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),tt("div",{className:"px-5 py-3 border-b border-zinc-200 dark:border-zinc-700",children:tt("input",{type:"text",placeholder:"Search roles...",value:l,onChange:(z)=>c(z.target.value),className:"w-full px-3 py-2 text-sm bg-zinc-50 dark:bg-zinc-800 border border-zinc-200 dark:border-zinc-700 rounded-lg outline-none focus:ring-2 focus:ring-blue-500/50 text-zinc-900 dark:text-white placeholder:text-zinc-400"},void 0,!1,void 0,this)},void 0,!1,void 0,this),tt("div",{className:"flex-1 overflow-y-auto px-3 py-2 min-h-[200px]",children:g.length===0?tt("div",{className:"text-center py-8 text-zinc-500 dark:text-zinc-400 text-sm",children:"No roles found"},void 0,!1,void 0,this):tt("div",{className:"space-y-1",children:g.map((z)=>{let k=w.includes(z.id),R=S(z);return tt("button",{type:"button",onClick:()=>!R&&m(z),disabled:R,className:f("w-full flex items-start gap-3 px-3 py-3 rounded-lg text-left transition-colors",R?"opacity-50 cursor-not-allowed":"hover:bg-zinc-50 dark:hover:bg-zinc-800/50 cursor-pointer",k&&!R&&"bg-blue-50 dark:bg-blue-900/20 hover:bg-blue-100 dark:hover:bg-blue-900/30"),children:[tt("div",{className:f("w-5 h-5 mt-0.5 rounded border-2 flex items-center justify-center flex-shrink-0 transition-colors",k?"bg-blue-600 border-blue-600":"border-zinc-300 dark:border-zinc-600"),children:k&&tt("svg",{className:"w-3 h-3 text-white",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:tt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:3,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),tt("div",{className:"flex-1 min-w-0",children:[tt("div",{className:"flex items-center gap-2",children:[tt("span",{className:"font-medium text-sm text-zinc-900 dark:text-white",children:z.name},void 0,!1,void 0,this),z.name==="godmin"&&tt("span",{className:"text-[10px] px-1.5 py-0.5 rounded bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 font-medium",children:"Protected"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),z.description&&tt("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5 line-clamp-2",children:z.description},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},z.id,!0,void 0,this)})},void 0,!1,void 0,this)},void 0,!1,void 0,this),tt("div",{className:"px-5 py-3 border-t border-zinc-200 dark:border-zinc-700 bg-zinc-50 dark:bg-zinc-800/50 rounded-b-xl",children:tt("div",{className:"text-xs text-zinc-500 dark:text-zinc-400",children:[w.length," role",w.length!==1?"s":""," assigned"]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this);return bu(b,document.body)}import{jsxDEV as Q,Fragment as yu}from"react/jsx-dev-runtime";function Zi({theme:e,user:t,roles:r,allUserRoles:n,isOpen:a,actionLoading:i,onClose:o,onVerifyEmail:s,onLockAccount:l,onUnlockAccount:c,onResetPassword:d,onSendMagicLink:u,onResendInvite:w,onAssignRole:g,onRemoveRole:m,hasPasswordReset:S=!1,hasMagicLink:b=!1,hasInvite:z=!1}){let k=fu(null),[R,p]=hu(!1);if(ad(()=>{let N=(L)=>{if(L.key==="Escape"&&a)o()};return document.addEventListener("keydown",N),()=>document.removeEventListener("keydown",N)},[a,o]),ad(()=>{if(a)document.body.style.overflow="hidden";else document.body.style.overflow="";return()=>{document.body.style.overflow=""}},[a]),!t||!a)return null;let T=(N)=>{if(!N)return"Never";return(typeof N==="string"?new Date(N):N).toLocaleDateString("en-US",{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})},y=()=>{if(t.profile?.firstName||t.profile?.lastName)return`${t.profile.firstName||""} ${t.profile.lastName||""}`.trim();return t.email.split("@")[0]};return Q(yu,{children:[Q("div",{className:f(e.detailPanel.overlay),onClick:o,"aria-hidden":"true"},void 0,!1,void 0,this),Q("div",{ref:k,className:f(e.detailPanel.wrapper.base,"lg:relative",e.detailPanel.wrapper.mobile,"sm:rounded-t-2xl md:rounded-none","md:fixed md:inset-y-0 md:right-0 md:w-[400px] md:rounded-l-2xl","lg:static lg:w-full lg:rounded-xl"),children:[Q("div",{className:f(e.detailPanel.header.wrapper),children:[Q("div",{children:[Q("h2",{className:f(e.detailPanel.header.title),children:y()},void 0,!1,void 0,this),Q("p",{className:"text-xs text-zinc-500 dark:text-zinc-400 mt-0.5",children:t.email},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q(V,{variant:"ghost",size:"sm",onClick:o,"aria-label":"Close panel",iconOnly:!0,children:Q("svg",{className:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Q("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q("div",{className:f(e.detailPanel.content.wrapper),children:[Q("section",{className:f(e.detailPanel.content.section.wrapper),children:[Q("h3",{className:f(e.detailPanel.content.section.title),children:"Account Status"},void 0,!1,void 0,this),Q("div",{className:f(e.detailPanel.content.section.content),children:[Q("div",{className:f(e.detailPanel.content.row.wrapper),children:[Q("span",{className:f(e.detailPanel.content.row.label),children:"Status"},void 0,!1,void 0,this),Q("span",{className:f("text-sm font-medium",t.isLocked?"text-red-600 dark:text-red-400":t.verifiedAt?"text-emerald-600 dark:text-emerald-400":"text-amber-600 dark:text-amber-400"),children:t.isLocked?"Locked":t.verifiedAt?"Active":"Unverified"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q("div",{className:f(e.detailPanel.content.row.wrapper),children:[Q("span",{className:f(e.detailPanel.content.row.label),children:"Last Login"},void 0,!1,void 0,this),Q("span",{className:f(e.detailPanel.content.row.value),children:T(t.lastLoginAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q("div",{className:f(e.detailPanel.content.row.wrapper),children:[Q("span",{className:f(e.detailPanel.content.row.label),children:"Login Count"},void 0,!1,void 0,this),Q("span",{className:f(e.detailPanel.content.row.value),children:t.loginCount||0},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q("div",{className:f(e.detailPanel.content.row.wrapper),children:[Q("span",{className:f(e.detailPanel.content.row.label),children:"Created"},void 0,!1,void 0,this),Q("span",{className:f(e.detailPanel.content.row.value),children:T(t.createdAt)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.isLocked&&t.lockedUntil&&Q("div",{className:f(e.detailPanel.content.row.wrapper),children:[Q("span",{className:f(e.detailPanel.content.row.label),children:"Locked Until"},void 0,!1,void 0,this),Q("span",{className:f(e.detailPanel.content.row.value),children:T(t.lockedUntil)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),t.profile&&Q("section",{className:f(e.detailPanel.content.section.wrapper),children:[Q("h3",{className:f(e.detailPanel.content.section.title),children:"Profile"},void 0,!1,void 0,this),Q("div",{className:f(e.detailPanel.content.section.content),children:Q("div",{className:f(e.detailPanel.content.row.wrapper),children:[Q("span",{className:f(e.detailPanel.content.row.label),children:"Name"},void 0,!1,void 0,this),Q("span",{className:f(e.detailPanel.content.row.value),children:[t.profile.firstName," ",t.profile.lastName]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.addresses&&t.addresses.length>0&&Q("section",{className:f(e.detailPanel.content.section.wrapper),children:[Q("h3",{className:f(e.detailPanel.content.section.title),children:["Addresses (",t.addresses.length,")"]},void 0,!0,void 0,this),Q("div",{className:"space-y-2",children:t.addresses.map((N)=>Q("div",{className:f(e.detailPanel.content.section.content),children:[Q("div",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:N.name||"Address"},void 0,!1,void 0,this),Q("div",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:[N.street,N.city,N.state,N.zip,N.country].filter(Boolean).join(", ")},void 0,!1,void 0,this)]},N.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.phones&&t.phones.length>0&&Q("section",{className:f(e.detailPanel.content.section.wrapper),children:[Q("h3",{className:f(e.detailPanel.content.section.title),children:["Phones (",t.phones.length,")"]},void 0,!0,void 0,this),Q("div",{className:"space-y-2",children:t.phones.map((N)=>Q("div",{className:f(e.detailPanel.content.section.content,"flex justify-between items-center"),children:[Q("span",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:N.name||N.type||"Phone"},void 0,!1,void 0,this),Q("span",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100",children:[N.countryCode," ",N.number]},void 0,!0,void 0,this)]},N.id,!0,void 0,this))},void 0,!1,void 0,this)]},void 0,!0,void 0,this),t.files&&t.files.length>0&&Q("section",{className:f(e.detailPanel.content.section.wrapper),children:[Q("h3",{className:f(e.detailPanel.content.section.title),children:["Files (",t.files.length,")"]},void 0,!0,void 0,this),Q("div",{className:"space-y-2",children:[t.files.slice(0,5).map((N)=>Q("div",{className:f(e.detailPanel.content.section.content,"flex justify-between items-center"),children:Q("div",{className:"min-w-0 flex-1",children:[Q("div",{className:"text-sm font-medium text-zinc-900 dark:text-zinc-100 truncate",children:N.originalName||N.name},void 0,!1,void 0,this),Q("div",{className:"text-xs text-zinc-500",children:[N.mimeType," \u2022 ",Math.round((N.size||0)/1024),"KB"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},N.id,!1,void 0,this)),t.files.length>5&&Q("div",{className:"text-xs text-zinc-500 dark:text-zinc-400 text-center py-1",children:["+",t.files.length-5," more files"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Q("section",{className:f(e.detailPanel.content.section.wrapper),children:[Q("div",{className:"flex items-center justify-between mb-3",children:[Q("h3",{className:f(e.detailPanel.content.section.title,"mb-0"),children:"Roles"},void 0,!1,void 0,this),Q(V,{variant:"ghost",size:"xs",onClick:()=>p(!0),className:"text-blue-600 hover:text-blue-700 dark:text-blue-400",children:"Manage"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q("div",{className:"flex flex-wrap gap-2",children:t.userRoles&&t.userRoles.length>0?t.userRoles.map((N)=>{let L=r.find((F)=>F.id===N.roleId),O=N.id.startsWith("temp-");return Q("span",{className:f("inline-flex items-center gap-1.5 px-2.5 py-1 rounded-full text-xs font-medium",O?"bg-zinc-100 dark:bg-zinc-800 text-zinc-500":"bg-blue-100 dark:bg-blue-900/30 text-blue-700 dark:text-blue-300"),children:[L?.name||"...",L?.name==="godmin"&&Q("svg",{className:"w-3 h-3 text-amber-500",fill:"currentColor",viewBox:"0 0 20 20","aria-hidden":"true",children:Q("path",{fillRule:"evenodd",d:"M5 2a1 1 0 011 1v1h1a1 1 0 010 2H6v1a1 1 0 01-2 0V6H3a1 1 0 010-2h1V3a1 1 0 011-1zm0 10a1 1 0 011 1v1h1a1 1 0 110 2H6v1a1 1 0 11-2 0v-1H3a1 1 0 110-2h1v-1a1 1 0 011-1zM12 2a1 1 0 01.967.744L14.146 7.2 17.5 9.134a1 1 0 010 1.732l-3.354 1.935-1.18 4.455a1 1 0 01-1.933 0L9.854 12.8 6.5 10.866a1 1 0 010-1.732l3.354-1.935 1.18-4.455A1 1 0 0112 2z",clipRule:"evenodd"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},N.id,!0,void 0,this)}):Q("span",{className:"text-sm text-zinc-500 dark:text-zinc-400",children:"No roles assigned"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q(nd,{isOpen:R,roles:r,userRoles:n,userId:t.id,onClose:()=>p(!1),onAssignRole:g,onRemoveRole:m},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q("div",{className:f(e.detailPanel.actions.wrapper),children:Q("div",{className:"grid grid-cols-2 gap-2",children:[!t.verifiedAt&&Q(V,{variant:"success",size:"sm",onClick:()=>s(t.id),loading:i===`verify-${t.id}`,fullWidth:!0,children:"Verify Email"},void 0,!1,void 0,this),t.isLocked?Q(V,{variant:"primary",size:"sm",onClick:()=>c(t.id),loading:i===`unlock-${t.id}`,fullWidth:!0,children:"Unlock Account"},void 0,!1,void 0,this):Q(V,{variant:"danger",size:"sm",onClick:()=>l(t.id),loading:i===`lock-${t.id}`,fullWidth:!0,children:"Lock Account"},void 0,!1,void 0,this),S&&Q(V,{variant:"warning",size:"sm",onClick:()=>d(t.email),loading:i===`reset-${t.email}`,fullWidth:!0,children:"Reset Password"},void 0,!1,void 0,this),b&&Q(V,{variant:"secondary",size:"sm",onClick:()=>u(t.email),loading:i===`magic-${t.email}`,fullWidth:!0,children:"Send Magic Link"},void 0,!1,void 0,this),z&&!t.verifiedAt&&!t.lastLoginAt&&Q(V,{variant:"primary",size:"sm",onClick:()=>w(t.email),loading:i===`invite-${t.email}`,fullWidth:!0,children:"Resend Invite"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as wt}from"react/jsx-dev-runtime";function Xi({theme:e,searchQuery:t,statusFilter:r,roleFilter:n,roles:a,totalCount:i,filteredCount:o,onSearchChange:s,onStatusChange:l,onRoleChange:c,onRefresh:d,isLoading:u}){let w=[{value:"all",label:"All Status"},{value:"active",label:"Active"},{value:"locked",label:"Locked"},{value:"unverified",label:"Unverified"}],g=[{value:"all",label:"All Roles"},...a.map((m)=>({value:m.id,label:m.name}))];return wt("div",{className:f(e.filters.wrapper),children:[wt("div",{className:"flex flex-col sm:flex-row gap-3",children:[wt("div",{className:"flex-1",children:wt(Fe,{type:"text",value:t,onChange:(m)=>s(m),placeholder:"Search by name or email...",size:"md",leftIcon:wt("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:wt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),wt("div",{className:"flex flex-wrap gap-2",children:[wt(Ot,{options:w,value:r,onChange:(m)=>{if(m)l(m)},placeholder:"Status",size:"md",className:"min-w-[140px]"},void 0,!1,void 0,this),wt(Ot,{options:g,value:n,onChange:(m)=>{if(m)c(m)},placeholder:"Role",size:"md",searchable:a.length>5,className:"min-w-[140px]"},void 0,!1,void 0,this),d&&wt(V,{variant:"outline",size:"md",onClick:d,loading:u,leftIcon:wt("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:wt("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:wt("span",{className:"hidden sm:inline",children:"Refresh"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),wt("div",{className:"flex items-center justify-between text-xs text-zinc-500 dark:text-zinc-400",children:[wt("span",{children:["Showing ",o," of ",i," users"]},void 0,!0,void 0,this),(r!=="all"||n!=="all"||t)&&wt(V,{variant:"ghost",size:"sm",onClick:()=>{s(""),l("all"),c("all")},children:"Clear filters"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as ft}from"react/jsx-dev-runtime";function Ei({theme:e,user:t,roles:r,isSelected:n,onSelect:a}){let i=(g)=>{let m=g.split(" ");if(m.length>=2&&m[0]&&m[1])return`${m[0][0]}${m[1][0]}`.toUpperCase();return g.slice(0,2).toUpperCase()},o=()=>{if(t.profile?.firstName||t.profile?.lastName)return`${t.profile.firstName||""} ${t.profile.lastName||""}`.trim();return t.email.split("@")[0]},s=()=>{if(!t.userRoles)return[];return t.userRoles.map((g)=>r.find((m)=>m.id===g.roleId)).filter(Boolean).slice(0,3)},l=()=>{if(t.isLocked)return e.userCard.avatar.statusDot.locked;if(!t.verifiedAt)return e.userCard.avatar.statusDot.unverified;return e.userCard.avatar.statusDot.active},c=(g)=>{if(!g)return"Never logged in";let m=typeof g==="string"?new Date(g):g,b=new Date().getTime()-m.getTime(),z=Math.floor(b/86400000);if(z===0)return"Today";if(z===1)return"Yesterday";if(z<7)return`${z} days ago`;if(z<30)return`${Math.floor(z/7)} weeks ago`;if(z<365)return`${Math.floor(z/30)} months ago`;return`${Math.floor(z/365)} years ago`},d=o(),u=s(),w=(t.userRoles?.length||0)>3;return ft("button",{type:"button",onClick:()=>a(t),className:f(e.userCard.wrapper.base,e.userCard.wrapper.hover,n&&e.userCard.wrapper.selected,"w-full text-left flex items-start gap-3"),children:[ft("div",{className:f(e.userCard.avatar.wrapper),children:[ft("div",{className:f(e.userCard.avatar.placeholder),children:i(d||"U")},void 0,!1,void 0,this),ft("div",{className:f(e.userCard.avatar.statusDot.base,l())},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ft("div",{className:f(e.userCard.content.wrapper),children:[ft("div",{className:"flex items-center gap-2",children:[ft("span",{className:f(e.userCard.content.name),children:d},void 0,!1,void 0,this),t.isGod&&ft("span",{className:f(e.userCard.badges.status.god),children:"God"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),ft("p",{className:f(e.userCard.content.email),children:t.email},void 0,!1,void 0,this),ft("p",{className:f(e.userCard.content.meta),children:c(t.lastLoginAt)},void 0,!1,void 0,this),(u.length>0||t.isLocked||!t.verifiedAt)&&ft("div",{className:f(e.userCard.badges.wrapper),children:[t.isLocked&&ft("span",{className:f(e.userCard.badges.status.locked),children:"Locked"},void 0,!1,void 0,this),!t.verifiedAt&&!t.isLocked&&ft("span",{className:f(e.userCard.badges.status.unverified),children:"Unverified"},void 0,!1,void 0,this),u.map((g)=>ft("span",{className:f(e.userCard.badges.role),children:g?.name},g?.id,!1,void 0,this)),w&&ft("span",{className:f(e.userCard.badges.role),children:["+",(t.userRoles?.length||0)-3]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),ft("svg",{className:"w-5 h-5 text-zinc-400 flex-shrink-0 mt-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:ft("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{jsxDEV as ar}from"react/jsx-dev-runtime";function Di({theme:e,count:t=5}){return ar("div",{className:"divide-y divide-zinc-100 dark:divide-zinc-800/50",children:Array.from({length:t}).map((r,n)=>ar("div",{className:"p-3 sm:p-4 flex items-start gap-3",children:[ar("div",{className:f(e.skeleton.base,e.skeleton.avatar)},void 0,!1,void 0,this),ar("div",{className:"flex-1 space-y-2",children:[ar("div",{className:f(e.skeleton.base,e.skeleton.text,"w-32")},void 0,!1,void 0,this),ar("div",{className:f(e.skeleton.base,e.skeleton.text,"w-48")},void 0,!1,void 0,this),ar("div",{className:"flex gap-1.5 mt-1",children:[ar("div",{className:f(e.skeleton.base,"h-5 w-16 rounded")},void 0,!1,void 0,this),ar("div",{className:f(e.skeleton.base,"h-5 w-12 rounded")},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},n,!0,void 0,this))},void 0,!1,void 0,this)}import{useGSAP as id}from"@gsap/react";import od from"gsap";import{useEffect as xu,useEffectEvent as ht,useRef as Vi,useState as ji}from"react";import{batch as ku,createStore as wu}from"h-state";var vu={users:[],profiles:[],addresses:[],phones:[],files:[],roles:[],userRoles:[],selectedUser:null,searchQuery:"",statusFilter:"all",roleFilter:"all",isDetailPanelOpen:!1,assigningRoleId:null,currentPage:1,pageSize:25,totalItems:0,totalPages:0,isLoading:!1},{useStore:ga}=wu(vu,{setUsers:(e)=>(t)=>{e.users=t},setProfiles:(e)=>(t)=>{e.profiles=t},setAddresses:(e)=>(t)=>{e.addresses=t},setPhones:(e)=>(t)=>{e.phones=t},setFiles:(e)=>(t)=>{e.files=t},setRoles:(e)=>(t)=>{e.roles=t},setUserRoles:(e)=>(t)=>{e.userRoles=t},setSelectedUser:(e)=>(t)=>{e.selectedUser=t,e.isDetailPanelOpen=t!==null},setSearchQuery:(e)=>(t)=>{e.searchQuery=t},setStatusFilter:(e)=>(t)=>{e.statusFilter=t},setRoleFilter:(e)=>(t)=>{e.roleFilter=t},setDetailPanelOpen:(e)=>(t)=>{if(e.isDetailPanelOpen=t,!t)e.selectedUser=null},setAssigningRoleId:(e)=>(t)=>{e.assigningRoleId=t},setCurrentPage:(e)=>(t)=>{e.currentPage=t},setPageSize:(e)=>(t)=>{e.pageSize=t,e.currentPage=1},setPagination:(e)=>(t,r)=>{e.totalItems=t,e.totalPages=r},setIsLoading:(e)=>(t)=>{e.isLoading=t},updateUser:(e)=>(t,r)=>{if(e.users=e.users.map((n)=>n.id===t?{...n,...r}:n),e.selectedUser?.id===t)e.selectedUser={...e.selectedUser,...r}},addUser:(e)=>(t)=>{e.users=[t,...e.users],e.totalItems=e.totalItems+1},addUserRole:(e)=>(t)=>{e.userRoles=[...e.userRoles,t]},removeUserRole:(e)=>(t)=>{e.userRoles=e.userRoles.filter((r)=>r.id!==t)},getUserWithDetails:(e)=>(t)=>{let r=e.users.find((l)=>l.id===t);if(!r)return null;let n=e.profiles.find((l)=>l.userId===t),a=e.addresses.filter((l)=>l.ownerType==="user"&&l.ownerId===t),i=e.phones.filter((l)=>l.ownerType==="user"&&l.ownerId===t),o=e.files.filter((l)=>l.uploadedBy===t),s=e.userRoles.filter((l)=>l.userId===t).map((l)=>({...l,role:e.roles.find((c)=>c.id===l.roleId)}));return{...r,profile:n||null,addresses:a,phones:i,files:o,userRoles:s}},reset:(e)=>()=>{ku(()=>{e.users=[],e.profiles=[],e.addresses=[],e.phones=[],e.files=[],e.roles=[],e.userRoles=[],e.selectedUser=null,e.searchQuery="",e.statusFilter="all",e.roleFilter="all",e.isDetailPanelOpen=!1,e.assigningRoleId=null,e.currentPage=1,e.pageSize=25,e.totalItems=0,e.totalPages=0,e.isLoading=!1})}});var ba={container:{base:"min-h-screen bg-zinc-50 dark:bg-zinc-950 transition-colors",padding:{sm:"p-3",md:"p-4",lg:"p-6",xl:"p-8","2xl":"p-10"}},header:{wrapper:"flex flex-col gap-1 sm:flex-row sm:items-center sm:justify-between mb-4 sm:mb-6",title:"text-xl sm:text-2xl lg:text-3xl font-bold text-zinc-900 dark:text-zinc-100",subtitle:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400",actions:"flex items-center gap-2 mt-2 sm:mt-0"},layout:{wrapper:"flex flex-col lg:flex-row gap-4 lg:gap-6",sidebar:{base:"transition-all duration-300 ease-in-out",collapsed:"w-full",expanded:"w-full lg:w-3/5 xl:w-2/3"},main:"w-full lg:w-2/5 xl:w-1/3 lg:sticky lg:top-4 lg:self-start"},filters:{wrapper:"flex flex-col gap-3 p-3 sm:p-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 mb-4",searchInput:"w-full px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 placeholder:text-zinc-400 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500",select:"px-3 py-2 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100 focus:outline-none focus:ring-2 focus:ring-emerald-500/20 focus:border-emerald-500",button:{base:"px-3 py-2 text-sm font-medium rounded-lg transition-colors",active:"bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300",inactive:"bg-zinc-100 dark:bg-zinc-800 text-zinc-600 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700"},badge:"px-2 py-0.5 text-xs font-medium bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 rounded-full"},table:{wrapper:"bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 overflow-hidden",header:{row:"border-b border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50",cell:"px-3 sm:px-4 py-3 text-left text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider"},body:{row:{base:"border-b border-zinc-100 dark:border-zinc-800/50 transition-colors cursor-pointer",hover:"hover:bg-zinc-50 dark:hover:bg-zinc-800/30",selected:"bg-emerald-50 dark:bg-emerald-900/20"},cell:"px-3 sm:px-4 py-3 text-sm"}},userCard:{wrapper:{base:"p-3 sm:p-4 border-b border-zinc-100 dark:border-zinc-800/50 transition-colors cursor-pointer",hover:"hover:bg-zinc-50 dark:hover:bg-zinc-800/30",selected:"bg-emerald-50 dark:bg-emerald-900/20 border-l-2 border-l-emerald-500"},avatar:{wrapper:"relative flex-shrink-0",image:"w-10 h-10 sm:w-12 sm:h-12 rounded-full object-cover",placeholder:"w-10 h-10 sm:w-12 sm:h-12 rounded-full bg-gradient-to-br from-emerald-400 to-emerald-600 flex items-center justify-center text-white font-semibold text-sm sm:text-base",statusDot:{base:"absolute -bottom-0.5 -right-0.5 w-3 h-3 sm:w-3.5 sm:h-3.5 rounded-full border-2 border-white dark:border-zinc-900",active:"bg-emerald-500",locked:"bg-red-500",unverified:"bg-amber-500"}},content:{wrapper:"flex-1 min-w-0 ml-3",name:"font-medium text-sm sm:text-base text-zinc-900 dark:text-zinc-100 truncate",email:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 truncate",meta:"text-xs text-zinc-400 dark:text-zinc-500 mt-0.5"},badges:{wrapper:"flex flex-wrap gap-1 mt-1.5",role:"px-1.5 py-0.5 text-xs bg-zinc-100 dark:bg-zinc-800 text-zinc-600 dark:text-zinc-400 rounded",status:{active:"px-1.5 py-0.5 text-xs font-medium bg-emerald-100 dark:bg-emerald-900/30 text-emerald-700 dark:text-emerald-300 rounded",locked:"px-1.5 py-0.5 text-xs font-medium bg-red-100 dark:bg-red-900/30 text-red-700 dark:text-red-300 rounded",unverified:"px-1.5 py-0.5 text-xs font-medium bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-300 rounded",god:"px-1.5 py-0.5 text-xs font-medium bg-purple-100 dark:bg-purple-900/30 text-purple-700 dark:text-purple-300 rounded"}}},detailPanel:{overlay:"fixed inset-0 bg-black/50 z-40 lg:hidden",wrapper:{base:"bg-white dark:bg-zinc-900 border border-zinc-200 dark:border-zinc-800 overflow-hidden z-50 transition-all duration-300",mobile:"fixed inset-x-0 bottom-0 rounded-t-2xl max-h-[85vh]",tablet:"fixed inset-y-0 right-0 w-96 rounded-l-2xl",desktop:"rounded-xl sticky top-4"},header:{wrapper:"flex items-center justify-between p-4 border-b border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50",title:"text-base sm:text-lg font-semibold text-zinc-900 dark:text-zinc-100",closeButton:"p-1.5 rounded-lg text-zinc-500 hover:text-zinc-700 dark:hover:text-zinc-300 hover:bg-zinc-100 dark:hover:bg-zinc-800 transition-colors"},content:{wrapper:"p-4 space-y-4 overflow-y-auto max-h-[calc(100vh-200px)]",section:{wrapper:"space-y-2",title:"text-xs font-semibold text-zinc-500 dark:text-zinc-400 uppercase tracking-wider",content:"bg-zinc-50 dark:bg-zinc-800/50 rounded-lg p-3 space-y-2"},row:{wrapper:"flex items-center justify-between gap-2",label:"text-sm text-zinc-500 dark:text-zinc-400",value:"text-sm font-medium text-zinc-900 dark:text-zinc-100 text-right truncate"}},actions:{wrapper:"p-4 border-t border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50",button:{base:"w-full px-3 py-2 text-sm font-medium rounded-lg transition-colors disabled:opacity-50 disabled:cursor-not-allowed",primary:"bg-emerald-600 hover:bg-emerald-700 text-white",danger:"bg-red-100 hover:bg-red-200 dark:bg-red-900/30 dark:hover:bg-red-900/50 text-red-700 dark:text-red-300",warning:"bg-amber-100 hover:bg-amber-200 dark:bg-amber-900/30 dark:hover:bg-amber-900/50 text-amber-700 dark:text-amber-300",info:"bg-blue-100 hover:bg-blue-200 dark:bg-blue-900/30 dark:hover:bg-blue-900/50 text-blue-700 dark:text-blue-300"}}},pagination:{wrapper:"flex flex-col sm:flex-row items-center justify-between gap-3 p-3 sm:p-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 mt-4",info:"text-sm text-zinc-500 dark:text-zinc-400",controls:{wrapper:"flex items-center gap-1 sm:gap-2",button:{base:"px-2 sm:px-3 py-1.5 text-sm rounded-lg transition-colors",active:"bg-emerald-600 text-white",disabled:"text-zinc-300 dark:text-zinc-600 cursor-not-allowed"},pageSize:"px-2 py-1.5 text-sm border border-zinc-200 dark:border-zinc-700 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-zinc-100"}},skeleton:{base:"animate-pulse bg-zinc-200 dark:bg-zinc-800 rounded",avatar:"w-10 h-10 sm:w-12 sm:h-12 rounded-full",text:"h-4 rounded",button:"h-9 rounded-lg"},emptyState:{wrapper:"flex flex-col items-center justify-center py-12 px-4 text-center",icon:"w-12 h-12 text-zinc-300 dark:text-zinc-600 mb-4",title:"text-lg font-medium text-zinc-900 dark:text-zinc-100 mb-1",description:"text-sm text-zinc-500 dark:text-zinc-400"},modal:{overlay:"fixed inset-0 bg-black/60 backdrop-blur-sm z-40",wrapper:"w-full max-w-md bg-white dark:bg-zinc-900 rounded-2xl shadow-2xl border border-zinc-200 dark:border-zinc-800 overflow-hidden",header:{wrapper:"flex items-start justify-between gap-4 p-5 border-b border-zinc-200 dark:border-zinc-800",icon:"flex-shrink-0 w-10 h-10 flex items-center justify-center rounded-xl bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400",title:"text-lg font-semibold text-zinc-900 dark:text-zinc-100",subtitle:"text-sm text-zinc-500 dark:text-zinc-400 mt-0.5"},content:"p-5",infoBox:"flex items-start gap-3 p-3 bg-blue-50 dark:bg-blue-900/20 rounded-lg border border-blue-100 dark:border-blue-800/30",footer:"flex items-center justify-end gap-3 p-5 border-t border-zinc-200 dark:border-zinc-800 bg-zinc-50 dark:bg-zinc-800/50"},stats:{wrapper:"grid grid-cols-2 sm:grid-cols-4 gap-3 sm:gap-4 mb-4 sm:mb-6",card:{base:"p-3 sm:p-4 bg-white dark:bg-zinc-900 rounded-xl border border-zinc-200 dark:border-zinc-800 transition-all hover:shadow-md hover:border-zinc-300 dark:hover:border-zinc-700",icon:{wrapper:"w-8 h-8 sm:w-10 sm:h-10 flex items-center justify-center rounded-lg mb-2 sm:mb-3",primary:"bg-blue-100 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400",success:"bg-emerald-100 dark:bg-emerald-900/30 text-emerald-600 dark:text-emerald-400",warning:"bg-amber-100 dark:bg-amber-900/30 text-amber-600 dark:text-amber-400",danger:"bg-red-100 dark:bg-red-900/30 text-red-600 dark:text-red-400"},value:"text-xl sm:text-2xl font-bold text-zinc-900 dark:text-zinc-100",label:"text-xs sm:text-sm text-zinc-500 dark:text-zinc-400 mt-0.5"}}};import{jsxDEV as Oe}from"react/jsx-dev-runtime";od.registerPlugin(id);function sd({title:e="User Management",subtitle:t,className:r,theme:n,getUsersAction:a,updateUserAction:i,getProfilesAction:o,getAddressesAction:s,getPhonesAction:l,getFilesAction:c,getRolesAction:d,getUserRolesAction:u,addUserRoleAction:w,deleteUserRoleAction:g,passwordResetRequestAction:m,magicLinkRequestAction:S,inviteUserAction:b,onUserUpdated:z,onRoleAssigned:k,onRoleRemoved:R,onUserInvited:p}){let T=n?{...ba,...n}:ba,y=ga(),N=Vi(null),L=Vi(null),[O,F]=ji(null),[Y,re]=ji(!1),[E,_]=ji(!1),A=Vi(null);id(()=>{if(!L.current)return;od.fromTo(L.current,{opacity:0,y:10},{opacity:1,y:0,duration:0.3,ease:"power2.out"})},{scope:N});let ee=ht((P=y.currentPage,j=y.pageSize)=>{y.setIsLoading(!0),a.start({payload:{page:P,limit:j},onAfterHandle:(Z)=>{if(y.setIsLoading(!1),Z.data)y.setUsers(Z.data.items||[]),y.setPagination(Z.data.meta?.totalItems||0,Z.data.meta?.totalPages||1)},onErrorHandle:()=>{y.setIsLoading(!1)}})}),v=ht(()=>{o.start({payload:{page:1,limit:1000},onAfterHandle:(P)=>{if(P.data?.items)y.setProfiles(P.data.items)}}),s.start({payload:{page:1,limit:1000},onAfterHandle:(P)=>{if(P.data?.items)y.setAddresses(P.data.items)}}),l.start({payload:{page:1,limit:1000},onAfterHandle:(P)=>{if(P.data?.items)y.setPhones(P.data.items)}}),c.start({payload:{page:1,limit:1000},onAfterHandle:(P)=>{if(P.data?.items)y.setFiles(P.data.items)}}),d.start({payload:{page:1,limit:100},onAfterHandle:(P)=>{if(P.data?.items)y.setRoles(P.data.items)}}),u.start({payload:{page:1,limit:5000},onAfterHandle:(P)=>{if(P.data?.items)y.setUserRoles(P.data.items)}})});xu(()=>{ee(1,y.pageSize),v()},[]);let G=ht((P)=>{y.setCurrentPage(P),ee(P,y.pageSize)}),K=ht((P)=>{y.setPageSize(P),ee(1,P)}),se=ht(()=>{ee(y.currentPage,y.pageSize),v()}),H=ht((P)=>{if(y.setSearchQuery(P),A.current)clearTimeout(A.current);A.current=setTimeout(()=>{y.setCurrentPage(1)},300)}),U=ht((P)=>{let j=y.getUserWithDetails(P.id);y.setSelectedUser(j)}),C=ht(()=>{y.setDetailPanelOpen(!1)}),de=ht((P)=>{F(`verify-${P}`);let j=y.users.find((Z)=>Z.id===P);if(!j)return;y.updateUser(P,{verifiedAt:new Date().toISOString()}),i.start({payload:{id:P,verifiedAt:new Date().toISOString()},onAfterHandle:(Z)=>{if(F(null),Z.data){z?.(Z.data);let me=y.getUserWithDetails(P);if(me)y.setSelectedUser(me)}},onErrorHandle:()=>{F(null),y.updateUser(P,{verifiedAt:j.verifiedAt})}})}),B=ht((P)=>{F(`lock-${P}`);let j=y.users.find((Z)=>Z.id===P);if(!j)return;y.updateUser(P,{isLocked:!0}),i.start({payload:{id:P,isLocked:!0},onAfterHandle:(Z)=>{if(F(null),Z.data){z?.(Z.data);let me=y.getUserWithDetails(P);if(me)y.setSelectedUser(me)}},onErrorHandle:()=>{F(null),y.updateUser(P,{isLocked:j.isLocked})}})}),ae=ht((P)=>{F(`unlock-${P}`);let j=y.users.find((Z)=>Z.id===P);if(!j)return;y.updateUser(P,{isLocked:!1,lockedUntil:void 0,failedLoginAttempts:0}),i.start({payload:{id:P,isLocked:!1,lockedUntil:void 0,failedLoginAttempts:0},onAfterHandle:(Z)=>{if(F(null),Z.data){z?.(Z.data);let me=y.getUserWithDetails(P);if(me)y.setSelectedUser(me)}},onErrorHandle:()=>{F(null),y.updateUser(P,{isLocked:j.isLocked,lockedUntil:j.lockedUntil,failedLoginAttempts:j.failedLoginAttempts})}})}),ge=ht((P)=>{if(!m)return;F(`reset-${P}`),m.start({payload:{email:P},onAfterHandle:()=>{F(null)},onErrorHandle:()=>{F(null)}})}),Ye=ht((P)=>{if(!S)return;F(`magic-${P}`),S.start({payload:{email:P},onAfterHandle:()=>{F(null)},onErrorHandle:()=>{F(null)}})}),Ie=ht((P,j)=>{let Z=`temp-${Date.now()}`;y.addUserRole({id:Z,userId:P,roleId:j}),w.start({payload:{userId:P,roleId:j},onAfterHandle:(me)=>{if(y.removeUserRole(Z),me.data){y.addUserRole(me.data),k?.(P,j);let J=y.getUserWithDetails(P);if(J)y.setSelectedUser(J)}},onErrorHandle:()=>{y.removeUserRole(Z)}})}),Pe=ht((P)=>{let j=y.userRoles.find((Z)=>Z.id===P);if(!j)return;y.removeUserRole(P),g.start({payload:{id:P},onAfterHandle:()=>{R?.(j.userId,j.roleId);let Z=y.getUserWithDetails(j.userId);if(Z)y.setSelectedUser(Z)},onErrorHandle:()=>{y.addUserRole(j)}})}),pe=ht((P)=>{if(!b)return;_(!0),b.start({payload:{email:P},onAfterHandle:()=>{_(!1),re(!1),p?.(P),ee(y.currentPage,y.pageSize)},onErrorHandle:()=>{_(!1)}})}),ke=ht((P)=>{if(!b)return;F(`invite-${P}`),b.start({payload:{email:P},onAfterHandle:()=>{F(null)},onErrorHandle:()=>{F(null)}})}),Te={total:y.totalItems,verified:y.users.filter((P)=>P.verifiedAt).length,unverified:y.users.filter((P)=>!P.verifiedAt).length,locked:y.users.filter((P)=>P.isLocked).length},we=y.users.filter((P)=>{let j=y.profiles.find((D)=>D.userId===P.id),Z=j?.firstName||j?.lastName?`${j.firstName||""} ${j.lastName||""}`.toLowerCase():"",me=y.searchQuery===""||P.email.toLowerCase().includes(y.searchQuery.toLowerCase())||Z.includes(y.searchQuery.toLowerCase()),J=y.statusFilter==="all"||y.statusFilter==="locked"&&P.isLocked||y.statusFilter==="active"&&!P.isLocked&&P.verifiedAt||y.statusFilter==="unverified"&&!P.verifiedAt,te=y.roleFilter==="all"||y.userRoles.some((D)=>D.userId===P.id&&D.roleId===y.roleFilter);return me&&J&&te}),be=(P)=>{let j=y.users.find((J)=>J.id===P);if(!j)return{};let Z=y.profiles.find((J)=>J.userId===P),me=y.userRoles.filter((J)=>J.userId===P).map((J)=>({...J,role:y.roles.find((te)=>te.id===J.roleId)}));return{...j,profile:Z||null,userRoles:me}};return Oe("div",{ref:N,className:f(T.container.base,"p-3 sm:p-4 md:p-6 lg:p-8 xl:p-10",r),children:[Oe("div",{ref:L,className:"max-w-7xl mx-auto",children:[Oe("header",{className:f(T.header.wrapper),children:[Oe("div",{children:[Oe("h1",{className:f(T.header.title),children:e},void 0,!1,void 0,this),t&&Oe("p",{className:f(T.header.subtitle),children:t},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Oe("div",{className:f(T.header.actions),children:b&&Oe(V,{variant:"primary",size:"md",onClick:()=>re(!0),leftIcon:Oe("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Oe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M18 9v3m0 0v3m0-3h3m-3 0h-3m-2-5a4 4 0 11-8 0 4 4 0 018 0zM3 20a6 6 0 0112 0v1H3v-1z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),children:[Oe("span",{className:"hidden sm:inline",children:"Invite User"},void 0,!1,void 0,this),Oe("span",{className:"sm:hidden",children:"Invite"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Oe(Ki,{theme:T,totalUsers:Te.total,verifiedUsers:Te.verified,lockedUsers:Te.locked,unverifiedUsers:Te.unverified},void 0,!1,void 0,this),Oe("div",{className:f(T.layout.wrapper),children:[Oe("div",{className:f(T.layout.sidebar.base,y.isDetailPanelOpen?T.layout.sidebar.expanded:T.layout.sidebar.collapsed),children:[Oe(Xi,{theme:T,searchQuery:y.searchQuery,statusFilter:y.statusFilter,roleFilter:y.roleFilter,roles:y.roles,totalCount:y.totalItems,filteredCount:we.length,onSearchChange:H,onStatusChange:y.setStatusFilter,onRoleChange:y.setRoleFilter,onRefresh:se,isLoading:y.isLoading},void 0,!1,void 0,this),Oe("div",{className:f(T.table.wrapper),children:Oe("div",{className:"max-h-[calc(100vh-380px)] sm:max-h-[calc(100vh-340px)] lg:max-h-[calc(100vh-300px)] overflow-y-auto",children:y.isLoading?Oe(Di,{theme:T,count:y.pageSize>10?10:y.pageSize},void 0,!1,void 0,this):we.length===0?Oe("div",{className:f(T.emptyState.wrapper),children:[Oe("svg",{className:f(T.emptyState.icon),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Oe("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0zM7 10a2 2 0 11-4 0 2 2 0 014 0z"},void 0,!1,void 0,this)},void 0,!1,void 0,this),Oe("h3",{className:f(T.emptyState.title),children:"No users found"},void 0,!1,void 0,this),Oe("p",{className:f(T.emptyState.description),children:y.searchQuery||y.statusFilter!=="all"||y.roleFilter!=="all"?"Try adjusting your filters":"No users have been created yet"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):Oe("div",{className:"divide-y divide-zinc-100 dark:divide-zinc-800/50",children:we.map((P)=>Oe(Ei,{theme:T,user:be(P.id),roles:y.roles,isSelected:y.selectedUser?.id===P.id,onSelect:U},P.id,!1,void 0,this))},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),y.totalPages>1&&Oe(Ji,{theme:T,currentPage:y.currentPage,totalPages:y.totalPages,totalItems:y.totalItems,pageSize:y.pageSize,pageSizeOptions:[10,25,50,100],onPageChange:G,onPageSizeChange:K},void 0,!1,void 0,this)]},void 0,!0,void 0,this),y.isDetailPanelOpen&&Oe("div",{className:f(T.layout.main),children:Oe(Zi,{theme:T,user:y.selectedUser,roles:y.roles,allUserRoles:y.userRoles,isOpen:y.isDetailPanelOpen,actionLoading:O,onClose:C,onVerifyEmail:de,onLockAccount:B,onUnlockAccount:ae,onResetPassword:ge,onSendMagicLink:Ye,onResendInvite:ke,onAssignRole:Ie,onRemoveRole:Pe,hasPasswordReset:!!m,hasMagicLink:!!S,hasInvite:!!b},void 0,!1,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Oe(_i,{theme:T,isOpen:Y,isLoading:E,onClose:()=>re(!1),onInvite:pe},void 0,!1,void 0,this)]},void 0,!0,void 0,this)}import{useGSAP as dd}from"@gsap/react";import cd from"gsap";import{useEffect as to,useEffectEvent as ha,useRef as ro}from"react";import{batch as zu,createStore as Nu}from"h-state";var Pu={step:"verifying",message:"Verifying your email...",email:"",cooldown:0,resendStatus:"idle",resendMessage:""},{useStore:fa}=Nu(Pu,{setStep:(e)=>(t)=>{e.step=t},setMessage:(e)=>(t)=>{e.message=t},setEmail:(e)=>(t)=>{e.email=t},setCooldown:(e)=>(t)=>{e.cooldown=t},decrementCooldown:(e)=>()=>{if(e.cooldown>0)e.cooldown=e.cooldown-1},setResendStatus:(e)=>(t)=>{e.resendStatus=t},setResendMessage:(e)=>(t)=>{e.resendMessage=t},reset:(e)=>()=>{zu(()=>{e.step="verifying",e.message="Verifying your email...",e.email="",e.cooldown=0,e.resendStatus="idle",e.resendMessage=""})}});var eo={container:{base:"min-h-screen w-full flex items-center justify-center bg-gradient-to-br from-zinc-50 to-zinc-100 dark:from-zinc-900 dark:to-zinc-950"},card:{base:"w-full max-w-md p-8",background:"bg-white/80 dark:bg-zinc-900/80 backdrop-blur-xl",border:"border border-white/20 dark:border-zinc-800/50",shadow:"shadow-2xl",rounded:"rounded-2xl"},content:{wrapper:"flex flex-col items-center text-center"},states:{verifying:{spinner:"w-16 h-16 border-4 border-blue-500 border-t-transparent rounded-full animate-spin mb-6",title:"text-2xl font-bold text-zinc-900 dark:text-white mb-2",subtitle:"text-zinc-600 dark:text-zinc-400"},success:{iconWrapper:"w-16 h-16 bg-green-100 dark:bg-green-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 text-green-500",title:"text-2xl font-bold text-zinc-900 dark:text-white mb-2",subtitle:"text-zinc-600 dark:text-zinc-400 mb-4",redirectText:"text-sm text-zinc-500 dark:text-zinc-500"},error:{iconWrapper:"w-16 h-16 bg-red-100 dark:bg-red-900/30 rounded-full flex items-center justify-center mb-6",icon:"w-8 h-8 text-red-500",title:"text-2xl font-bold text-zinc-900 dark:text-white mb-2",subtitle:"text-zinc-600 dark:text-zinc-400 mb-4"}},resendForm:{wrapper:"w-full mt-4 p-4 bg-zinc-50 dark:bg-zinc-800/50 rounded-xl",label:"text-sm text-zinc-600 dark:text-zinc-400 mb-3",input:"w-full px-4 py-2 mb-3 border border-zinc-300 dark:border-zinc-600 rounded-lg bg-white dark:bg-zinc-800 text-zinc-900 dark:text-white placeholder-zinc-400 focus:outline-none focus:ring-2 focus:ring-blue-500",button:"w-full px-4 py-2 bg-blue-600 text-white rounded-lg hover:bg-blue-700 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",buttonContent:"flex items-center justify-center gap-2",buttonSpinner:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin",messageSuccess:"mt-2 text-sm text-green-600 dark:text-green-400",messageError:"mt-2 text-sm text-red-600 dark:text-red-400"},backButton:"mt-4 px-6 py-2 text-zinc-600 dark:text-zinc-400 hover:text-zinc-900 dark:hover:text-white transition-colors"};import{jsxDEV as Je,Fragment as no}from"react/jsx-dev-runtime";cd.registerPlugin(dd);function ld(e,t){if(!e?.message)return t;try{let n=JSON.parse(e.message).message||"";if(n.includes("Failed query")||n.includes("select")||n.includes("params:"))return"An error occurred. Please try again later.";return n||t}catch{if(e.message.includes("Failed query")||e.message.includes("select"))return"An error occurred. Please try again later.";return e.message}}function ud({token:e,email:t="",verifyEmailAction:r,resendVerificationAction:n,onSuccess:a,onBackToLogin:i,backToLoginHref:o,showResendForm:s=!0,redirectDelay:l=3000,className:c}){let d=eo,u=ro(null),w=ro(null),g=ro(!1),m=fa(),S=ha((p)=>{if(p)m.setEmail(p)}),b=ha((p)=>{if(!p){m.setStep("error"),m.setMessage("Invalid verification link. No token provided.");return}if(g.current)return;g.current=!0,r.start({payload:{token:p},onAfterHandle:(T)=>{if(!T){m.setStep("error"),m.setMessage("Verification failed. Please try again.");return}if(T.success)m.setStep("success"),m.setMessage(T.message||"Email verified successfully!"),setTimeout(()=>{if(a)a();else if(i)i()},l);else m.setStep("error"),m.setMessage(T.message||"Verification failed. Please try again.")},onErrorHandle:(T)=>{m.setStep("error"),m.setMessage(ld(T,"Verification failed. Please try again."))}})}),z=ha(()=>{m.decrementCooldown()});to(()=>{S(t)},[t]),to(()=>{if(e)b(e);else m.setStep("error"),m.setMessage("Invalid verification link. No token provided.");return()=>{m.reset()}},[e]),to(()=>{if(m.cooldown<=0)return;let p=setInterval(z,1000);return()=>clearInterval(p)},[m.cooldown]),dd(()=>{if(!w.current)return;cd.fromTo(w.current,{opacity:0,y:30,scale:0.95},{opacity:1,y:0,scale:1,duration:0.6,ease:"power3.out"})},{scope:u});let k=ha(()=>{if(!m.email||m.cooldown>0||m.resendStatus==="loading"||!n)return;m.setResendStatus("loading"),m.setResendMessage(""),n.start({payload:{email:m.email},onAfterHandle:(p)=>{if(!p){m.setResendStatus("error"),m.setResendMessage("Failed to resend verification email.");return}if(p.success){if(m.setResendStatus("success"),m.setResendMessage(p.message||"Verification email sent!"),p.data?.cooldownSeconds)m.setCooldown(p.data.cooldownSeconds)}else if(m.setResendStatus("error"),m.setResendMessage(p.message||"Failed to resend."),p.data?.cooldownRemaining)m.setCooldown(p.data.cooldownRemaining)},onErrorHandle:(p)=>{m.setResendStatus("error"),m.setResendMessage(ld(p,"Failed to resend verification email."))}})}),R=()=>{if(i)i();else if(o)window.location.href=o};return Je("main",{ref:u,className:f(d.container.base,c),children:Je("article",{ref:w,className:f(d.card.base,d.card.background,d.card.border,d.card.shadow,d.card.rounded),children:Je("div",{className:d.content.wrapper,children:[m.step==="verifying"&&Je(no,{children:[Je("div",{className:d.states.verifying.spinner},void 0,!1,void 0,this),Je("h1",{className:d.states.verifying.title,children:"Verifying Email"},void 0,!1,void 0,this),Je("p",{className:d.states.verifying.subtitle,children:m.message},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.step==="success"&&Je(no,{children:[Je("div",{className:d.states.success.iconWrapper,children:Je("svg",{className:d.states.success.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Je("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Je("h1",{className:d.states.success.title,children:"Email Verified!"},void 0,!1,void 0,this),Je("p",{className:d.states.success.subtitle,children:m.message},void 0,!1,void 0,this),Je("p",{className:d.states.success.redirectText,children:"Redirecting to login..."},void 0,!1,void 0,this)]},void 0,!0,void 0,this),m.step==="error"&&Je(no,{children:[Je("div",{className:d.states.error.iconWrapper,children:Je("svg",{className:d.states.error.icon,fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:Je("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"},void 0,!1,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this),Je("h1",{className:d.states.error.title,children:"Verification Failed"},void 0,!1,void 0,this),Je("p",{className:d.states.error.subtitle,children:m.message},void 0,!1,void 0,this),s&&n&&Je("div",{className:d.resendForm.wrapper,children:[Je("p",{className:d.resendForm.label,children:"Request a new verification email:"},void 0,!1,void 0,this),Je("input",{type:"email",value:m.email,onChange:(p)=>m.setEmail(p.target.value),placeholder:"Enter your email",className:d.resendForm.input},void 0,!1,void 0,this),Je("button",{type:"button",onClick:k,disabled:!m.email||m.cooldown>0||m.resendStatus==="loading",className:d.resendForm.button,children:m.resendStatus==="loading"?Je("span",{className:d.resendForm.buttonContent,children:[Je("span",{className:d.resendForm.buttonSpinner},void 0,!1,void 0,this),"Sending..."]},void 0,!0,void 0,this):m.cooldown>0?`Resend in ${m.cooldown}s`:"Resend Verification Email"},void 0,!1,void 0,this),m.resendMessage&&Je("p",{className:m.resendStatus==="success"?d.resendForm.messageSuccess:d.resendForm.messageError,children:m.resendMessage},void 0,!1,void 0,this)]},void 0,!0,void 0,this),(i||o)&&Je("button",{type:"button",onClick:R,className:d.backButton,children:"Go to Login"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)},void 0,!1,void 0,this)},void 0,!1,void 0,this)}export{fa as useVerifyEmailStore,ga as useUsersStore,Kr as useSetPasswordStore,ua as useResetPasswordStore,da as useRegisterStore,oa as useProfileStore,hi as useNucleusEntity,Kn as useMagicLinkVerifyStore,Gr as useLoginStore,Yn as useForgotPasswordStore,Fn as useDevicesStore,Cn as useChangePasswordStore,kn as useAuthorizationStore,Yr as toUpperSnakeCase,gi as singularize,yi as shouldExcludeFromForm,Zn as shouldExcludeColumn,Qn as magicLinkVerifyPageTheme,ln as isReferenceColumn,ki as isJsonColumn,Xn as isArrayColumn,r0 as getDefaultValue,En as getColumnType,Vc as generateGetByIdEndpointKey,bi as generateEntityEndpointKey,jc as generateDistinctEndpointKey,fi as generateBulkEndpointKey,zt as formatLabel,mo as extendAuthorizationPageTheme,f as cn,xn as captchaTheme,ot as authorizationPageTheme,ud as VerifyEmailPage,sd as UsersPage,Xl as SetPasswordPage,Ot as SelectBox,ea as SearchBox,fo as RoleList,bo as RoleClaimEditor,Jl as ResetPasswordPage,$l as RegisterPage,Vn as RangePicker,Hl as ProfilePage,ia as ProfileHeader,aa as PhoneCard,la as PasswordStrengthIndicator,Fe as NucleusTextInput,B0 as NucleusEntityShowcase,dl as MagicLinkVerifyPage,ol as LoginPage,Vs as ForgotPasswordPage,Ks as DevicesPage,$n as DevicesHeader,On as DeviceCard,An as DatePicker,Bn as DataTable,_r as DEFAULT_PASSWORD_POLICY,go as ClaimList,Dt as Checkbox,_o as ChangePasswordPage,zn as Captcha,V as Button,po as AuthorizationPage,na as AddressCard,lt as AbstractAnimatedBackground};
|
|
1
|
+
// fe/index.ts
|
|
2
|
+
import { AbstractAnimatedBackground } from "./components/AbstractAnimatedBackground";
|
|
3
|
+
import {
|
|
4
|
+
AuthorizationPage,
|
|
5
|
+
authorizationPageTheme,
|
|
6
|
+
ClaimList,
|
|
7
|
+
extendAuthorizationPageTheme,
|
|
8
|
+
RoleClaimEditor,
|
|
9
|
+
RoleList,
|
|
10
|
+
useAuthorizationStore
|
|
11
|
+
} from "./components/AuthorizationPage";
|
|
12
|
+
import { Button } from "./components/Button";
|
|
13
|
+
import { Captcha, captchaTheme } from "./components/Captcha";
|
|
14
|
+
import {
|
|
15
|
+
ChangePasswordPage,
|
|
16
|
+
useChangePasswordStore
|
|
17
|
+
} from "./components/ChangePasswordPage";
|
|
18
|
+
import { Checkbox } from "./components/Checkbox";
|
|
19
|
+
import { DataTable } from "./components/DataTable";
|
|
20
|
+
import { DatePicker } from "./components/DatePicker";
|
|
21
|
+
import {
|
|
22
|
+
DeviceCard,
|
|
23
|
+
DevicesHeader,
|
|
24
|
+
DevicesPage,
|
|
25
|
+
useDevicesStore
|
|
26
|
+
} from "./components/DevicesPage";
|
|
27
|
+
import {
|
|
28
|
+
ForgotPasswordPage,
|
|
29
|
+
useForgotPasswordStore
|
|
30
|
+
} from "./components/ForgotPasswordPage";
|
|
31
|
+
import { LoginPage, useLoginStore } from "./components/LoginPage";
|
|
32
|
+
import {
|
|
33
|
+
MagicLinkVerifyPage,
|
|
34
|
+
magicLinkVerifyPageTheme,
|
|
35
|
+
useMagicLinkVerifyStore
|
|
36
|
+
} from "./components/MagicLinkVerifyPage";
|
|
37
|
+
import { NucleusEntityShowcase } from "./components/NucleusEntityShowcase";
|
|
38
|
+
import { NucleusTextInput } from "./components/NucleusTextInput";
|
|
39
|
+
import {
|
|
40
|
+
AddressCard,
|
|
41
|
+
PhoneCard,
|
|
42
|
+
ProfileHeader,
|
|
43
|
+
ProfilePage,
|
|
44
|
+
useProfileStore
|
|
45
|
+
} from "./components/ProfilePage";
|
|
46
|
+
import { RangePicker } from "./components/RangePicker";
|
|
47
|
+
import {
|
|
48
|
+
PasswordStrengthIndicator,
|
|
49
|
+
RegisterPage,
|
|
50
|
+
useRegisterStore
|
|
51
|
+
} from "./components/RegisterPage";
|
|
52
|
+
import {
|
|
53
|
+
ResetPasswordPage,
|
|
54
|
+
useResetPasswordStore
|
|
55
|
+
} from "./components/ResetPasswordPage";
|
|
56
|
+
import { SearchBox } from "./components/SearchBox";
|
|
57
|
+
import { SelectBox } from "./components/SelectBox";
|
|
58
|
+
import {
|
|
59
|
+
DEFAULT_PASSWORD_POLICY,
|
|
60
|
+
SetPasswordPage,
|
|
61
|
+
useSetPasswordStore
|
|
62
|
+
} from "./components/SetPasswordPage";
|
|
63
|
+
import {
|
|
64
|
+
UsersPage,
|
|
65
|
+
useUsersStore
|
|
66
|
+
} from "./components/UsersPage";
|
|
67
|
+
import {
|
|
68
|
+
useVerifyEmailStore,
|
|
69
|
+
VerifyEmailPage
|
|
70
|
+
} from "./components/VerifyEmailPage";
|
|
71
|
+
import { useNucleusEntity } from "./hooks/useNucleusEntity";
|
|
72
|
+
import { cn } from "./utils/cn";
|
|
73
|
+
import {
|
|
74
|
+
formatLabel,
|
|
75
|
+
getColumnType,
|
|
76
|
+
getDefaultValue,
|
|
77
|
+
isArrayColumn,
|
|
78
|
+
isJsonColumn,
|
|
79
|
+
isReferenceColumn,
|
|
80
|
+
shouldExcludeColumn,
|
|
81
|
+
shouldExcludeFromForm
|
|
82
|
+
} from "./utils/columnUtils";
|
|
83
|
+
import {
|
|
84
|
+
generateBulkEndpointKey,
|
|
85
|
+
generateDistinctEndpointKey,
|
|
86
|
+
generateEntityEndpointKey,
|
|
87
|
+
generateGetByIdEndpointKey,
|
|
88
|
+
singularize,
|
|
89
|
+
toUpperSnakeCase
|
|
90
|
+
} from "./utils/endpointKeys";
|
|
91
|
+
export {
|
|
92
|
+
useVerifyEmailStore,
|
|
93
|
+
useUsersStore,
|
|
94
|
+
useSetPasswordStore,
|
|
95
|
+
useResetPasswordStore,
|
|
96
|
+
useRegisterStore,
|
|
97
|
+
useProfileStore,
|
|
98
|
+
useNucleusEntity,
|
|
99
|
+
useMagicLinkVerifyStore,
|
|
100
|
+
useLoginStore,
|
|
101
|
+
useForgotPasswordStore,
|
|
102
|
+
useDevicesStore,
|
|
103
|
+
useChangePasswordStore,
|
|
104
|
+
useAuthorizationStore,
|
|
105
|
+
toUpperSnakeCase,
|
|
106
|
+
singularize,
|
|
107
|
+
shouldExcludeFromForm,
|
|
108
|
+
shouldExcludeColumn,
|
|
109
|
+
magicLinkVerifyPageTheme,
|
|
110
|
+
isReferenceColumn,
|
|
111
|
+
isJsonColumn,
|
|
112
|
+
isArrayColumn,
|
|
113
|
+
getDefaultValue,
|
|
114
|
+
getColumnType,
|
|
115
|
+
generateGetByIdEndpointKey,
|
|
116
|
+
generateEntityEndpointKey,
|
|
117
|
+
generateDistinctEndpointKey,
|
|
118
|
+
generateBulkEndpointKey,
|
|
119
|
+
formatLabel,
|
|
120
|
+
extendAuthorizationPageTheme,
|
|
121
|
+
cn,
|
|
122
|
+
captchaTheme,
|
|
123
|
+
authorizationPageTheme,
|
|
124
|
+
VerifyEmailPage,
|
|
125
|
+
UsersPage,
|
|
126
|
+
SetPasswordPage,
|
|
127
|
+
SelectBox,
|
|
128
|
+
SearchBox,
|
|
129
|
+
RoleList,
|
|
130
|
+
RoleClaimEditor,
|
|
131
|
+
ResetPasswordPage,
|
|
132
|
+
RegisterPage,
|
|
133
|
+
RangePicker,
|
|
134
|
+
ProfilePage,
|
|
135
|
+
ProfileHeader,
|
|
136
|
+
PhoneCard,
|
|
137
|
+
PasswordStrengthIndicator,
|
|
138
|
+
NucleusTextInput,
|
|
139
|
+
NucleusEntityShowcase,
|
|
140
|
+
MagicLinkVerifyPage,
|
|
141
|
+
LoginPage,
|
|
142
|
+
ForgotPasswordPage,
|
|
143
|
+
DevicesPage,
|
|
144
|
+
DevicesHeader,
|
|
145
|
+
DeviceCard,
|
|
146
|
+
DatePicker,
|
|
147
|
+
DataTable,
|
|
148
|
+
DEFAULT_PASSWORD_POLICY,
|
|
149
|
+
ClaimList,
|
|
150
|
+
Checkbox,
|
|
151
|
+
ChangePasswordPage,
|
|
152
|
+
Captcha,
|
|
153
|
+
Button,
|
|
154
|
+
AuthorizationPage,
|
|
155
|
+
AddressCard,
|
|
156
|
+
AbstractAnimatedBackground
|
|
157
|
+
};
|