const f={standardDailyHours:8,workingDaysPerMonth:26,otMultiplier:1.5},m=()=>{try{const t=localStorage.getItem("ot_settings");if(t)return JSON.parse(t)}catch(t){console.error("Error reading OT settings from local storage:",t)}return f},O=t=>{try{localStorage.setItem("ot_settings",JSON.stringify(t))}catch(s){console.error("Error saving OT settings to local storage:",s)}},S=(t,s,c=new Date,a=m())=>{const u=c.getMonth(),g=c.getFullYear(),d=s.filter(r=>{if(r.employeeId!==t.id)return!1;const o=new Date(r.timestamp);return o.getMonth()===u&&o.getFullYear()===g}).reduce((r,o)=>{const e=new Date(o.timestamp).toDateString();return r[e]||(r[e]=[]),r[e].push(o),r},{});let n=0;Object.values(d).forEach(r=>{const o=r.find(e=>e.hours!==void 0);o&&o.hours&&(n+=o.hours)});const l=a.standardDailyHours*a.workingDaysPerMonth,i=Math.max(0,n-l),h=t.hourlyRate||(t.salary?t.salary/l:0),y=i*h*a.otMultiplier;return{totalHours:n,standardHours:l,otHours:i,otPay:y}};export{S as c,m as g,O as s};
