1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[85454],{85454:(e,t,a)=>{a.d(t,{default:()=>U});var s=a(95155),l=a(12115),i=a(29502),r=a(23327),n=a(26983),o=a(52056),d=a(71360),c=a(6191),m=a(75426),b=a(69425),x=a(69587),u=a(35299),h=a(70143),y=a(22957),p=a(24253),g=a(90368),f=a(27937),v=a(52679);let w={booking:"bg-blue-100 text-blue-900 border-blue-200",hold:"bg-blue-50 text-blue-700 border-blue-100 border-dashed",slot:"bg-purple-100 text-purple-900 border-purple-200",timeOff:"bg-gray-200 text-gray-700 border-gray-300",selection:"bg-gray-100 text-gray-600 border-gray-200"};function j(e){let t=(0,y.Up)(e);return(0,y.fi)(e,0===t?-6:1-t)}function k(e){let{hours:t,today:a,language:i,use12HourTime:r,onAddTimeOff:n,dashboardUrl:o,onOpenTimeOff:d}=e,{t:m}=(0,h.Bd)(i),[b,x]=(0,l.useState)("week"),[p,k]=(0,l.useState)(()=>j(a)),[N,C]=(0,l.useState)(()=>"".concat(a.slice(0,7),"-01")),[O,S]=(0,l.useState)({}),[T,A]=(0,l.useState)(!1),[M,D]=(0,l.useState)(!1),U=(0,l.useMemo)(()=>Array.from({length:7},(e,t)=>(0,y.fi)(p,t)),[p]),H=(0,l.useMemo)(()=>{let e=j(N);return Array.from({length:42},(t,a)=>(0,y.fi)(e,a))},[N]),_="week"===b?U:H,B=(e,t)=>{let[a,s]=e.split("-").map(Number),l=new Date(Date.UTC(a,s-1+t,1));return"".concat(l.getUTCFullYear(),"-").concat(String(l.getUTCMonth()+1).padStart(2,"0"),"-01")},z=(0,l.useCallback)(async()=>{A(!0),D(!1);try{let e=await fetch("/api/sellers/availability?from=".concat(_[0],"&to=").concat(_[_.length-1])),t=await e.json().catch(()=>({}));if(!e.ok)throw Error((null==t?void 0:t.error)||"load failed");S(t.busy||{})}catch(e){D(!0)}finally{A(!1)}},[_]);(0,l.useEffect)(()=>{z()},[z]);let Z=e=>(0,v.pL)((0,y.$H)(e),!!r,i||"en-US"),I=e=>"".concat(Z(e.start)," - ").concat(Z(e.end)),L=e=>{switch(e){case"booking":return m("availability.week.kindBooking");case"hold":return m("availability.week.kindHold");case"slot":return m("availability.week.kindSlot");case"timeOff":return m("availability.week.kindTimeOff");default:return""}},F=e=>{let[t,a,s]=e.split("-").map(Number);return new Date(Date.UTC(t,a-1,s)).toLocaleDateString(i||"en",{weekday:"short",day:"numeric",month:"short",timeZone:"UTC"})};return(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between gap-2 mb-3 flex-wrap",children:[(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs","aria-label":"week"===b?m("availability.week.previous"):m("availability.month.previous"),onClick:()=>"week"===b?k(e=>(0,y.fi)(e,-7)):C(e=>B(e,-1)),children:(0,s.jsx)(g.A,{className:"w-4 h-4"})}),(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs",onClick:()=>"week"===b?k(j(a)):C("".concat(a.slice(0,7),"-01")),children:"week"===b?m("availability.week.thisWeek"):m("availability.month.thisMonth")}),(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs","aria-label":"week"===b?m("availability.week.next"):m("availability.month.next"),onClick:()=>"week"===b?k(e=>(0,y.fi)(e,7)):C(e=>B(e,1)),children:(0,s.jsx)(f.A,{className:"w-4 h-4"})})]}),(0,s.jsxs)("div",{className:"text-sm text-gray-500 flex items-center gap-2",children:[T&&(0,s.jsx)(u.A,{className:"w-4 h-4 animate-spin"}),(0,s.jsx)("span",{children:"week"===b?"".concat(F(U[0])," â ").concat(F(U[6])):(e=>{let[t,a]=e.split("-").map(Number);return new Date(Date.UTC(t,a-1,1)).toLocaleDateString(i||"en",{month:"long",year:"numeric",timeZone:"UTC"})})(N)})]}),(0,s.jsxs)("div",{className:"join",children:[(0,s.jsx)("button",{type:"button",className:"btn btn-xs join-item ".concat("week"===b?"btn-active":"btn-ghost"),"aria-pressed":"week"===b,onClick:()=>x("week"),children:m("availability.month.weekView")}),(0,s.jsx)("button",{type:"button",className:"btn btn-xs join-item ".concat("month"===b?"btn-active":"btn-ghost"),"aria-pressed":"month"===b,onClick:()=>{C("".concat((a>=p&&a<=(0,y.fi)(p,6)?a:(0,y.fi)(p,3)).slice(0,7),"-01")),x("month")},children:m("availability.month.monthView")})]})]}),M&&(0,s.jsx)("div",{className:"text-sm text-red-600 mb-3",children:m("availability.week.loadFailed")}),"month"===b?(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"grid grid-cols-7 gap-1 mb-1",children:H.slice(0,7).map(e=>(0,s.jsx)("div",{className:"text-[11px] font-medium text-gray-500 text-center",children:(e=>{let[t,a,s]=e.split("-").map(Number);return new Date(Date.UTC(t,a-1,s)).toLocaleDateString(i||"en",{weekday:"short",timeZone:"UTC"})})(e)},e))}),(0,s.jsx)("div",{className:"grid grid-cols-7 gap-1",children:H.map(e=>{let l=e.slice(0,7)===N.slice(0,7),i=(0,y.j$)(t,e),r=((null==t?void 0:t.overrides)||[]).some(t=>t.date===e),n=O[e]||[],o=n.filter(e=>"booking"===e.kind||"hold"===e.kind||"slot"===e.kind&&(e.booked||0)>0).length,d=n.some(e=>"slot"===e.kind),c=n.some(e=>
1"timeOff"===e.kind),b=e===a,u=e<a;return(0,s.jsxs)("button",{type:"button",onClick:()=>{k(j(e)),x("week")},title:m("availability.month.openWeek"),className:"text-left rounded-md border p-1.5 min-h-[4.5rem] flex flex-col gap-0.5 hover:border-blue-300 transition-colors ".concat(b?"border-blue-300":"border-gray-200"," ").concat(!l?"bg-gray-50 opacity-50":"bg-white"," ").concat(u?"opacity-60":""),children:[(0,s.jsx)("span",{className:"text-xs font-semibold ".concat(b?"text-blue-700":"text-gray-700"),children:Number(e.slice(8))}),r&&0===i.length?(0,s.jsx)("span",{className:"self-start rounded bg-amber-100 text-amber-800 px-1 text-[10px] font-medium leading-4",children:m("availability.week.dayOff")}):0===i.length?(0,s.jsx)("span",{className:"text-[10px] text-gray-400 leading-4",children:m("availability.week.closed")}):r?(0,s.jsx)("span",{className:"text-[10px] text-amber-700 font-medium leading-4",children:m("availability.week.differentHours")}):null,o>0&&(0,s.jsx)("span",{className:"self-start rounded bg-blue-100 text-blue-900 px-1 text-[10px] font-medium leading-4",children:m("availability.month.sessions",{count:o})}),(d||c)&&(0,s.jsxs)("span",{className:"flex gap-1 mt-auto",children:[d&&(0,s.jsx)("span",{className:"w-2 h-2 rounded-full bg-purple-400",title:m("availability.week.kindSlot")}),c&&(0,s.jsx)("span",{className:"w-2 h-2 rounded-full bg-gray-400",title:m("availability.week.kindTimeOff")})]})]},e)})}),(0,s.jsx)("p",{className:"text-[11px] text-gray-500 mt-2",children:m("availability.month.hint")})]}):(0,s.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-7 gap-2",children:_.map(e=>{let l=(0,y.j$)(t,e),i=((null==t?void 0:t.overrides)||[]).some(t=>t.date===e),r=(O[e]||[]).slice().sort((e,t)=>e.start-t.start),b=e===a,x=e<a;return(0,s.jsxs)("div",{className:"rounded-lg border p-2 min-h-[8rem] flex flex-col ".concat(b?"border-blue-300":"border-gray-200"," ").concat(x?"opacity-60":""),children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsx)("div",{className:"text-xs font-semibold ".concat(b?"text-blue-700":"text-gray-700"),children:F(e)}),!x&&(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs px-1 text-gray-500",title:m("availability.week.addTimeOff"),"aria-label":m("availability.week.addTimeOff"),onClick:()=>n({date:e,start:l[0]?(0,y.$H)(l[0].start):"12:00",end:l[0]?(0,y.$H)(Math.min(l[0].start+60,l[0].end)):"13:00"}),children:(0,s.jsx)(c.A,{className:"w-3.5 h-3.5"})})]}),(0,s.jsxs)("div",{className:"text-[11px] text-gray-500 mb-2",children:[i&&0===l.length?(0,s.jsx)("span",{className:"inline-block rounded bg-amber-100 text-amber-800 px-1.5 py-0.5 font-medium",children:m("availability.week.dayOff")}):0===l.length?m("availability.week.closed"):l.map(e=>I(e)).join(", "),i&&l.length>0&&(0,s.jsx)("span",{className:"block text-amber-700 font-medium",children:m("availability.week.differentHours")})]}),(0,s.jsx)("div",{className:"space-y-1",children:r.map((e,t)=>{let a=(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"font-medium",children:I(e)}),(0,s.jsx)("div",{className:"truncate",children:e.label||L(e.kind)}),e.classKey&&(0,s.jsx)("div",{className:"font-semibold",children:m("manageBookings.class.booked",{booked:e.booked||0,capacity:e.capacity||0})})]}),l="block w-full text-left rounded border px-1.5 py-1 text-[11px] leading-tight ".concat(w[e.kind]||w.selection);return("booking"===e.kind||"hold"===e.kind)&&e.bookingId?(0,s.jsx)("a",{href:"".concat(o,"/manage-bookings?booking=").concat(e.bookingId),className:"".concat(l," hover:brightness-95"),title:m("availability.week.openBooking"),children:a},t):"slot"===e.kind&&e.classKey&&(e.booked||0)>0?(0,s.jsx)("a",{href:"".concat(o,"/manage-bookings?class=").concat(encodeURIComponent(e.classKey)),className:"".concat(l," hover:brightness-95"),title:m("manageBookings.class.attendees"),children:a},t):"slot"===e.kind&&e.listingId?(0,s.jsx)("a",{href:"".concat(o,"/edit-listing/").concat(e.listingId),className:"".concat(l," hover:brightness-95"),title:m("availability.week.openListing"),children:a}
1,t):"timeOff"===e.kind&&d?(0,s.jsx)("button",{type:"button",onClick:d,className:"".concat(l," hover:brightness-95"),title:m("availability.week.openTimeOff"),children:a},t):(0,s.jsx)("div",{className:l,title:L(e.kind),children:a},t)})})]},e)})}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 mt-3 text-[11px] text-gray-600",children:[(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"w-3 h-3 rounded border bg-blue-100 border-blue-200"})," ",m("availability.week.kindBooking")]}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"w-3 h-3 rounded border border-dashed bg-blue-50 border-blue-100"})," ",m("availability.week.kindHold")]}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"w-3 h-3 rounded border bg-purple-100 border-purple-200"})," ",m("availability.week.kindSlot")]}),(0,s.jsxs)("span",{className:"inline-flex items-center gap-1",children:[(0,s.jsx)("span",{className:"w-3 h-3 rounded border bg-gray-200 border-gray-300"})," ",m("availability.week.kindTimeOff")]})]})]})}let N=[1,2,3,4,5,6,0],C=[0,5,10,15,20,30,45,60],O=[7,14,30,60,90,180,365],S={start:"09:00",end:"17:00"};function T(e){let t={};for(let a of(null==e?void 0:e.weekly)||[])t[a.weekday]=a.windows.map(e=>({...e}));return{weekly:t,overrides:((null==e?void 0:e.overrides)||[]).map(e=>({date:e.date,windows:e.windows.map(e=>({...e}))})),timeOff:((null==e?void 0:e.timeOff)||[]).map(e=>({...e})),stepMinutes:(null==e?void 0:e.stepMinutes)||y.f4,bufferMinutes:(null==e?void 0:e.bufferMinutes)||0,horizonDays:(null==e?void 0:e.horizonDays)||y.gT}}function A(e,t){let[a,s,l]=e.split("-").map(Number);return new Date(Date.UTC(a,s-1,l+t)).toISOString().slice(0,10)}function M(e){return new Set((e||[]).filter(e=>0===e.windows.length).map(e=>e.date))}function D(e){if(0===e.length)return{...S};let[t,a]=e[e.length-1].end.split(":").map(Number),s=Math.min(1380,60*t+a+60),l=Math.min(1440,s+120),i=e=>"".concat(String(Math.floor(e/60)).padStart(2,"0"),":").concat(String(e%60).padStart(2,"0"));return{start:i(s),end:i(l)}}function U(e){let{initialHours:t,timeZone:a,sellerTimeZonesEnabled:g,today:f,sharedListings:v,language:w,use12HourTime:j,settingsUrl:U,dashboardUrl:H}=e,{t:_}=(0,h.Bd)(w),[B,z]=(0,l.useState)(()=>T(t)),[Z,I]=(0,l.useState)(t),[L,F]=(0,l.useState)(!1),[W,E]=(0,l.useState)(null),[$,R]=(0,l.useState)(0),J=(0,l.useMemo)(()=>JSON.stringify(Z?T(Z):T(null)),[Z]),K=JSON.stringify(B)!==J,P=(0,l.useRef)(null);(0,l.useEffect)(()=>()=>{P.current&&clearTimeout(P.current)},[]);let V=(0,l.useCallback)((e,t)=>{E({type:e,text:t}),P.current&&clearTimeout(P.current),P.current=setTimeout(()=>E(null),"success"===e?3e3:8e3)},[]),Y=(0,l.useCallback)(e=>new Date(Date.UTC(2026,2,1+e)).toLocaleDateString(w||"en",{weekday:"long",timeZone:"UTC"}),[w]),q=e=>z(t=>e(t)),[G,Q]=(0,l.useState)(""),[X,ee]=(0,l.useState)(""),et=!!G&&!!X&&G>=f&&X>=G,ea=e=>{let[t,a,s]=e.split("-").map(Number);return new Date(Date.UTC(t,a-1,s)).toLocaleDateString(w||"en",{day:"numeric",month:"short",year:"numeric",timeZone:"UTC"})},[es,el]=(0,l.useState)(()=>M(null==t?void 0:t.overrides)),ei=new Map;for(let e of B.overrides)ei.set(e.date,(ei.get(e.date)||0)+1);let er=e=>0===e.windows.length&&es.has(e.date)&&1===ei.get(e.date),en=function(e){let t=[...new Set(e.filter(e=>0===e.windows.length&&e.date).map(e=>e.date))].sort(),a=[];for(let e of t){let t=a[a.length-1];t&&A(t.to,1)===e?(t.to=e,t.count+=1):a.push({from:e,to:e,count:1})}return a.filter(e=>e.count>1)}(B.overrides.filter(er)),eo=e=>er(e)&&en.some(t=>e.date>=t.from&&e.date<=t.to),ed=e=>{switch(e){case"window_order":return _("availability.errors.windowOrder");case"windows_overlap":return _("availability.errors.windowsOverlap");case"too_many_windows":return _("availability.errors.tooManyWindows",{max:y.wC});case"too_many_overrides":return _("availability.errors.tooManyOverrides",{max:y.v6});case"bad_date":return _("availability.errors.badDate");default:return _("availability.errors.invalid")}},ec=async()=>{var e;let t=(0,y.ZW)({weekly:Object.entries(B.weekly).map(e=>
1{let[t,a]=e;return{weekday:Number(t),windows:a}}).filter(e=>e.windows.length>0),overrides:B.overrides,timeOff:B.timeOff,stepMinutes:B.stepMinutes,bufferMinutes:B.bufferMinutes,horizonDays:B.horizonDays},f);if(t.error)return void V("error",ed(t.error));F(!0);try{let a=await fetch("/api/sellers/availability",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({hours:t.value})}),s=await a.json().catch(()=>({}));if(!a.ok)return void V("error",(null==s?void 0:s.code)?ed(s.code):(null==s?void 0:s.error)||_("availability.errors.saveFailed"));I(s.hours),el(M(null==(e=s.hours)?void 0:e.overrides)),z(T(s.hours)),R(e=>e+1),V("success",_("availability.saved"))}catch(e){V("error",_("availability.errors.saveFailed"))}finally{F(!1)}},em=a?(0,p._M)(a,w||"en"):null,eb=!(0,y.Wf)(Z),ex=(e,t,a)=>(0,s.jsx)("input",{type:"time",step:300,value:e,"aria-label":a,onChange:e=>e.target.value&&t(e.target.value),className:"input input-bordered input-sm w-[7.5rem] text-sm"});return(0,s.jsxs)("div",{className:"max-w-5xl",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 mb-6",children:[(0,s.jsx)("div",{className:"p-2 rounded-lg",style:{backgroundColor:"color-mix(in srgb, var(--theme-primary) 10%, transparent)"},children:(0,s.jsx)(i.A,{className:"h-6 w-6",style:{color:"var(--theme-primary, #3b82f6)"}})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-2xl font-bold text-gray-900",children:_("availability.title")}),(0,s.jsx)("p",{className:"text-sm text-gray-600 mt-1",children:_("availability.intro")})]})]}),(0,s.jsxs)("div",{className:"rounded-lg border border-gray-200 bg-gray-50 p-4 mb-6 text-sm text-gray-700 space-y-2",children:[(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(r.A,{className:"w-4 h-4 mt-0.5 text-gray-400 flex-shrink-0"}),(0,s.jsxs)("div",{children:[em?(0,s.jsx)("span",{children:_("availability.timesInZone",{zone:em})}):(0,s.jsx)("span",{children:_("availability.noZone")}),g&&(0,s.jsxs)(s.Fragment,{children:[" ",(0,s.jsx)("a",{href:U,className:"underline",style:{color:"var(--theme-primary, #3b82f6)"},children:_("availability.changeZone")})]})]})]}),(0,s.jsxs)("div",{className:"flex items-start gap-2",children:[(0,s.jsx)(n.A,{className:"w-4 h-4 mt-0.5 text-gray-400 flex-shrink-0"}),(0,s.jsx)("div",{children:v.length>0?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{children:_("availability.usedBy",{count:v.length})}),(0,s.jsx)("span",{className:"ml-1 text-gray-500",children:v.map(e=>e.title).filter(Boolean).join(", ")})]}):(0,s.jsx)("span",{children:_("availability.usedByNone")})})]}),eb&&(0,s.jsxs)("div",{className:"flex items-start gap-2 text-amber-800",children:[(0,s.jsx)(o.A,{className:"w-4 h-4 mt-0.5 flex-shrink-0"}),(0,s.jsx)("span",{children:_("availability.noHoursYet")})]})]}),(0,s.jsxs)("section",{className:"bg-white rounded-xl border border-gray-200 p-6 mb-6",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-900 mb-1",children:_("availability.weekly.title")}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:_("availability.weekly.help")}),(0,s.jsx)("div",{className:"divide-y divide-gray-100",children:N.map(e=>{let t=B.weekly[e]||[],a=t.length>0;return(0,s.jsxs)("div",{className:"py-3 flex flex-col sm:flex-row sm:items-start gap-3",children:[(0,s.jsxs)("label",{className:"flex items-center gap-3 sm:w-40 flex-shrink-0 cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",className:"toggle toggle-primary toggle-sm",checked:a,onChange:t=>q(a=>({...a,weekly:{...a.weekly,[e]:t.target.checked?[{...S}]:[]}}))}),(0,s.jsx)("span",{className:"text-sm font-medium ".concat(a?"text-gray-900":"text-gray-400"),children:Y(e)})]}),(0,s.jsxs)("div",{className:"flex-1 space-y-2",children:[!a&&(0,s.jsx)("div",{className:"text-sm text-gray-400 py-1",children:_("availability.weekly.unavailable")}),t.map((t,a)=>(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[ex(t.start,t=>q(s=>{let l=[...s.weekly[e]||[]];return l[a]={...l[a],start:t},{...s,weekly:{...s.weekly,[e]:l}}}),_("availability.weekly.from")),(0,s.jsx)("span",{className:"text-gray-400",children:"â"}),ex(t.end,t=>q(s=>{let l=[...s.weekly[e]||[]];return l[a]={...l[a],end:t},{...s,weekly:{...s.weekly,[e]:l}}}),_("availability.weekly.to")),(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs text-gray-500","aria-label":_("common.remove"),onClick:()=>q(t=>{let s=(t.weekly[e]||[]).filter((e,t)=>
1t!==a);return{...t,weekly:{...t.weekly,[e]:s}}}),children:(0,s.jsx)(d.A,{className:"w-4 h-4"})})]},a)),a&&(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[t.length<y.wC&&(0,s.jsxs)("button",{type:"button",className:"btn btn-ghost btn-xs",onClick:()=>q(t=>({...t,weekly:{...t.weekly,[e]:[...t.weekly[e]||[],D(t.weekly[e]||[])]}})),children:[(0,s.jsx)(c.A,{className:"w-3.5 h-3.5"})," ",_("availability.weekly.addHours")]}),(0,s.jsxs)("button",{type:"button",className:"btn btn-ghost btn-xs text-gray-500",onClick:()=>q(t=>{let a=(t.weekly[e]||[]).map(e=>({...e})),s={};for(let e of[1,2,3,4,5])s[e]=a.map(e=>({...e}));return s[0]=t.weekly[0]||[],s[6]=t.weekly[6]||[],(0===e||6===e)&&(s[e]=a),{...t,weekly:s}}),children:[(0,s.jsx)(m.A,{className:"w-3.5 h-3.5"})," ",_("availability.weekly.copyToWeekdays")]})]})]})]},e)})})]}),(0,s.jsxs)("section",{className:"bg-white rounded-xl border border-gray-200 p-6 mb-6",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-900 mb-1",children:_("availability.rules.title")}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:_("availability.rules.help")}),(0,s.jsxs)("div",{className:"grid gap-4 sm:grid-cols-3",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:_("availability.rules.step")}),(0,s.jsx)("select",{className:"select select-bordered select-sm w-full",value:B.stepMinutes,onChange:e=>q(t=>({...t,stepMinutes:Number(e.target.value)})),children:y.Sf.map(e=>(0,s.jsx)("option",{value:e,children:_("availability.rules.everyMinutes",{count:e})},e))}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:_("availability.rules.stepHelp")})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:_("availability.rules.buffer")}),(0,s.jsx)("select",{className:"select select-bordered select-sm w-full",value:B.bufferMinutes,onChange:e=>q(t=>({...t,bufferMinutes:Number(e.target.value)})),children:C.map(e=>(0,s.jsx)("option",{value:e,children:0===e?_("availability.rules.noBuffer"):_("availability.rules.minutes",{count:e})},e))}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:_("availability.rules.bufferHelp")})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-sm font-medium text-gray-700 mb-1",children:_("availability.rules.horizon")}),(0,s.jsx)("select",{className:"select select-bordered select-sm w-full",value:B.horizonDays,onChange:e=>q(t=>({...t,horizonDays:Number(e.target.value)})),children:O.map(e=>(0,s.jsx)("option",{value:e,children:_("availability.rules.daysAhead",{count:e})},e))}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:_("availability.rules.horizonHelp")})]})]})]}),(0,s.jsxs)("section",{className:"bg-white rounded-xl border border-gray-200 p-6 mb-6",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,s.jsx)(b.A,{className:"w-5 h-5 text-gray-500"}),(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:_("availability.overrides.title")})]}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:_("availability.overrides.help")}),(0,s.jsxs)("div",{className:"space-y-3",children:[en.map(e=>(0,s.jsxs)("div",{className:"rounded-lg border border-gray-200 p-3 flex items-center gap-3",children:[(0,s.jsx)(b.A,{className:"w-4 h-4 text-gray-400"}),(0,s.jsx)("span",{className:"text-sm text-gray-800",children:_("availability.overrides.daysOffRange",{from:ea(e.from),to:ea(e.to),count:e.count})}),(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs text-gray-500 ml-auto","aria-label":_("common.remove"),onClick:()=>q(t=>({...t,overrides:t.overrides.filter(t=>!(eo(t)&&t.date>=e.from&&t.date<=e.to))})),children:(0,s.jsx)(d.A,{className:"w-4 h-4"})})]},e.from)),B.overrides.map((e,t)=>{if(eo(e))return null;let a=0===e.windows.length;return(0,s.jsxs)("div",{className:"rounded-lg border border-gray-200 p-3",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,s.jsx)("input",{type:"date",min:f,value:e.date,className:"input input-bordered input-sm",onChange:e=>q(a=>{let s=[...a.overrides];return s[t]={...s[t],date:e.target.value},{...a,overrides:s}})}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-sm cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",className:"checkbox checkbox-sm",checked:a,onChange:e=>q(a=>{let s=[...a.overrides];return s[t]={...s[t],windows:e.target.checked?[]:[{...S}]},{...a,overrides:s}})}),_("availability.overrides.dayOff")]}),(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs text-gray-500 ml-auto","aria-label":_("common.remove"),onClick:()=>q(e=>({...e,overrides:e.overrides.filter((e,a)=>a!==t)})),children:(0,s.jsx)(d.A,{className:"w-4 h-4"})})]}),!a&&(0,s.jsxs)("div",{className:"mt-2 space-y-2 pl-1",children:[e.windows.map((a,l)=>(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[ex(a.start,e=>q(a=>{let s=[...a.overrides],i=[...s[t].windows];return i[l]={...i[l],start:e},s[t]={...s[t],windows:i},{...a,overrides:s}}),_("availability.weekly.from")),(0,s.jsx)("span",{className:"text-gray-400",children:"â"}),ex(a.end,e=>q(a=>{let s=[...a.overrides],i=[...s[t].windows];return i[l]={...i[l],end:e},s[t]={...s[t],windows:i},{...a,overrides:s}}),_("availability.weekly.to")),e.windows.length>1&&(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs text-gray-500","aria-label":_("common.remove"),onClick:()=>q(e=>{let a=[...e.overrides];return a[t]={...a[t],windows:a[t].windows.filter((e,t)=>
1t!==l)},{...e,overrides:a}}),children:(0,s.jsx)(d.A,{className:"w-4 h-4"})})]},l)),e.windows.length<y.wC&&(0,s.jsxs)("button",{type:"button",className:"btn btn-ghost btn-xs",onClick:()=>q(e=>{let a=[...e.overrides];return a[t]={...a[t],windows:[...a[t].windows,D(a[t].windows)]},{...e,overrides:a}}),children:[(0,s.jsx)(c.A,{className:"w-3.5 h-3.5"})," ",_("availability.weekly.addHours")]})]})]},t)}),(0,s.jsxs)("button",{type:"button",className:"btn btn-outline btn-sm",onClick:()=>q(e=>({...e,overrides:[...e.overrides,{date:f,windows:[]}]})),children:[(0,s.jsx)(c.A,{className:"w-4 h-4"})," ",_("availability.overrides.add")]}),(0,s.jsxs)("div",{className:"rounded-lg border border-dashed border-gray-300 p-3",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-gray-700 mb-2",children:_("availability.overrides.rangeTitle")}),(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("input",{type:"date",min:f,value:G,"aria-label":_("availability.weekly.from"),className:"input input-bordered input-sm",onChange:e=>{Q(e.target.value),(!X||X<e.target.value)&&ee(e.target.value)}}),(0,s.jsx)("span",{className:"text-gray-400",children:"â"}),(0,s.jsx)("input",{type:"date",min:G||f,value:X,"aria-label":_("availability.weekly.to"),className:"input input-bordered input-sm",onChange:e=>ee(e.target.value)}),(0,s.jsxs)("button",{type:"button",className:"btn btn-outline btn-sm",disabled:!et,onClick:()=>{if(!et)return;let e=[];for(let t=G;t<=X;t=A(t,1))e.push(t);let t=B.overrides.filter(t=>!e.includes(t.date));if(t.length+e.length>y.v6)return void V("error",_("availability.errors.tooManyOverrides",{max:y.v6}));q(a=>({...a,overrides:[...t,...e.map(e=>({date:e,windows:[]}))]})),el(t=>new Set([...t,...e])),Q(""),ee("")},children:[(0,s.jsx)(c.A,{className:"w-4 h-4"})," ",_("availability.overrides.addRange")]})]})]})]})]}),(0,s.jsxs)("section",{id:"availability-time-off",className:"bg-white rounded-xl border border-gray-200 p-6 mb-6 scroll-mt-24",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,s.jsx)(x.A,{className:"w-5 h-5 text-gray-500"}),(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-900",children:_("availability.timeOff.title")})]}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:_("availability.timeOff.help")}),(0,s.jsxs)("div",{className:"space-y-2",children:[B.timeOff.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,s.jsx)("input",{type:"date",min:f,value:e.date,className:"input input-bordered input-sm",onChange:e=>q(a=>{let s=[...a.timeOff];return s[t]={...s[t],date:e.target.value},{...a,timeOff:s}})}),ex(e.start,e=>q(a=>{let s=[...a.timeOff];return s[t]={...s[t],start:e},{...a,timeOff:s}}),_("availability.weekly.from")),(0,s.jsx)("span",{className:"text-gray-400",children:"â"}),ex(e.end,e=>q(a=>{let s=[...a.timeOff];return s[t]={...s[t],end:e},{...a,timeOff:s}}),_("availability.weekly.to")),(0,s.jsx)("input",{type:"text",value:e.note||"",maxLength:120,placeholder:_("availability.timeOff.notePlaceholder"),className:"input input-bordered input-sm flex-1 min-w-[10rem]",onChange:e=>q(a=>{let s=[...a.timeOff];return s[t]={...s[t],note:e.target.value},{...a,timeOff:s}})}),(0,s.jsx)("button",{type:"button",className:"btn btn-ghost btn-xs text-gray-500","aria-label":_("common.remove"),onClick:()=>q(e=>({...e,timeOff:e.timeOff.filter((e,a)=>a!==t)})),children:(0,s.jsx)(d.A,{className:"w-4 h-4"})})]},t)),(0,s.jsxs)("button",{type:"button",className:"btn btn-outline btn-sm",onClick:()=>q(e=>({...e,timeOff:[...e.timeOff,{date:f,start:"12:00",end:"13:00"}]})),children:[(0,s.jsx)(c.A,{className:"w-4 h-4"})," ",_("availability.timeOff.add")]})]})]}),(0,s.jsx)("div",{className:"sticky bottom-4 z-10",children:(0,s.jsxs)("div",{className:"bg-white rounded-xl border border-gray-200 shadow-lg p-4 flex items-center gap-4 flex-wrap",children:[(0,s.jsxs)("button",{type:"button",onClick:ec,disabled:L||!K,className:"btn btn-sm text-white",style:{backgroundColor:"var(--theme-primary, #3b82f6)",borderColor:"var(--theme-primary, #3b82f6)"},children:[L&&(0,s.jsx)(u.A,{className:"w-4 h-4 animate-spin"}),L?_("common.saving"):_("availability.save")]}),K&&!L&&(0,s.jsx)("span",{className:"text-sm text-gray-500",children:_("availability.unsaved")}),W&&(0,s.jsx)("span",{className:"text-sm ".concat("success"===W.type?"text-green-700":"text-red-600"),children:W.text})]})}),(0,s.jsxs)("section",{className:"bg-white rounded-xl border border-gray-200 p-6 mt-6",children:[(0,s.jsx)("h2",{className:"text-lg font-semibold text-gray-900 mb-1",children:_("availability.week.title")}),(0,s.jsx)("p",{className:"text-sm text-gray-500 mb-4",children:_("availability.week.help")}),(0,s.jsx)(k,{hours:Z,today:f,language:w,use12HourTime:j,dashboardUrl:H,onOpenTimeOff:()=>{let e=[...document.querySelectorAll("#availability-time-off")].find(e=>null!==e.offsetParent);null==e||e.scrollIntoView({behavior:"smooth",block:"start"})},onAddTimeOff:e=>{q(t=>({...t,timeOff:[...t.timeOff,e]})),window.scrollTo({top:0,behavior:"smooth"})}},$)]})]})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.