import{a2 as v,p as o,a4 as s}from"./index-BSPIaiZU.js";import{u as p,b as u,a as c}from"./query-PJ0ZdjbV.js";/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const m=v("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/**
 * @license lucide-react v0.469.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const h=v("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]),i="/leave",a={leaveTypes:["leave","leave-types"],policyLeaveTypes:["leave","policy-leave-types"],policies:["leave","policies"],policy:e=>["leave","policies",e],allocations:["leave","allocations"],balance:["leave","balance"],applications:["leave","applications"],application:e=>["leave","applications",e],approvals:["leave","approvals"],encashments:["leave","encashments"],compOffPolicies:["leave","comp-off-policies"],compOffRequests:["leave","comp-off-requests"],compOffRequest:e=>["leave","comp-off-requests",e],teamCalendar:["leave","team-calendar"],dashboard:["leave","dashboard"],reports:["leave","reports"],analytics:["leave","analytics"],policyAssignments:["leave","policy-assignments"],blackoutPeriods:["leave","blackout-periods"],amendments:["leave","amendments"],mandatory:["leave","mandatory"],teamCoverage:["leave","team-coverage"],employeeTracking:["leave","employee-tracking"],eligibleTypes:["leave","eligible-types"]};function F(e){return p({queryKey:[...a.leaveTypes,e],queryFn:()=>o.get(`${i}/types/`,{params:e}).then(t=>t.data)})}function g(){const e=u();return c({mutationFn:t=>o.post(`${i}/types/`,t).then(n=>n.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.leaveTypes}),s.success("Leave type created")},onError:()=>s.error("Failed to create leave type")})}function $(){const e=u();return c({mutationFn:({id:t,...n})=>o.patch(`${i}/types/${t}/`,n).then(r=>r.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.leaveTypes}),s.success("Leave type updated")},onError:()=>s.error("Failed to update leave type")})}function K(){const e=u();return c({mutationFn:t=>o.delete(`${i}/types/${t}/`),onSuccess:()=>{e.invalidateQueries({queryKey:a.leaveTypes}),s.success("Leave type deleted")},onError:()=>s.error("Failed to delete leave type")})}function b(e){return p({queryKey:[...a.policyLeaveTypes,e],queryFn:()=>o.get(`${i}/policy-leave-types/`,{params:e}).then(t=>t.data)})}function Q(){const e=u();return c({mutationFn:t=>o.post(`${i}/policy-leave-types/`,t).then(n=>n.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.policyLeaveTypes}),e.invalidateQueries({queryKey:a.policies}),s.success("Leave type added to policy")},onError:()=>s.error("Failed to add leave type to policy")})}function L(){const e=u();return c({mutationFn:({id:t,...n})=>o.patch(`${i}/policy-leave-types/${t}/`,n).then(r=>r.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.policyLeaveTypes}),e.invalidateQueries({queryKey:a.policies}),s.success("Policy leave type updated")},onError:()=>s.error("Failed to update policy leave type")})}function E(){const e=u();return c({mutationFn:t=>o.delete(`${i}/policy-leave-types/${t}/`),onSuccess:()=>{e.invalidateQueries({queryKey:a.policyLeaveTypes}),e.invalidateQueries({queryKey:a.policies}),s.success("Leave type removed from policy")},onError:()=>s.error("Failed to remove leave type from policy")})}function A(e){return p({queryKey:[...a.policies,e],queryFn:()=>o.get(`${i}/policies/`,{params:e}).then(t=>t.data)})}function S(){const e=u();return c({mutationFn:t=>o.post(`${i}/policies/`,t).then(n=>n.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.policies}),s.success("Leave policy created")},onError:()=>s.error("Failed to create policy")})}function T(){const e=u();return c({mutationFn:({id:t,...n})=>o.patch(`${i}/policies/${t}/`,n).then(r=>r.data),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:a.policies}),e.invalidateQueries({queryKey:a.policy(n.id)}),s.success("Leave policy updated")},onError:()=>s.error("Failed to update policy")})}function k(e){return p({queryKey:[...a.allocations,e],queryFn:()=>o.get(`${i}/allocations/`,{params:e}).then(t=>t.data)})}function C(){const e=u();return c({mutationFn:({id:t,...n})=>o.post(`${i}/allocations/${t}/adjust/`,n).then(r=>r.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.allocations}),e.invalidateQueries({queryKey:a.balance}),s.success("Allocation adjusted")},onError:()=>s.error("Failed to adjust allocation")})}function j(e){return p({queryKey:[...a.balance,e],queryFn:()=>o.get(`${i}/allocations/balance/`,{params:e}).then(t=>t.data),enabled:!!(e!=null&&e.employee)})}function O(e){return p({queryKey:a.application(e),queryFn:()=>o.get(`${i}/applications/${e}/`).then(t=>t.data),enabled:!!e})}function P(e){return p({queryKey:[...a.applications,e],queryFn:()=>o.get(`${i}/applications/`,{params:e}).then(t=>t.data)})}function M(){const e=u();return c({mutationFn:t=>{const{document:n,...r}=t;if(n instanceof File){const y=new FormData;return Object.entries(r).forEach(([d,l])=>{l!=null&&y.append(d,String(l))}),y.append("document",n),o.post(`${i}/applications/`,y,{headers:{"Content-Type":void 0}}).then(d=>d.data)}return o.post(`${i}/applications/`,r).then(y=>y.data)},onSuccess:()=>{e.invalidateQueries({queryKey:a.applications}),e.invalidateQueries({queryKey:a.balance}),e.invalidateQueries({queryKey:a.dashboard}),s.success("Leave application submitted")},onError:t=>{var r;const n=(r=t==null?void 0:t.response)==null?void 0:r.data;if(n){const y=l=>typeof l=="string"?l:Array.isArray(l)?l.map(y).join(", "):typeof l=="object"&&l!==null?Object.values(l).map(y).join(", "):String(l),d=Object.values(n).map(y).join("; ");s.error(d||"Failed to submit leave application")}else s.error("Failed to submit leave application")}})}function R(){const e=u();return c({mutationFn:t=>o.post(`${i}/applications/apply-multi/`,t).then(n=>n.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.applications}),e.invalidateQueries({queryKey:a.balance}),e.invalidateQueries({queryKey:a.dashboard}),s.success("Leave application submitted")},onError:t=>{var r;const n=(r=t==null?void 0:t.response)==null?void 0:r.data;if(n){const y=l=>typeof l=="string"?l:Array.isArray(l)?l.map(y).join(", "):typeof l=="object"&&l!==null?Object.values(l).map(y).join(", "):String(l),d=Object.values(n).map(y).join("; ");s.error(d||"Failed to submit leave application")}else s.error("Failed to submit leave application")}})}function D(){const e=u();return c({mutationFn:({id:t,...n})=>o.post(`${i}/applications/${t}/approve/`,n).then(r=>r.data),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:a.applications}),e.invalidateQueries({queryKey:a.approvals}),e.invalidateQueries({queryKey:a.balance}),e.invalidateQueries({queryKey:a.dashboard}),s.success(`Leave ${n.action==="approve"?"approved":"rejected"}`)},onError:()=>s.error("Failed to process leave action")})}function x(){const e=u();return c({mutationFn:({id:t,cancellation_reason:n})=>o.post(`${i}/applications/${t}/cancel/`,{cancellation_reason:n}).then(r=>r.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.applications}),e.invalidateQueries({queryKey:a.balance}),e.invalidateQueries({queryKey:a.dashboard}),s.success("Leave application cancelled")},onError:()=>s.error("Failed to cancel application")})}function _(){const e=u();return c({mutationFn:t=>o.post(`${i}/applications/bulk-approve/`,{ids:t.ids}).then(n=>n.data),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:a.applications}),e.invalidateQueries({queryKey:a.approvals}),e.invalidateQueries({queryKey:a.balance}),s.success(`${n.ids.length} application(s) approved`)},onError:()=>s.error("Failed to process bulk action")})}function w(){return c({mutationFn:e=>o.post(`${i}/applications/preview/`,e).then(t=>t.data)})}function B(e,t){return p({queryKey:[...a.eligibleTypes,e,t],queryFn:()=>o.get(`${i}/applications/eligible-types/`,{params:{employee:e,from_date:t||void 0}}).then(n=>n.data),enabled:!!e})}function H(e){return p({queryKey:[...a.encashments,e],queryFn:()=>o.get(`${i}/encashments/`,{params:e}).then(t=>t.data)})}function U(){const e=u();return c({mutationFn:t=>o.post(`${i}/encashments/`,t).then(n=>n.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.encashments}),s.success("Encashment request submitted")},onError:()=>s.error("Failed to submit encashment request")})}function z(){const e=u();return c({mutationFn:({id:t,action:n,comments:r})=>o.post(`${i}/encashments/${t}/${n}/`,{comments:r}).then(y=>y.data),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:a.encashments}),e.invalidateQueries({queryKey:a.balance}),s.success(`Encashment ${n.action==="approve"?"approved":"rejected"}`)},onError:()=>s.error("Failed to process encashment")})}function W(e){return p({queryKey:[...a.compOffPolicies,e],queryFn:()=>o.get(`${i}/comp-off-policies/`,{params:e}).then(t=>t.data)})}function G(e){return p({queryKey:a.compOffRequest(e),queryFn:()=>o.get(`${i}/comp-off-requests/${e}/`).then(t=>t.data),enabled:!!e})}function J(e){return p({queryKey:[...a.compOffRequests,e],queryFn:()=>o.get(`${i}/comp-off-requests/`,{params:e}).then(t=>t.data)})}function N(){const e=u();return c({mutationFn:t=>o.post(`${i}/comp-off-requests/`,t).then(n=>n.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.compOffRequests}),s.success("Comp-off request submitted")},onError:()=>s.error("Failed to submit comp-off request")})}function I(e){return p({queryKey:[...a.teamCalendar,e],queryFn:()=>o.get(`${i}/team-calendar/`,{params:e}).then(t=>t.data)})}function V(){return p({queryKey:a.dashboard,queryFn:()=>o.get(`${i}/dashboard/`).then(e=>e.data)})}function X(e){return p({queryKey:[...a.reports,e],queryFn:()=>o.get(`${i}/reports/`,{params:e}).then(t=>t.data),enabled:!!e})}function Y(e){return p({queryKey:[...a.analytics,e],queryFn:()=>o.get(`${i}/analytics/`,{params:e}).then(t=>t.data)})}function Z(e){return p({queryKey:[...a.mandatory,e],queryFn:()=>o.get(`${i}/mandatory-trackers/`,{params:e}).then(t=>t.data)})}function ee(){const e=u();return c({mutationFn:t=>o.post(`${i}/mandatory-trackers/generate/`,t?{financial_year:t}:{}).then(n=>n.data),onSuccess:t=>{e.invalidateQueries({queryKey:a.mandatory}),s.success(`Mandatory leave compliance refreshed (${t.generated} employees)`)},onError:()=>s.error("Failed to refresh mandatory leave compliance")})}function te(e){return p({queryKey:[...a.policyAssignments,e],queryFn:()=>o.get(`${i}/policy-assignments/`,{params:e}).then(t=>t.data)})}function ae(){const e=u();return c({mutationFn:t=>o.post(`${i}/policy-assignments/`,t).then(n=>n.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.policyAssignments}),s.success("Policy assignment created")},onError:()=>s.error("Failed to create policy assignment")})}function ne(){const e=u();return c({mutationFn:({id:t,...n})=>o.patch(`${i}/policy-assignments/${t}/`,n).then(r=>r.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.policyAssignments}),s.success("Policy assignment updated")},onError:()=>s.error("Failed to update policy assignment")})}function se(){const e=u();return c({mutationFn:t=>o.delete(`${i}/policy-assignments/${t}/`),onSuccess:()=>{e.invalidateQueries({queryKey:a.policyAssignments}),s.success("Policy assignment deleted")},onError:()=>s.error("Failed to delete policy assignment")})}function oe(e){return p({queryKey:[...a.employeeTracking,e],queryFn:()=>o.get(`${i}/employee-tracking/employee-tracking/`,{params:e}).then(t=>t.data),enabled:!!(e!=null&&e.employee)})}function ie(){const e=u();return c({mutationFn:({id:t,action:n})=>o.post(`${i}/comp-off-requests/${t}/approve/`,{action:n}).then(r=>r.data),onSuccess:(t,n)=>{e.invalidateQueries({queryKey:a.compOffRequests}),e.invalidateQueries({queryKey:a.balance}),s.success(`Comp-off request ${n.action==="approve"?"approved":"rejected"}`)},onError:()=>s.error("Failed to process comp-off request")})}function re(){const e=u();return c({mutationFn:t=>o.delete(`${i}/comp-off-requests/${t}/`).then(n=>n.data),onSuccess:()=>{e.invalidateQueries({queryKey:a.compOffRequests}),e.invalidateQueries({queryKey:a.balance}),s.success("Comp-off request deleted")},onError:()=>s.error("Failed to delete comp-off request")})}export{W as A,G as B,X as C,Y as D,Z as E,ee as F,te as G,ae as H,ne as I,se as J,g as K,$ as L,K as M,O as N,oe as O,k as P,C as Q,m as T,h as W,V as a,j as b,B as c,M as d,R as e,w as f,P as g,x as h,D as i,_ as j,I as k,A as l,S as m,T as n,b as o,Q as p,L as q,E as r,H as s,U as t,F as u,z as v,J as w,N as x,ie as y,re as z};
